aboutsummaryrefslogtreecommitdiff
path: root/tests/functional_tests
diff options
context:
space:
mode:
authoriamamyth <user@example.com>2020-09-22 05:21:35 +0200
committerselsta <selsta@sent.at>2020-09-24 20:04:05 +0200
commit163f83720fa0f97e1a056d400db9285694fa0342 (patch)
tree5b008b1495a992b1a2471224b2cc47478f3c78df /tests/functional_tests
parentMerge pull request #6819 (diff)
downloadmonero-163f83720fa0f97e1a056d400db9285694fa0342.tar.xz
functional_tests: rewrite mining code, clearer timeout info
Diffstat (limited to 'tests/functional_tests')
-rwxr-xr-xtests/functional_tests/mining.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/tests/functional_tests/mining.py b/tests/functional_tests/mining.py
index c60bf8396..34b4aceab 100755
--- a/tests/functional_tests/mining.py
+++ b/tests/functional_tests/mining.py
@@ -95,20 +95,19 @@ class MiningTest():
assert res_status.block_reward >= 600000000000
# wait till we mined a few of them
+ target_height = prev_height + 5
+ height = prev_height
timeout = 60 # randomx is slow to init
- timeout_height = prev_height
- while True:
- time.sleep(1)
- res_info = daemon.get_info()
- height = res_info.height
- if height >= prev_height + 5:
- break
- if height > timeout_height:
- timeout = 5
- timeout_height = height
+ while height < target_height:
+ seen_height = height
+ for _ in range(timeout):
+ time.sleep(1)
+ height = daemon.get_info().height
+ if height > seen_height:
+ break
else:
- timeout -= 1
- assert timeout >= 0
+ assert False, 'Failed to mine successor to block %d (initial block = %d)' % (seen_height, prev_height)
+ timeout = 5
if via_daemon:
res = daemon.stop_mining()