forked from EOSIO/eos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test to ensure catchup lockup does not occur. GH EOSIO#6727
- Loading branch information
1 parent
3089f70
commit 0532e5c
Showing
1 changed file
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from testUtils import Utils | ||
import testUtils | ||
import time | ||
from Cluster import Cluster | ||
from WalletMgr import WalletMgr | ||
from Node import Node | ||
from TestHelper import AppArgs | ||
from TestHelper import TestHelper | ||
|
||
import decimal | ||
import math | ||
import re | ||
|
||
############################################################### | ||
# nodeos_startup_catchup | ||
# Test configures a producing node and <--txn-plugins count> non-producing nodes with the | ||
# txn_test_gen_plugin. Each non-producing node starts generating transactions and sending them | ||
# to the producing node. | ||
# 1) After 10 seconds a new node is started. | ||
# 2) 10 seconds later, that node is checked to see if it has caught up to the producing node and | ||
# that node is killed and a new node is started. | ||
# 3) Repeat step 2, <--catchup-count - 1> more times | ||
############################################################### | ||
|
||
Print=Utils.Print | ||
errorExit=Utils.errorExit | ||
|
||
from core_symbol import CORE_SYMBOL | ||
|
||
appArgs=AppArgs() | ||
extraArgs = appArgs.add(flag="--catchup-count", type=int, help="How many catchup-nodes to launch", default=10) | ||
extraArgs = appArgs.add(flag="--txn-gen-nodes", type=int, help="How many transaction generator nodes", default=4) | ||
args = TestHelper.parse_args({"--prod-count","--dump-error-details","--keep-logs","-v","--leave-running","--clean-run", | ||
"-p","--p2p-plugin","--wallet-port"}, applicationSpecificArgs=appArgs) | ||
Utils.Debug=args.v | ||
pnodes=args.p if args.p > 0 else 1 | ||
startedNonProdNodes = args.txn_gen_nodes if args.txn_gen_nodes >= 2 else 2 | ||
cluster=Cluster(walletd=True) | ||
dumpErrorDetails=args.dump_error_details | ||
keepLogs=args.keep_logs | ||
dontKill=args.leave_running | ||
prodCount=args.prod_count if args.prod_count > 1 else 2 | ||
killAll=args.clean_run | ||
p2pPlugin=args.p2p_plugin | ||
walletPort=args.wallet_port | ||
catchupCount=args.catchup_count | ||
totalNodes=startedNonProdNodes+pnodes+catchupCount | ||
|
||
walletMgr=WalletMgr(True, port=walletPort) | ||
testSuccessful=False | ||
killEosInstances=not dontKill | ||
killWallet=not dontKill | ||
|
||
WalletdName=Utils.EosWalletName | ||
ClientName="cleos" | ||
|
||
try: | ||
TestHelper.printSystemInfo("BEGIN") | ||
cluster.setWalletMgr(walletMgr) | ||
|
||
cluster.killall(allInstances=killAll) | ||
cluster.cleanup() | ||
specificExtraNodeosArgs={} | ||
txnGenNodeNum=pnodes # next node after producer nodes | ||
for nodeNum in range(txnGenNodeNum, txnGenNodeNum+startedNonProdNodes): | ||
specificExtraNodeosArgs[nodeNum]="--plugin eosio::txn_test_gen_plugin --txn-test-gen-account-prefix txntestacct" | ||
Print("Stand up cluster") | ||
if cluster.launch(prodCount=prodCount, onlyBios=False, pnodes=pnodes, totalNodes=totalNodes, totalProducers=pnodes*prodCount, p2pPlugin=p2pPlugin, | ||
useBiosBootFile=False, specificExtraNodeosArgs=specificExtraNodeosArgs, unstartedNodes=catchupCount, loadSystemContract=False) is False: | ||
Utils.cmdError("launcher") | ||
Utils.errorExit("Failed to stand up eos cluster.") | ||
|
||
Print("Validating system accounts after bootstrap") | ||
cluster.validateAccounts(None) | ||
|
||
txnGenNodes=[] | ||
for nodeNum in range(txnGenNodeNum, txnGenNodeNum+startedNonProdNodes): | ||
txnGenNodes.append(cluster.getNode(nodeNum)) | ||
|
||
txnGenNodes[0].txnGenCreateTestAccounts(cluster.eosioAccount.name, cluster.eosioAccount.activePrivateKey) | ||
time.sleep(20) | ||
|
||
for genNum in range(0, len(txnGenNodes)): | ||
salt="%d" % genNum | ||
txnGenNodes[genNum].txnGenStart(salt, 1000, 200) | ||
|
||
time.sleep(10) | ||
|
||
|
||
testSuccessful=True | ||
|
||
finally: | ||
TestHelper.shutdown(cluster, walletMgr, testSuccessful=testSuccessful, killEosInstances=killEosInstances, killWallet=killWallet, keepLogs=keepLogs, cleanRun=killAll, dumpErrorDetails=dumpErrorDetails) | ||
|
||
exit(0) |