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