Skip to content

Commit

Permalink
Merge pull request #960 from AntelopeIO/GH-955-prod-pause-test
Browse files Browse the repository at this point in the history
[1.0.3] Test: Fix flakey production_pause_max_rev_blks_test
  • Loading branch information
heifner authored Oct 23, 2024
2 parents 8d08494 + 58c3665 commit 84932fb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 7 additions & 0 deletions tests/TestHarness/Node.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,13 @@ def isLibAdvancing():
return self.getIrreversibleBlockNum() > currentLib
return Utils.waitForBool(isLibAdvancing, timeout)

def waitForLibNotToAdvance(self, timeout=30):
endTime=time.time()+timeout
while self.waitForLibToAdvance(timeout=timeout):
if time.time() > endTime:
return False
return True

def waitForProducer(self, producer, timeout=None, exitOnError=False):
if timeout is None:
# default to the typical configuration of 21 producers, each producing 12 blocks in a row (every 1/2 second)
Expand Down
7 changes: 3 additions & 4 deletions tests/production_pause_max_rev_blks_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,9 @@

# Verify LIB stalled on node0 and producerbNode due to finalizerNode was shutdown
Print("Verify LIB stalled after shutdown of finalizerbNode")
if producerbNode.waitForLibToAdvance(timeout=5): # LIB can advance for a few blocks first
assert not producerbNode.waitForLibToAdvance(timeout=5), "LIB should not advance on producerbNode after finalizerbNode was shutdown"
if node0.waitForLibToAdvance(timeout=5): # LIB can advance for a few blocks first
assert not node0.waitForLibToAdvance(timeout=5), "LIB should not advance on node0 after finalizerbNode was shutdown"
# LIB can advance for a few blocks first
assert producerbNode.waitForLibNotToAdvance(timeout=10), "LIB should not advance on producerbNode after finalizerbNode was shutdown"
assert node0.waitForLibNotToAdvance(timeout=10), "LIB should not advance on node0 after finalizerbNode was shutdown"

# Wait until enough reversible blocks are produced
node0.getInfo()
Expand Down

0 comments on commit 84932fb

Please sign in to comment.