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

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