Skip to content

Commit

Permalink
Merge pull request AntelopeIO#1740 from AntelopeIO/AntelopeIOGH-1501-…
Browse files Browse the repository at this point in the history
…retry-retry-main

[5.0 -> main] Test: Pass in exitOnError so that a retry is allowed
  • Loading branch information
heifner authored Oct 10, 2023
2 parents 6bd77ce + ca109d6 commit 3470458
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
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

0 comments on commit 3470458

Please sign in to comment.