Example #1
0
# --kill-sig <kill signal [term|kill]>
# --kill-count <nodeos instances to kill>
# --dont-kill <Leave cluster running after test finishes>
# --dump-error-details <Upon error print etc/eosio/node_*/config.ini and var/lib/node_*/stderr.log to stdout>
# --keep-logs <Don't delete var/lib/node_* folders upon test completion>
###############################################################


Print=testUtils.Utils.Print

def errorExit(msg="", errorCode=1):
    Print("ERROR:", msg)
    traceback.print_stack(limit=-1)
    exit(errorCode)

args=TestHelper.parse_args({"-p","-d","-s","-c","--kill-sig","--kill-count","--keep-logs","--p2p-plugin"
                            ,"--dump-error-details","-v","--leave-running","--clean-run"})
pnodes=args.p
topo=args.s
delay=args.d
chainSyncStrategyStr=args.c
debug=args.v
total_nodes = pnodes
killCount=args.kill_count if args.kill_count > 0 else 1
killSignal=args.kill_sig
killEosInstances= not args.leave_running
dumpErrorDetails=args.dump_error_details
keepLogs=args.keep_logs
killAll=args.clean_run
p2pPlugin=args.p2p_plugin

seed=1
#!/usr/bin/env python3

from testUtils import Utils
from Cluster import Cluster
from WalletMgr import WalletMgr
from TestHelper import TestHelper

import random

Print=Utils.Print

def errorExit(msg="", errorCode=1):
    Print("ERROR:", msg)
    exit(errorCode)

args=TestHelper.parse_args({"-p","-n","-d","-s","--nodes-file","--seed"
                              ,"--dump-error-details","-v","--leave-running","--clean-run"})

pnodes=args.p
topo=args.s
delay=args.d
total_nodes = pnodes if args.n == 0 else args.n
debug=args.v
nodesFile=args.nodes_file
seed=args.seed
dontKill=args.leave_running
dumpErrorDetails=args.dump_error_details
killAll=args.clean_run

killWallet=not dontKill
killEosInstances=not dontKill
if nodesFile is not None:
Example #3
0
import random
import subprocess
import signal

###############################################################
# Test for validating the dirty db flag sticks repeated nodeos restart attempts
###############################################################


Print=Utils.Print

def errorExit(msg="", errorCode=1):
    Print("ERROR:", msg)
    exit(errorCode)

args = TestHelper.parse_args({"--keep-logs","--dump-error-details","-v","--leave-running","--clean-run"})
debug=args.v
pnodes=1
topo="mesh"
delay=1
chainSyncStrategyStr=Utils.SyncResyncTag
total_nodes = pnodes
killCount=1
killSignal=Utils.SigKillTag

killEosInstances= not args.leave_running
dumpErrorDetails=args.dump_error_details
keepLogs=args.keep_logs
killAll=args.clean_run

seed=1
Example #4
0
import decimal
import re

###############################################################
# nodroxe_run_test
# --dump-error-details <Upon error print etc/roxe/node_*/config.ini and var/lib/node_*/stderr.log to stdout>
# --keep-logs <Don't delete var/lib/node_* folders upon test completion>
###############################################################

Print=Utils.Print
errorExit=Utils.errorExit
cmdError=Utils.cmdError
from core_symbol import CORE_SYMBOL

args = TestHelper.parse_args({"--defproducera_prvt_key","--dump-error-details","--dont-launch","--keep-logs",
                              "-v","--leave-running","--clean-run"})
debug=args.v
defproduceraPrvtKey=args.defproducera_prvt_key
dumpErrorDetails=args.dump_error_details
keepLogs=args.keep_logs
dontLaunch=args.dont_launch
dontKill=args.leave_running
killAll=args.clean_run

Utils.Debug=debug
cluster=Cluster(walletd=True, defproduceraPrvtKey=defproduceraPrvtKey)
walletMgr=WalletMgr(True)
testSuccessful=False
killRoxeInstances=not dontKill
killWallet=not dontKill
Example #5
0
import subprocess

