Blame SOURCES/0012-ipatests-fix-TestOTPToken-test_check_otpd_after_idle_timeout_rhbz#2053024.patch

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