Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

plugin_http_api_test - fix timing issue #10103

Merged
merged 1 commit into from
Mar 3, 2021
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 @@ -1410,10 +1410,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.waitForTruth(isHeadAdvancing, timeout)

def waitForLibToAdvance(self, timeout=30):
Expand All @@ -1431,7 +1433,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(), print("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 @@ -1458,7 +1460,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