From f4de00b1e0eb6a3b9f113d6fe02f32f655a88df2 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Mon, 9 Oct 2023 11:37:58 -0500 Subject: [PATCH] GH-1501 Pass in exitOnError so that a retry is allowed --- tests/TestHarness/Node.py | 6 +++--- tests/TestHarness/queries.py | 4 ++-- tests/TestHarness/transactions.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/TestHarness/Node.py b/tests/TestHarness/Node.py index 888048d6dd..b529990b6f 100644 --- a/tests/TestHarness/Node.py +++ b/tests/TestHarness/Node.py @@ -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 @@ -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)) diff --git a/tests/TestHarness/queries.py b/tests/TestHarness/queries.py index aa28521476..d7b3695fd2 100644 --- a/tests/TestHarness/queries.py +++ b/tests/TestHarness/queries.py @@ -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): diff --git a/tests/TestHarness/transactions.py b/tests/TestHarness/transactions.py index b6d5d4a5c7..5950a8b42e 100644 --- a/tests/TestHarness/transactions.py +++ b/tests/TestHarness/transactions.py @@ -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