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

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