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

[3.1] plugin_http_api_test - fix timing issue #387

Merged
merged 2 commits into from
Jun 16, 2022
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
10 changes: 6 additions & 4 deletions tests/Node.py
Original file line number Diff line number Diff line change
Expand Up @@ -1388,10 +1388,12 @@ def getSupportedProtocolFeatureDict(self, excludeDisabled=False, excludeUnactiva
break
return protocolFeatureDigestDict

def waitForHeadToAdvance(self, timeout=6):
def waitForHeadToAdvance(self, blocksToAdvance=1, timeout=None):
currentHead = self.getHeadBlockNum()
if timeout is None:
timeout = 6 + blocksToAdvance / 2
def isHeadAdvancing():
return self.getHeadBlockNum() > currentHead
return self.getHeadBlockNum() >= currentHead + blocksToAdvance
return Utils.waitForBool(isHeadAdvancing, timeout)

def waitForLibToAdvance(self, timeout=30):
Expand Down Expand Up @@ -1422,7 +1424,7 @@ def activatePreactivateFeature(self):
self.scheduleProtocolFeatureActivations([preactivateFeatureDigest])

# Wait for the next block to be produced so the scheduled protocol feature is activated
assert self.waitForHeadToAdvance(), "ERROR: TIMEOUT WAITING FOR PREACTIVATE"
assert self.waitForHeadToAdvance(blocksToAdvance=2), print("ERROR: TIMEOUT WAITING FOR PREACTIVATE")

# Return an array of feature digests to be preactivated in a correct order respecting dependencies
# Require producer_api_plugin
Expand All @@ -1449,7 +1451,7 @@ def preactivateProtocolFeatures(self, featureDigests:list):
if trans is None or not trans[0]:
Utils.Print("ERROR: Failed to preactive digest {}".format(digest))
return None
self.waitForHeadToAdvance()
self.waitForHeadToAdvance(blocksToAdvance=2)

# Require PREACTIVATE_FEATURE to be activated and require eosio.bios with preactivate_feature
def preactivateAllBuiltinProtocolFeature(self):
Expand Down