Skip to content

Commit

Permalink
GH-1690 Changed waitForTransactionsInBlockRange to use a start/end in…
Browse files Browse the repository at this point in the history
…stead of start/offset. Pass in the start of empty blocks as the end of the range.
  • Loading branch information
heifner committed Oct 24, 2023
1 parent 82e2146 commit 339f542
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions tests/PerformanceHarness/performance_test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,12 +491,12 @@ def configureConnections():
completedRun = True

# Get stats after transaction generation stops
endBlock = self.waitForEmptyBlocks(self.validationNode, self.emptyBlockGoal)
trxSent = {}
scrapeTrxGenTrxSentDataLogs(trxSent, self.trxGenLogDirPath, self.ptbConfig.quiet)
if len(trxSent) != self.ptbConfig.expectedTransactionsSent:
print(f"ERROR: Transactions generated: {len(trxSent)} does not match the expected number of transactions: {self.ptbConfig.expectedTransactionsSent}")
blocksToWait = self.data.startBlock + (2 * self.ptbConfig.testTrxGenDurationSec) + 10
trxNotFound = self.validationNode.waitForTransactionsInBlockRange(trxSent, self.data.startBlock, blocksToWait)
trxNotFound = self.validationNode.waitForTransactionsInBlockRange(trxSent, self.data.startBlock, endBlock)
self.data.ceaseBlock = self.validationNode.getHeadBlockNum()

return PerformanceTestBasic.PtbTpsTestResult(completedRun=completedRun, numGeneratorsUsed=tpsTrxGensConfig.numGenerators,
Expand Down
9 changes: 4 additions & 5 deletions tests/TestHarness/Node.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,18 @@ def checkBlockForTransactions(self, transIds, blockNum):
transIds.pop(self.fetchTransactionFromTrace(trx))
return transIds

def waitForTransactionsInBlockRange(self, transIds, startBlock=2, maxFutureBlocks=0):
def waitForTransactionsInBlockRange(self, transIds, startBlock, endBlock):
nextBlockToProcess = startBlock
overallEndBlock = startBlock + maxFutureBlocks
while len(transIds) > 0:
currentLoopEndBlock = self.getHeadBlockNum()
if currentLoopEndBlock > overallEndBlock:
currentLoopEndBlock = overallEndBlock
if currentLoopEndBlock > endBlock:
currentLoopEndBlock = endBlock
for blockNum in range(nextBlockToProcess, currentLoopEndBlock + 1):
transIds = self.checkBlockForTransactions(transIds, blockNum)
if len(transIds) == 0:
return transIds
nextBlockToProcess = currentLoopEndBlock + 1
if currentLoopEndBlock == overallEndBlock:
if currentLoopEndBlock == endBlock:
Utils.Print("ERROR: Transactions were missing upon expiration of waitOnblockTransactions")
break
self.waitForHeadToAdvance()
Expand Down

0 comments on commit 339f542

Please sign in to comment.