Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.0] Test: Simplify disaster_recovery_2 test and verify correct LIB #618

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 7 additions & 16 deletions tests/disaster_recovery_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,30 +93,21 @@
assert node0.waitForLibToAdvance(), "Node0 did not advance LIB after snapshot"

Print("Pause production on Node0")
# loop until we have a lib advance after pause, pause may happen between blocks, need current block to be produced
retrys = 10
while retrys > 0:
lib = node0.getIrreversibleBlockNum()
node0.processUrllibRequest("producer", "pause")
# wait for lib because waitForBlock uses > not >=
if node0.waitForBlock(lib, blockType=BlockType.lib, timeout=10):
break
node0.processUrllibRequest("producer", "resume")
time.sleep(0.25)
retrys -= 1
assert retrys > 0, "Node0 did not advance LIB after pause"
time.sleep(1)
node0.processUrllibRequest("producer", "pause")
node0.waitForHeadToAdvance()
lib = node0.getIrreversibleBlockNum()
node0.waitForHeadToAdvance(timeout=3) # should time out

Print("Disconnect the producing node (Node0) from peer Node1")
node0.processUrllibRequest("net", "disconnect", "localhost:9877")
assert not node0.waitForLibToAdvance(timeout=10), "Node0 LIB still advancing after disconnect"
assert not node1.waitForHeadToAdvance(timeout=5), "Node1 head still advancing after disconnect"

Print("Resume production on Node0")
node0.processUrllibRequest("producer", "resume")
assert node0.waitForHeadToAdvance(blocksToAdvance=2)
assert node0.waitForIrreversibleBlock(lib) # lib, not lib+1 because waitForIrreversibleBlock uses >
libN = node0.getIrreversibleBlockNum()

assert not node1.waitForHeadToAdvance(timeout=5), "Node1 head still advancing after disconnect"
assert libN > lib

for node in [node1, node2, node3, node4]:
lib = node.getIrreversibleBlockNum()
Expand Down