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

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