diff options
| author | Joseph Sutton <josephsutton@catalyst.net.nz> | 2023-06-14 16:29:27 +1200 |
|---|---|---|
| committer | Andrew Bartlett <abartlet@samba.org> | 2023-06-14 23:55:42 +0000 |
| commit | 9b0a71bd3085b7c67a72bf498870c69cf6b3baa5 (patch) | |
| tree | dc205aabc40f8d53e54c4dcf1d556ca9e48c159e /python | |
| parent | 67da91ef1665a15d93233c5a74a63926f5a2ef7e (diff) | |
| download | samba-9b0a71bd3085b7c67a72bf498870c69cf6b3baa5.tar.gz samba-9b0a71bd3085b7c67a72bf498870c69cf6b3baa5.tar.bz2 samba-9b0a71bd3085b7c67a72bf498870c69cf6b3baa5.zip | |
tests/auth_log: Refactor waitForMessages() to use nextMessage()
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jun 14 23:55:42 UTC 2023 on atb-devel-224
Diffstat (limited to 'python')
| -rw-r--r-- | python/samba/tests/auth_log_base.py | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/python/samba/tests/auth_log_base.py b/python/samba/tests/auth_log_base.py index c257f2fbafb..a9b2b3fa06b 100644 --- a/python/samba/tests/auth_log_base.py +++ b/python/samba/tests/auth_log_base.py @@ -113,23 +113,16 @@ class AuthLogTestBase(samba.tests.TestCase): until all the logging messages have been received. """ - def completed(messages): - for message in messages: - if self.isRemote(message) and isLastExpectedMessage(message): - return True - return False - - self.connection = connection - - start_time = time.time() - while not completed(self.context["messages"]): - self.msg_ctx.loop_once(0.1) - if time.time() - start_time > 1: - self.connection = None + messages = [] + while True: + try: + msg = self.nextMessage() + except NoMessageException: return [] - self.connection = None - return list(filter(self.isRemote, self.context["messages"])) + messages.append(msg) + if isLastExpectedMessage(msg): + return messages def nextMessage(self, msgFilter=None): """Return the next relevant message, or throw a NoMessageException.""" |
