1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

tests/auth_log: Make discardMessages() more reliable

It can take two or three calls to msg_ctx.loop_once() before a message
comes in. Make sure we get all of the messages.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton 2023-05-25 12:15:07 +12:00 committed by Andrew Bartlett
parent 5c1ea54cea
commit 47a0b9a4cb
2 changed files with 13 additions and 6 deletions

View File

@ -129,10 +129,19 @@ class AuthLogTestBase(samba.tests.TestCase):
# Discard any previously queued messages.
@classmethod
def discardMessages(cls):
cls.msg_ctx.loop_once(0.001)
while cls.context["messages"]:
cls.context["messages"] = []
cls.msg_ctx.loop_once(0.001)
messages = cls.context["messages"]
while True:
messages.clear()
# tevent presumably has other tasks to run, so we might need two or
# three loops before a message comes through.
for _ in range(5):
cls.msg_ctx.loop_once(0.001)
if not messages:
# No new messages. Weve probably got them all.
break
# Remove any NETLOGON authentication messages
# NETLOGON is only performed once per session, so to avoid ordering

View File

@ -1,2 +0,0 @@
^samba.tests.auth_log_pass_change.samba.tests.auth_log_pass_change.AuthLogPassChangeTests.test_ldap_change_password_bad_user.ad_dc_ntvfs
^samba.tests.auth_log_pass_change.samba.tests.auth_log_pass_change.AuthLogPassChangeTests.test_ldap_change_password_bad_user.ad_dc_smb1