Skip to content

Commit

Permalink
update test script
Browse files Browse the repository at this point in the history
  • Loading branch information
yarkinwho committed Feb 27, 2024
1 parent a58ca18 commit ad0ed62
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 36 deletions.
15 changes: 5 additions & 10 deletions tests/nodeos_eos_evm_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
sys.path.append(os.getcwd())
sys.path.append(os.path.join(os.getcwd(), "tests"))

from TestHarness import Cluster, TestHelper, Utils, WalletMgr
from TestHarness import Cluster, TestHelper, Utils, WalletMgr, createAccountKeys
from TestHarness.TestHelper import AppArgs
from TestHarness.testUtils import ReturnType
from TestHarness.core_symbol import CORE_SYMBOL
Expand Down Expand Up @@ -70,12 +70,11 @@
appArgs.add(flag="--read-endpoint", type=str, help="EVM read endpoint (eos-evm-rpc)", default="http://localhost:8881")
appArgs.add(flag="--use-eos-vm-oc", type=bool, help="EOS EVM Contract build dir", default=False)

args=TestHelper.parse_args({"--keep-logs","--dump-error-details","-v","--leave-running","--clean-run" }, applicationSpecificArgs=appArgs)
args=TestHelper.parse_args({"--keep-logs","--dump-error-details","-v","--leave-running" }, applicationSpecificArgs=appArgs)
debug=args.v
killEosInstances= not args.leave_running
dumpErrorDetails=args.dump_error_details
keepLogs=args.keep_logs
killAll=args.clean_run
eosEvmContractRoot=args.eos_evm_contract_root
eosEvmBridgeContractsRoot=args.eos_evm_bridge_contracts_root
gensisJson=args.genesis_json
Expand All @@ -94,18 +93,14 @@
testSuccessful=False

random.seed(seed) # Use a fixed seed for repeatability.
cluster=Cluster(walletd=True)
cluster=Cluster(keepRunning=args.leave_running, keepLogs=args.keep_logs)
walletMgr=WalletMgr(True)


try:
TestHelper.printSystemInfo("BEGIN")

cluster.setWalletMgr(walletMgr)
cluster.killall(allInstances=killAll)
cluster.cleanup()
walletMgr.killall(allInstances=killAll)
walletMgr.cleanup()

# *** setup topogrophy ***

Expand Down Expand Up @@ -146,7 +141,7 @@
if eosEvmBridgeContractsRoot:
total_accounts_to_create += 3

accounts=cluster.createAccountKeys(total_accounts_to_create)
accounts=createAccountKeys(total_accounts_to_create)
if accounts is None:
Utils.errorExit("FAILURE - create keys")

Expand Down Expand Up @@ -497,7 +492,7 @@ def forward_request(req):
app.run(host='0.0.0.0', port=5000)

finally:
TestHelper.shutdown(cluster, walletMgr, testSuccessful=testSuccessful, killEosInstances=killEosInstances, killWallet=killEosInstances, keepLogs=keepLogs, cleanRun=killAll, dumpErrorDetails=dumpErrorDetails)
TestHelper.shutdown(cluster, walletMgr, testSuccessful=testSuccessful, dumpErrorDetails=dumpErrorDetails)

exitCode = 0 if testSuccessful else 1
exit(exitCode)
4 changes: 2 additions & 2 deletions tests/nodeos_eos_evm_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
os.environ["CORE_SYMBOL_NAME"]='EOS'
print(f"CORE_SYMBOL_NAME: {os.environ.get('CORE_SYMBOL_NAME')}")

from TestHarness import Cluster, TestHelper, Utils, WalletMgr, CORE_SYMBOL
from TestHarness import Cluster, TestHelper, Utils, WalletMgr, CORE_SYMBOL, createAccountKeys
from TestHarness.TestHelper import AppArgs
from TestHarness.testUtils import ReturnType
from TestHarness.testUtils import unhandledEnumType
Expand Down Expand Up @@ -263,7 +263,7 @@ def makeReservedEvmAddress(account):
prodNode = cluster.getNode(0)
nonProdNode = cluster.getNode(1)

accounts=cluster.createAccountKeys(5)
accounts=createAccountKeys(5)
if accounts is None:
Utils.errorExit("FAILURE - create keys")

Expand Down
16 changes: 4 additions & 12 deletions tests/nodeos_eos_evm_ws_test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
os.environ["CORE_SYMBOL_NAME"]='EOS'
print(f"CORE_SYMBOL_NAME: {os.environ.get('CORE_SYMBOL_NAME')}")

from TestHarness import Cluster, TestHelper, Utils, WalletMgr, CORE_SYMBOL
from TestHarness import Cluster, TestHelper, Utils, WalletMgr, CORE_SYMBOL, createAccountKeys
from TestHarness.TestHelper import AppArgs
from TestHarness.testUtils import ReturnType
from TestHarness.testUtils import unhandledEnumType
Expand Down Expand Up @@ -61,12 +61,11 @@
appArgs.add(flag="--eos-evm-build-root", type=str, help="EOS EVM build dir", default=None)
appArgs.add(flag="--genesis-json", type=str, help="File to save generated genesis json", default="eos-evm-genesis.json")

