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

Commit

Permalink
Merge pull request #6580 from brianjohnson5972/fork-test-debug
Browse files Browse the repository at this point in the history
Long running test fixes and better error reporting
  • Loading branch information
b1bart authored Jan 15, 2019
2 parents 4414293 + 13473d8 commit 013e8dd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions tests/nodeos_forked_chain_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def analyzeBPs(bps0, bps1, expectDivergence):
if errorInDivergence:
msg="Failed analyzing block producers - "
if expectDivergence:
msg+="nodes indicate different block producers for the same blocks, but did not expect them to diverge."
msg+="nodes do not indicate different block producers for the same blocks, but they are expected to diverge at some point."
else:
msg+="did not expect nodes to indicate different block producers for the same blocks."
msg+="\n Matching Blocks= %s \n Diverging branch node0= %s \n Diverging branch node1= %s" % (bpsStr,bpsStr0,bpsStr1)
Expand Down Expand Up @@ -314,7 +314,7 @@ def getMinHeadAndLib(prodNodes):
blockProducers1=[]
libs0=[]
libs1=[]
lastBlockNum=max([preKillBlockNum,postKillBlockNum])+maxActiveProducers*inRowCountPerProducer
lastBlockNum=max([preKillBlockNum,postKillBlockNum])+2*maxActiveProducers*inRowCountPerProducer
actualLastBlockNum=None
prodChanged=False
nextProdChange=False
Expand Down Expand Up @@ -348,8 +348,12 @@ def getMinHeadAndLib(prodNodes):
if blockProducer0!=blockProducer1:
Utils.errorExit("Groups reported different block producers for block number %d. %s != %s." % (blockNum,blockProducer0,blockProducer1))

#verify that the non producing node is not alive (and populate the producer nodes with current getInfo data to report if
#an error occurs)
if nonProdNode.verifyAlive():
Utils.errorExit("Expected the non-producing node to have shutdown.")

# *** Analyze the producers leading up to the block after killing the non-producing node ***
Print("Analyzing the producers leading up to the block after killing the non-producing node")

firstDivergence=analyzeBPs(blockProducers0, blockProducers1, expectDivergence=True)
# Nodes should not have diverged till the last block
Expand All @@ -358,15 +362,11 @@ def getMinHeadAndLib(prodNodes):
blockProducers0=[]
blockProducers1=[]

#verify that the non producing node is not alive (and populate the producer nodes with current getInfo data to report if
#an error occurs)
if nonProdNode.verifyAlive():
Utils.errorExit("Expected the non-producing node to have shutdown.")
for prodNode in prodNodes:
prodNode.getInfo()


# *** Track the blocks from the divergence till there are 10*12 blocks on one chain and 10*12+1 on the other ***
Print("Tracking the blocks from the divergence till there are 10*12 blocks on one chain and 10*12+1 on the other")

killBlockNum=blockNum
lastBlockNum=killBlockNum+(maxActiveProducers - 1)*inRowCountPerProducer+1 # allow 1st testnet group to produce just 1 more block than the 2nd
Expand All @@ -377,7 +377,7 @@ def getMinHeadAndLib(prodNodes):
blockProducers1.append({"blockNum":blockNum, "prod":blockProducer1})


# *** Analyze the producers from the divergence to the lastBlockNum and verify they stay diverged ***
Print("Analyzing the producers from the divergence to the lastBlockNum and verify they stay diverged")

firstDivergence=analyzeBPs(blockProducers0, blockProducers1, expectDivergence=True)
if firstDivergence!=killBlockNum:
Expand All @@ -386,13 +386,13 @@ def getMinHeadAndLib(prodNodes):
blockProducers1=[]


# *** Relaunch the non-producing bridge node to connect the producing nodes again ***
Print("Relaunching the non-producing bridge node to connect the producing nodes again")

if not nonProdNode.relaunch(nonProdNode.nodeNum, None):
errorExit("Failure - (non-production) node %d should have restarted" % (nonProdNode.nodeNum))


# *** Identify the producers from the saved LIB to the current highest head ***
Print("Identifying the producers from the saved LIB to the current highest head")

#ensure that the nodes have enough time to get in concensus, so wait for 3 producers to produce their complete round
time.sleep(inRowCountPerProducer * 3 / 2)
Expand All @@ -407,7 +407,7 @@ def getMinHeadAndLib(prodNodes):
blockProducers1.append({"blockNum":blockNum, "prod":blockProducer1})


# *** Analyze the producers from the saved LIB to the current highest head and verify they match now ***
Print("Analyzing the producers from the saved LIB to the current highest head and verify they match now")

analyzeBPs(blockProducers0, blockProducers1, expectDivergence=False)

Expand Down
2 changes: 1 addition & 1 deletion tests/nodeos_under_min_avail_ram.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def setName(self, num):
nodes[0].transferFunds(cluster.eosioAccount, contractAccount, transferAmount, "test transfer")
trans=nodes[0].delegatebw(contractAccount, 1000000.0000, 88000000.0000, waitForTransBlock=True, exitOnError=True)

contractDir="test-contracts/integration_test"
contractDir="unittests/test-contracts/integration_test"
wasmFile="integration_test.wasm"
abiFile="integration_test.abi"
Print("Publish contract")
Expand Down

0 comments on commit 013e8dd

Please sign in to comment.