Compare commits

...

5 Commits

Author SHA1 Message Date
Jack Nelson c0ce7b7b71
Merge branch 'main' into jn.sim-cli-flake-fix 2023-06-30 16:41:13 -04:00
Jack Nelson d3e3751599
Merge branch 'main' into jn.sim-cli-flake-fix 2023-06-29 23:47:31 -04:00
Jack Nelson 91067a075c
Revert "fix logic"
This reverts commit 32202ca831.
2023-06-26 14:31:36 -04:00
Jack Nelson 32202ca831
fix logic
thanks @altendky
2023-06-26 14:24:30 -04:00
Jack Nelson 0db5d187b0
fix flaky test 2023-06-25 16:35:28 -04:00
1 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,6 @@
from __future__ import annotations
import time
from pathlib import Path
from shutil import rmtree
@ -117,10 +118,16 @@ def _test_farm_and_revert_block(runner: CliRunner, address: str, simulator_name:
assert "Height: 6" in five_blocks_check.output
# do a reorg, 3 blocks back, 2 blocks forward, height now 8
reorg_result: Result = runner.invoke(cli, ["dev", "sim", "-n", simulator_name, "revert", "-b", "3", "-n", "2"])
assert reorg_result.exit_code == 0
assert "Block: 3 and above " in reorg_result.output and "Block Height is now: 8" in reorg_result.output
try: # we do a 'try' here because creating a couple of blocks might lead to a timeout on a slow runner.
reorg_result: Result = runner.invoke(cli, ["dev", "sim", "-n", simulator_name, "revert", "-b", "3", "-n", "2"])
assert reorg_result.exit_code == 0
assert "Block: 3 and above " in reorg_result.output and "Block Height is now: 8" in reorg_result.output
except AssertionError:
# if we get a timeout, we wait 5 seconds then check the block height
time.sleep(5)
reorg_fallback: Result = runner.invoke(cli, ["dev", "sim", "-n", simulator_name, "status"])
assert reorg_fallback.exit_code == 0
assert "Height: 8" in reorg_fallback.output
# check that height changed by 2
reorg_check: Result = runner.invoke(cli, ["dev", "sim", "-n", simulator_name, "status"])
assert reorg_check.exit_code == 0