Skip to content

Commit bbb18b2

Browse files
test
1 parent e0f5486 commit bbb18b2

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

test/functional/p2p_ibd_stalling.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ def run_test(self):
8484
# returning the number of downloaded (but not connected) blocks.
8585
bytes_recv = 150003 if not self.options.v2transport else 146934
8686
# Verify with: awk '/received: block/ {gsub("\\(", ""); sum+=$13} END{print sum}' log.txt
87-
self.wait_until(lambda: self.total_bytes_recv_for_blocks() == bytes_recv)
87+
def test() -> bool:
88+
self.log.info('self.total_bytes_recv_for_blocks=' + self.total_bytes_recv_for_blocks())
89+
return self.total_bytes_recv_for_blocks() == bytes_recv
90+
self.wait_until(test, 10, 10)
8891

8992
self.all_sync_send_with_ping(peers)
9093
# If there was a peer marked for stalling, it would get disconnected

test/functional/p2p_invalid_tx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def run_test(self):
165165
node.p2ps[0].send_txs_and_test([rejected_parent], node, success=False)
166166

167167
self.log.info('Test that a peer disconnection causes erase its transactions from the orphan pool')
168-
with node.assert_debug_log(expected_msgs=['Erased 100 orphan transaction(s) from peer=[0-9]+'], with_regex=True):
168+
with node.assert_debug_log(['Erased 100 orphan transaction(s) from peer=']):
169169
self.reconnect_p2p(num_connections=1)
170170

171171
self.log.info('Test that a transaction in the orphan pool is included in a new tip block causes erase this transaction from the orphan pool')

test/functional/test_framework/test_node.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ def debug_log_size(self, **kwargs) -> int:
488488
return dl.tell()
489489

490490
@contextlib.contextmanager
491-
def assert_debug_log(self, expected_msgs, unexpected_msgs=None, timeout=2, with_regex=False):
491+
def assert_debug_log(self, expected_msgs, unexpected_msgs=None, timeout=2):
492492
if unexpected_msgs is None:
493493
unexpected_msgs = []
494494
assert_equal(type(expected_msgs), list)
@@ -506,14 +506,10 @@ def assert_debug_log(self, expected_msgs, unexpected_msgs=None, timeout=2, with_
506506
log = dl.read()
507507
print_log = " - " + "\n - ".join(log.splitlines())
508508
for unexpected_msg in unexpected_msgs:
509-
if not with_regex:
510-
unexpected_msg = re.escape(unexpected_msg)
511-
if re.search(unexpected_msg, log, flags=re.MULTILINE):
509+
if re.search(re.escape(unexpected_msg), log, flags=re.MULTILINE):
512510
self._raise_assertion_error('Unexpected message "{}" partially matches log:\n\n{}\n\n'.format(unexpected_msg, print_log))
513511
for expected_msg in expected_msgs:
514-
if not with_regex:
515-
expected_msg = re.escape(expected_msg)
516-
if re.search(expected_msg, log, flags=re.MULTILINE) is None:
512+
if re.search(re.escape(expected_msg), log, flags=re.MULTILINE) is None:
517513
found = False
518514
if found:
519515
return

0 commit comments

Comments
 (0)