mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-28 21:12:29 +02:00
QA: Add forbid_msgs param to TestNode.wait_for_debug_log
This commit is contained in:
parent
1248d0da22
commit
8e46b4a040
@ -519,7 +519,7 @@ class TestNode():
|
||||
self._raise_assertion_error('Expected messages "{}" does not partially match log:\n\n{}\n\n'.format(str(expected_msgs), print_log))
|
||||
|
||||
@contextlib.contextmanager
|
||||
def busy_wait_for_debug_log(self, expected_msgs, timeout=60):
|
||||
def busy_wait_for_debug_log(self, expected_msgs, timeout=60, *, forbid_msgs=()):
|
||||
"""
|
||||
Block until we see a particular debug log message fragment or until we exceed the timeout.
|
||||
Return:
|
||||
@ -536,6 +536,13 @@ class TestNode():
|
||||
dl.seek(prev_size)
|
||||
log = dl.read()
|
||||
|
||||
for msg in forbid_msgs:
|
||||
if msg in log:
|
||||
print_log = " - " + "\n - ".join(log.decode("utf8", errors="replace").splitlines())
|
||||
self._raise_assertion_error(
|
||||
'Forbidden message "{}" partially matched log:\n\n{}\n\n'.format(
|
||||
str(msg), print_log))
|
||||
|
||||
for expected_msg in expected_msgs:
|
||||
if expected_msg not in log:
|
||||
found = False
|
||||
|
Loading…
Reference in New Issue
Block a user