###############################################################
# nodeos_run_remote_test
#  Tests remote capability of the nodeos_run_test. Test will setup cluster and pass nodes info to nodeos_run_test. E.g.
#  nodeos_run_remote_test.py -v --clean-run --dump-error-detail
###############################################################

Print=Utils.Print

def errorExit(msg="", errorCode=1):
    Print("ERROR:", msg)
    exit(errorCode)

args = TestHelper.parse_args({"--dump-error-details","-v","--leave-running","--only-bios","--clean-run"})
debug=args.v
dontKill=args.leave_running
dumpErrorDetails=args.dump_error_details
onlyBios=args.only_bios
killAll=args.clean_run

Utils.Debug=debug

killEosInstances=not dontKill
topo="mesh"
delay=1
prodCount=1 # producers per producer node
pnodes=1
total_nodes=pnodes
actualTest="tests/nodeos_run_test.py"
Example #6
0
import subprocess
import tempfile
import os

###############################################################
# distributed-transactions-remote-test
#
#  Tests remote capability of the distributed-transactions-test. Test will setup cluster and pass nodes info to distributed-transactions-test. E.g.
#  distributed-transactions-remote-test.py -v --clean-run --dump-error-detail
#
###############################################################

Print = Utils.Print
errorExit = Utils.errorExit

args = TestHelper.parse_args(
    {"-p", "--dump-error-details", "-v", "--leave-running", "--clean-run"})
pnodes = args.p
debug = args.v
dontKill = args.leave_running
dumpErrorDetails = args.dump_error_details
killAll = args.clean_run

Utils.Debug = debug

killInstances = not dontKill
topo = "mesh"
delay = 1
prodCount = 1  # producers per producer node
total_nodes = pnodes + 3
actualTest = "tests/distributed-transactions-test.py"
testSuccessful = False
Example #7
0
    if len(prodsSeenKeys) != 21:
        Utils.cmdError(
            "only saw %s producers of expected 21. At blockNum %s only the following producers were seen: %s"
            % (len(prodsSeenKeys), blockNum, ",".join(prodsSeenKeys)))
        Utils.errorExit("Failed because of missing block producers")

    Utils.Debug = temp


Print = Utils.Print
errorExit = Utils.errorExit

from core_symbol import CORE_SYMBOL

args = TestHelper.parse_args({
    "--prod-count", "--dump-error-details", "--keep-logs", "-v",
    "--leave-running", "--clean-run", "--p2p-plugin", "--wallet-port"
})
Utils.Debug = args.v
totalNodes = 4
cluster = Cluster(walletd=True)
dumpErrorDetails = args.dump_error_details
keepLogs = args.keep_logs
dontKill = args.leave_running
prodCount = args.prod_count
killAll = args.clean_run
p2pPlugin = args.p2p_plugin
walletPort = args.wallet_port

walletMgr = WalletMgr(True, port=walletPort)
testSuccessful = False
killdccInstances = not dontKill
# -c <chain strategy[replay|resync|none]>
# -s <topology>
# -d <delay between nodes startup>
# -v <verbose logging>
# --kill-sig <kill signal [term|kill]>
# --kill-count <nodeos instances to kill>
# --dont-kill <Leave cluster running after test finishes>
# --dump-error-details <Upon error print etc/eosio/node_*/config.ini and var/lib/node_*/stderr.log to stdout>
# --keep-logs <Don't delete var/lib/node_* folders upon test completion>
###############################################################


Print=Utils.Print
errorExit=Utils.errorExit

args=TestHelper.parse_args({"-p","-d","-s","-c","--kill-sig","--kill-count","--keep-logs","--p2p-plugin"
                            ,"--dump-error-details","-v","--leave-running","--clean-run"})