args=TestHelper.parse_args({"--keep-logs","--dump-error-details","-v","--leave-running","--clean-run" }, applicationSpecificArgs=appArgs)
args=TestHelper.parse_args({"--keep-logs","--dump-error-details","-v","--leave-running" }, applicationSpecificArgs=appArgs)
debug=args.v
killEosInstances= not args.leave_running
dumpErrorDetails=args.dump_error_details
keepLogs=args.keep_logs
killAll=False # args.clean_run
eosEvmContractRoot=args.eos_evm_contract_root
eosEvmBuildRoot=args.eos_evm_build_root
genesisJson=args.genesis_json
Expand All @@ -80,7 +79,7 @@
testSuccessful=False

random.seed(seed) # Use a fixed seed for repeatability.
cluster=Cluster(walletd=True)
cluster=Cluster(keepRunning=args.leave_running, keepLogs=args.keep_logs)
walletMgr=WalletMgr(True)

pnodes=1
Expand Down Expand Up @@ -216,13 +215,6 @@ def makeReservedEvmAddress(account):

cluster.setWalletMgr(walletMgr)

cluster.killall(allInstances=killAll)
# cluster.killSomeEosInstances(killCount=999) # used for main branch of leap
cluster.cleanup()
walletMgr.killall(allInstances=killAll) # leap 4.0?
# walletMgr.shutdown() # used for main branch of leap
walletMgr.cleanup()

specificExtraNodeosArgs={}
shipNodeNum = total_nodes - 1
specificExtraNodeosArgs[shipNodeNum]="--plugin eosio::state_history_plugin --state-history-endpoint 127.0.0.1:8999 --trace-history --chain-state-history --disable-replay-opts "
Expand All @@ -242,7 +234,7 @@ def makeReservedEvmAddress(account):
prodNode = cluster.getNode(0)
nonProdNode = cluster.getNode(1)

accounts=cluster.createAccountKeys(3)
accounts=createAccountKeys(3)
if accounts is None:
Utils.errorExit("FAILURE - create keys")

Expand Down
16 changes: 4 additions & 12 deletions tests/nodeos_eos_evm_ws_test_fork.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
os.environ["CORE_SYMBOL_NAME"]='EOS'
print(f"CORE_SYMBOL_NAME: {os.environ.get('CORE_SYMBOL_NAME')}")

from TestHarness import Cluster, TestHelper, Utils, WalletMgr, CORE_SYMBOL
from TestHarness import Cluster, TestHelper, Utils, WalletMgr, CORE_SYMBOL, createAccountKeys
from TestHarness.TestHelper import AppArgs
from TestHarness.testUtils import ReturnType
from TestHarness.testUtils import unhandledEnumType
Expand Down Expand Up @@ -150,12 +150,11 @@ def getMinHeadAndLib(prodNodes):
appArgs.add(flag="--eos-evm-build-root", type=str, help="EOS EVM build dir", default=None)
appArgs.add(flag="--genesis-json", type=str, help="File to save generated genesis json", default="eos-evm-genesis.json")

args=TestHelper.parse_args({"--keep-logs","--dump-error-details","-v","--leave-running","--clean-run" }, applicationSpecificArgs=appArgs)
args=TestHelper.parse_args({"--keep-logs","--dump-error-details","-v","--leave-running" }, applicationSpecificArgs=appArgs)
debug=args.v
killEosInstances= not args.leave_running
dumpErrorDetails=args.dump_error_details
keepLogs=args.keep_logs
killAll=False # args.clean_run
eosEvmContractRoot=args.eos_evm_contract_root
eosEvmBuildRoot=args.eos_evm_build_root
genesisJson=args.genesis_json
Expand All @@ -175,7 +174,7 @@ def getMinHeadAndLib(prodNodes):
testSuccessful=False

random.seed(seed) # Use a fixed seed for repeatability.
cluster=Cluster(walletd=True)
cluster=Cluster(keepRunning=args.leave_running, keepLogs=args.keep_logs)
walletMgr=WalletMgr(True)

evmNodePOpen = None
Expand Down Expand Up @@ -309,13 +308,6 @@ def makeReservedEvmAddress(account):

cluster.setWalletMgr(walletMgr)

cluster.killall(allInstances=killAll)
# cluster.killSomeEosInstances(killCount=999) # used for main branch of leap
cluster.cleanup()
walletMgr.killall(allInstances=killAll) # leap 4.0?
# walletMgr.shutdown() # used for main branch of leap
walletMgr.cleanup()

specificExtraNodeosArgs={}
shipNodeNum = 0
specificExtraNodeosArgs[shipNodeNum]="--plugin eosio::state_history_plugin --state-history-endpoint 127.0.0.1:8999 --trace-history --chain-state-history --disable-replay-opts "
Expand Down Expand Up @@ -363,7 +355,7 @@ def makeReservedEvmAddress(account):
cluster.waitOnClusterSync(blockAdvancing=5)
cluster.biosNode.kill(signal.SIGTERM)

accounts=cluster.createAccountKeys(3)
accounts=createAccountKeys(3)
if accounts is None:
Utils.errorExit("FAILURE - create keys")

Expand Down

0 comments on commit ad0ed62

Please sign in to comment.