bb0ded
From 4c54e9d6ddb72eab6f654bf3dc2d29f27498ac96 Mon Sep 17 00:00:00 2001
bb0ded
From: Florence Blanc-Renaud <flo@redhat.com>
bb0ded
Date: Sun, 5 Dec 2021 17:38:58 +0100
bb0ded
Subject: [PATCH] ipatests: fix
bb0ded
 TestOTPToken::test_check_otpd_after_idle_timeout
bb0ded
bb0ded
The test sets 389-ds nsslapd-idletimeout to 60s, then does a
bb0ded
kinit with an otp token (which makes ipa-otpd create a LDAP
bb0ded
connection), then sleeps for 60s. The expectation is that
bb0ded
ns-slapd will detect that the LDAP conn from ipa-otpd is idle
bb0ded
and close the connection.
bb0ded
According to 389ds doc, the idle timeout is enforced when the
bb0ded
connection table is walked. By doing a ldapsearch, the test
bb0ded
"wakes up" ns-slapd and forces the detection of ipa-otpd
bb0ded
idle connection.
bb0ded
bb0ded
Fixes: https://pagure.io/freeipa/issue/9044
bb0ded
Signed-off-by: Florence Blanc-Renaud <flo@redhat.com>
bb0ded
Reviewed-By: Anuja More <amore@redhat.com>
bb0ded
---
bb0ded
 ipatests/test_integration/test_otp.py | 3 +++
bb0ded
 1 file changed, 3 insertions(+)
bb0ded
bb0ded
diff --git a/ipatests/test_integration/test_otp.py b/ipatests/test_integration/test_otp.py
bb0ded
index 353470897..d8ce527ca 100644
bb0ded
--- a/ipatests/test_integration/test_otp.py
bb0ded
+++ b/ipatests/test_integration/test_otp.py
bb0ded
@@ -354,6 +354,9 @@ class TestOTPToken(IntegrationTest):
bb0ded
             otpvalue = totp.generate(int(time.time())).decode("ascii")
bb0ded
             kinit_otp(self.master, USER, password=PASSWORD, otp=otpvalue)
bb0ded
             time.sleep(60)
bb0ded
+            # ldapsearch will wake up slapd and force walking through
bb0ded
+            # the connection list, in order to spot the idle connections
bb0ded
+            tasks.ldapsearch_dm(self.master, "", ldap_args=[], scope="base")
bb0ded
 
bb0ded
             def test_cb(cmd_jornalctl):
bb0ded
                 # check if LDAP connection is timed out
bb0ded
-- 
bb0ded
2.34.1
bb0ded