pnodes=args.p
topo=args.s
delay=args.d
chainSyncStrategyStr=args.c
debug=args.v
total_nodes = pnodes
killCount=args.kill_count if args.kill_count > 0 else 1
killSignal=args.kill_sig
killEosInstances= not args.leave_running
dumpErrorDetails=args.dump_error_details
keepLogs=args.keep_logs
killAll=args.clean_run
p2pPlugin=args.p2p_plugin

seed=1
#!/usr/bin/env python3

from testUtils import Utils
from Cluster import Cluster
from WalletMgr import WalletMgr
from TestHelper import TestHelper

import random

Print=Utils.Print
errorExit=Utils.errorExit

args=TestHelper.parse_args({"-p","-n","-d","-s","--nodes-file","--seed"
                           ,"--dump-error-details","-v","--leave-running","--clean-run","--keep-logs"})

pnodes=args.p
topo=args.s
delay=args.d
total_nodes = pnodes if args.n < pnodes else args.n
debug=args.v
nodesFile=args.nodes_file
dontLaunch=nodesFile is not None
seed=args.seed
dontKill=args.leave_running
dumpErrorDetails=args.dump_error_details
killAll=args.clean_run
keepLogs=args.keep_logs

killWallet=not dontKill
killLtnInstances=not dontKill
if nodesFile is not None:
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=2)
args = TestHelper.parse_args(
    {
        "--prod-count", "--dump-error-details", "--keep-logs", "-v",
        "--leave-running", "--clean-run", "-p", "--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
walletPort = args.wallet_port
catchupCount = args.catchup_count if args.catchup_count > 0 else 1
totalNodes = startedNonProdNodes + pnodes + catchupCount
Example #11
0
import time

###############################################################
# prod_preactivation_test
# --dump-error-details <Upon error print etc/vectrum/node_*/config.ini and var/lib/node_*/stderr.log to stdout>
# --keep-logs <Don't delete var/lib/node_* folders upon test completion>
###############################################################

Print = Utils.Print
errorExit = Utils.errorExit
cmdError = Utils.cmdError
from core_symbol import CORE_SYMBOL

args = TestHelper.parse_args({
    "--host", "--port", "--defproducera_prvt_key", "--defproducerb_prvt_key",
    "--mongodb", "--dump-error-details", "--dont-launch", "--keep-logs", "-v",
    "--leave-running", "--only-bios", "--clean-run", "--sanity-test",
    "--wallet-port"
})
server = args.host
port = args.port
debug = args.v
enableMongo = args.mongodb
defproduceraPrvtKey = args.defproducera_prvt_key
defproducerbPrvtKey = args.defproducerb_prvt_key
dumpErrorDetails = args.dump_error_details
keepLogs = args.keep_logs
dontLaunch = args.dont_launch
dontKill = args.leave_running
prodCount = 2
onlyBios = args.only_bios
killAll = args.clean_run
Example #12
0
import json
import time
import os
from os.path import join, exists
from datetime import datetime

###############################################################
# nodeos_multiple_version_protocol_feature_test
#
# Test for verifying that older versions of nodeos can work with newer versions of nodeos.
#
###############################################################

# Parse command line arguments
args = TestHelper.parse_args({
    "-v", "--clean-run", "--dump-error-details", "--leave-running",
    "--keep-logs", "--alternate-version-labels-file"
})
Utils.Debug = args.v
killAll = args.clean_run
dumpErrorDetails = args.dump_error_details
dontKill = args.leave_running
killEosInstances = not dontKill
killWallet = not dontKill
keepLogs = args.keep_logs
alternateVersionLabelsFile = args.alternate_version_labels_file

walletMgr = WalletMgr(True)
cluster = Cluster(walletd=True)
cluster.setWalletMgr(walletMgr)

Example #13
0
    if len(prodsSeenKeys) != 21:
        Utils.cmdError(
            "only saw %s producers of expected 21. At blockNum %s only the following producers were seen: %s"
            % (len(prodsSeenKeys), blockNum, ",".join(prodsSeenKeys)))
        errorExit("Failed because of missing block producers")

    Utils.Debug = temp


Print = Utils.Print
errorExit = Utils.errorExit

from core_symbol import CORE_SYMBOL

args = TestHelper.parse_args({
    "--prod-count", "--dump-error-details", "--keep-logs", "-v",
    "--leave-running", "--clean-run"
})
Utils.Debug = args.v
totalNodes = 4
cluster = Cluster(walletd=True)
dumpErrorDetails = args.dump_error_details
keepLogs = args.keep_logs
dontKill = args.leave_running
prodCount = args.prod_count
killAll = args.clean_run

walletMgr = WalletMgr(True)
testSuccessful = False
killEosInstances = not dontKill
killWallet = not dontKill
Example #14
0
###############################################################

Print=Utils.Print
errorExit=Utils.errorExit

from core_symbol import CORE_SYMBOL

def cmdError(name, cmdCode=0, exitNow=False):
    msg="FAILURE - %s%s" % (name, ("" if cmdCode == 0 else (" returned error code %d" % cmdCode)))
    if exitNow:
        errorExit(msg, True)
    else:
        Print(msg)

args = TestHelper.parse_args({"--host","--port","--prod-count","--defproducera_prvt_key","--defproducerb_prvt_key","--mongodb"
                              ,"--dump-error-details","--dont-launch","--keep-logs","-v","--leave-running","--only-bios","--clean-run"
                              ,"--sanity-test"})
server=args.host
port=args.port
debug=args.v
enableMongo=args.mongodb
defproduceraPrvtKey=args.defproducera_prvt_key
defproducerbPrvtKey=args.defproducerb_prvt_key
dumpErrorDetails=args.dump_error_details
keepLogs=args.keep_logs
dontLaunch=args.dont_launch
dontKill=args.leave_running
prodCount=args.prod_count
onlyBios=args.only_bios
killAll=args.clean_run
sanityTest=args.sanity_test
Example #15
0
import signal

###############################################################
# nodeos_contrl_c_lr_test
#
# This test sets up one producing nodes and one "bridge" node using test_control_api_plugin. We send
# transactions to the bridge node. After the accounts are initialized and allocated with symbols, we
# kill the producing node. Then we flood hundreds transactions to the bridge node. At the end, we
# kill the bridge. It tests that no crashes happen when the nodes are killed.
#
###############################################################

errorExit = Utils.errorExit

args = TestHelper.parse_args({"--wallet-port", "-v"})

cluster = Cluster(walletd=True)
killAll = True
totalProducerNodes = 1
totalNonProducerNodes = 1
totalNodes = totalProducerNodes + totalNonProducerNodes
walletPort = args.wallet_port
walletMgr = WalletMgr(True, port=walletPort)
producerEndpoint = '127.0.0.1:8888'
httpServerAddress = '127.0.0.1:8889'

try:
    TestHelper.printSystemInfo("BEGIN")
    cluster.setWalletMgr(walletMgr)
    cluster.killall(allInstances=killAll)
Example #16
0
from Node import Node
from Node import ReturnType
from TestHelper import TestHelper

###############################################################
# http_plugin_tests.py
#
# Integration tests for HTTP plugin
#
###############################################################

Print = Utils.Print
errorExit = Utils.errorExit
cmdError = Utils.cmdError

args = TestHelper.parse_args(
    {"-v", "--clean-run", "--dump-error-details", "--keep-logs"})
debug = args.v
killAll = args.clean_run
killEosInstances = True
keepLogs = args.keep_logs
dumpErrorDetails = dumpErrorDetails = args.dump_error_details

Utils.Debug = debug
https_port = 5555
cluster = Cluster(walletd=True)

testSuccessful = False

ClientName = "cleos"
timeout = .5 * 12 * 2 + 60  # time for finalization with 1 producer + 60 seconds padding
Utils.setIrreversibleTimeout(timeout)