Skip to content

Commit

Permalink
test: Retry auth in checkClientCertAuthentication
Browse files Browse the repository at this point in the history
Password authentication sometimes fails on the first try.
  • Loading branch information
mvollmer committed Dec 11, 2023
1 parent c6f5e84 commit 179b9f2
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions test/verify/check-system-realms
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,16 @@ class CommonTests:

def do_test(authopts, expected, not_expected=None, session_leader=None):
m.start_cockpit(tls=True)
output = m.execute(['curl', '-ksS', '-D-', *authopts, 'https://localhost:9090/cockpit/login'])
for s in expected:
self.assertIn(s, output)
for s in (not_expected or []):
self.assertNotIn(s, output)

def try_auth():
output = m.execute(['curl', '-ksS', '-D-', *authopts, 'https://localhost:9090/cockpit/login'])
for s in expected:
self.assertIn(s, output)
for s in (not_expected or []):
self.assertNotIn(s, output)
return True

testlib.wait(try_auth, delay=5, tries=10)

# sessions/users often hang around in State=closing for a long time, ignore these
if session_leader:
Expand All @@ -427,6 +432,8 @@ class CommonTests:

# from sssd
self.allow_journal_messages("alice is not allowed to run sudo on x0. This incident will be reported.")
# occasional intermediate error during password auth
self.allow_journal_messages("cockpit-session: user account access failed: 4 alice: System error")

# cert auth should not be enabled by default
do_test(alice_cert_key, ["HTTP/1.1 401 Authentication required", '"authorize"'])
Expand Down

0 comments on commit 179b9f2

Please sign in to comment.