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

[5.0 -> main] Test: Pass in exitOnError so that a retry is allowed #1740

Merged
merged 3 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions tests/TestHarness/Node.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ def validateAccounts(self, accounts):
Utils.Print("account validation failed. account: %s" % (account.name))
raise

def waitForTransactionInBlock(self, transId, timeout=None):
def waitForTransactionInBlock(self, transId, timeout=None, exitOnError=True):
"""Wait for trans id to appear in a block."""
assert(isinstance(transId, str))
lam = lambda: self.isTransInAnyBlock(transId)
lam = lambda: self.isTransInAnyBlock(transId, exitOnError=exitOnError)
ret=Utils.waitForBool(lam, timeout)
return ret

Expand Down Expand Up @@ -226,7 +226,7 @@ def waitForTransBlockIfNeeded(self, trans, waitForTransBlock, exitOnError=False)
if not waitForTransBlock:
return trans
transId=NodeosQueries.getTransId(trans)
if not self.waitForTransactionInBlock(transId):
if not self.waitForTransactionInBlock(transId, exitOnError=exitOnError):
if exitOnError:
Utils.cmdError("transaction with id %s never made it into a block" % (transId))
Utils.errorExit("Failed to find transaction with id %s in a block before timeout" % (transId))
Expand Down
4 changes: 2 additions & 2 deletions tests/TestHarness/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,11 @@ def getBlockNumByTransId(self, transId, exitOnError=True, delayedRetry=True, blo

return None

def isTransInAnyBlock(self, transId: str):
def isTransInAnyBlock(self, transId: str, exitOnError=True):
"""Check if transaction (transId) is in a block."""
assert(transId)
assert(isinstance(transId, str))
blockId=self.getBlockNumByTransId(transId)
blockId=self.getBlockNumByTransId(transId, exitOnError=exitOnError)
return True if blockId else False

def isTransFinalized(self, transId):
Expand Down
2 changes: 1 addition & 1 deletion tests/TestHarness/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def publishContract(self, account, contractDir, wasmFile, abiFile, waitForTransB
if not waitForTransBlock:
return trans
transId=NodeosQueries.getTransId(trans)
if self.waitForTransactionInBlock(transId, timeout=5):
if self.waitForTransactionInBlock(transId, timeout=5, exitOnError=False):
break

return trans
Expand Down