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

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