Skip to content

Commit

Permalink
Make sure snapshot is taken duiring transition
Browse files Browse the repository at this point in the history
  • Loading branch information
linh2931 committed Apr 19, 2024
1 parent 2a42ea3 commit f890149
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions tests/snapshot_in_svnn_transition_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
errorExit=Utils.errorExit

appArgs = AppArgs()
args=TestHelper.parse_args({"-p","-d","-s","--keep-logs","--dump-error-details","-v","--leave-running","--unshared"},
args=TestHelper.parse_args({"-d","-s","--keep-logs","--dump-error-details","-v","--leave-running","--unshared"},
applicationSpecificArgs=appArgs)
pnodes=5 # Use 5 such that test does not take too long while has enough transition time
delay=args.d
Expand Down Expand Up @@ -71,17 +71,19 @@
snapshotNodeId = 0
nodeSnap=cluster.getNode(snapshotNodeId)

assert cluster.activateInstantFinality(biosFinalizer=False), "Activate instant finality failed"
# Active Savanna without waiting for activatation is finished so that we can take a
# snapshot during transition
success, transId = cluster.activateInstantFinality(biosFinalizer=False, waitForFinalization=False)
assert success, "Activate instant finality failed"

# Schedule snapshot at transition
info = cluster.biosNode.getInfo(exitOnError=True)
Print(f'head_block_num after setfinalizer: {info["head_block_num"]}')

Print("Create snapshot on snapshot node ")
ret = nodeSnap.createSnapshot()
assert ret is not None, "Snapshot creation failed"
ret_head_block_num = ret["payload"]["head_block_num"]
Print(f"Snapshot head block number {ret_head_block_num}")
snapshot_block_num = info["head_block_num"] + 1
Print(f'Schedule snapshot on snapshot node at block {snapshot_block_num}')
ret = nodeSnap.scheduleSnapshotAt(snapshot_block_num)
assert ret is not None, "Snapshot scheduling failed"

assert cluster.biosNode.waitForTransFinalization(transId, timeout=21*12*3), f'Failed to validate transaction {transId} got rolled into a LIB block on server port {cluster.biosNode.port}'
assert cluster.biosNode.waitForLibToAdvance(), "Lib should advance after instant finality activated"
assert cluster.biosNode.waitForProducer("defproducera"), "Did not see defproducera"
assert cluster.biosNode.waitForHeadToAdvance(blocksToAdvance=13), "Head did not advance 13 blocks to next producer"
Expand Down

0 comments on commit f890149

Please sign in to comment.