Skip to content

Commit f84bc33

Browse files
justin-stephensonjakub-vavra-cz
authored andcommitted
tests: test_sssctl__analyze_child_logs handle timing issue
in IDM-CI a different request to SSSD can happen before the failed login attempt provided in the test, making this other request show as CID #1 in the logs causing this test to fail. Concatenate the first three CID requests to address this. This timing issue is unrelated to the functionality this test needs to exercise (checking child logs of analyzer output). Reviewed-by: Jakub Vávra <jvavra@redhat.com>
1 parent 6924d67 commit f84bc33

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

src/tests/system/tests/test_sssctl.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,7 @@ def test_sssctl__analyze_child_logs(client: Client, ipa: IPA):
727727
5. Child (krb5) Logs contain info about failed login
728728
:customerscenario: True
729729
"""
730+
analyze_output = ""
730731
ipa.user("user1").add()
731732
client.sssd.nss["debug_level"] = "9"
732733
client.sssd.pam["debug_level"] = "9"
@@ -737,19 +738,29 @@ def test_sssctl__analyze_child_logs(client: Client, ipa: IPA):
737738
# close immediately, we just need the logs
738739
pass
739740

740-
result = client.sssctl.analyze_request("show --pam --child 1")
741-
assert result.rc == 0
742-
assert "user1@test" in result.stdout
743-
assert "SSS_PAM_AUTHENTICATE" in result.stdout
741+
# A different request to SSSD can happen before the login attempt below,
742+
# making this other request show as CID #1 in the logs, causing this test to fail.
743+
# Concatenate the first three CID requests to address this.
744+
for cid in range(1, 4):
745+
result = client.sssctl.analyze_request(f"show --pam --child {cid}")
746+
analyze_output += result.stdout
747+
748+
assert "user1@test" in analyze_output
749+
assert "SSS_PAM_AUTHENTICATE" in analyze_output
744750

745751
client.sssd.stop()
746752
client.sssd.clear(db=True, memcache=True, logs=True)
747753
client.sssd.start()
748754

749755
with pytest.raises(SSHAuthenticationError):
750756
client.ssh("user1", "Wrong").connect()
751-
result = client.sssctl.analyze_request("show --pam --child 1")
752-
assert "Preauthentication failed" in result.stdout, "'Preauthentication failed' was not found!"
757+
758+
# See comment above
759+
for cid in range(1, 4):
760+
result = client.sssctl.analyze_request(f"show --pam --child {cid}")
761+
analyze_output += result.stdout
762+
763+
assert "Preauthentication failed" in analyze_output, "'Preauthentication failed' was not found!"
753764

754765

755766
@pytest.mark.importance("medium")

0 commit comments

Comments
 (0)