mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-06-02 15:32:34 +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))
|
self._raise_assertion_error('Expected messages "{}" does not partially match log:\n\n{}\n\n'.format(str(expected_msgs), print_log))
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@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.
|
Block until we see a particular debug log message fragment or until we exceed the timeout.
|
||||||
Return:
|
Return:
|
||||||
@ -536,6 +536,13 @@ class TestNode():
|
|||||||
dl.seek(prev_size)
|
dl.seek(prev_size)
|
||||||
log = dl.read()
|
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:
|
for expected_msg in expected_msgs:
|
||||||
if expected_msg not in log:
|
if expected_msg not in log:
|
||||||
found = False
|
found = False
|
||||||
|
Loading…
Reference in New Issue
Block a user