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

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