1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

tests/auth_log_pass_change: Fix flapping test

It appears that discardMessages() is still not entirely reliable. Ensure
that we filter out any messages from the Administrator’s authentication.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Joseph Sutton 2023-06-20 10:11:50 +12:00 committed by Stefan Metzmacher
parent 539cd51600
commit 9d7f179493

View File

@ -236,8 +236,14 @@ class AuthLogPassChangeTests(samba.tests.auth_log_base.AuthLogTestBase):
#
def test_ldap_change_password_bad_user(self):
def isLastExpectedMessage(msg):
# Accept any message we receive.
return True
msg_type = msg["type"]
# Accept any message we receive, except for those produced while
# the Administrator authenticates in setUp().
return (msg_type != "Authentication" or (
"Administrator" not in msg[msg_type]["clientAccount"])) and (
msg_type != "Authorization" or (
"Administrator" not in msg[msg_type]["account"]))
new_password = samba.generate_random_password(32, 32)
try: