mirror of
https://github.com/monero-project/monero.git
synced 2025-08-12 06:50:23 -04:00
tests: Speed up p2p reorg test
Use a fixed, 240s deadline for the daemons to reach agreement and poll with a suitable frequency (.25s), rather than polling up to 100 times at roughly 10s intervals.
This commit is contained in:
parent
84685492e6
commit
cb91dcee36
1 changed files with 9 additions and 6 deletions
|
@ -150,15 +150,18 @@ class P2PTest():
|
||||||
# reconnect and wait for sync
|
# reconnect and wait for sync
|
||||||
daemon2.out_peers(8)
|
daemon2.out_peers(8)
|
||||||
daemon3.out_peers(8)
|
daemon3.out_peers(8)
|
||||||
loops = 100
|
deadline = time.monotonic() + 240
|
||||||
while True:
|
result = None
|
||||||
|
while result is None:
|
||||||
res2 = daemon2.get_info()
|
res2 = daemon2.get_info()
|
||||||
res3 = daemon3.get_info()
|
res3 = daemon3.get_info()
|
||||||
if res2.top_block_hash == res3.top_block_hash:
|
if res2.top_block_hash == res3.top_block_hash:
|
||||||
break
|
result = True
|
||||||
time.sleep(10)
|
elif time.monotonic() >= deadline:
|
||||||
loops -= 1
|
result = False
|
||||||
assert loops >= 0
|
else:
|
||||||
|
time.sleep(.25)
|
||||||
|
assert result, 'Sync timed out'
|
||||||
|
|
||||||
def test_p2p_tx_propagation(self):
|
def test_p2p_tx_propagation(self):
|
||||||
print('Testing P2P tx propagation')
|
print('Testing P2P tx propagation')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue