提交 0c5c9e5d 编写于 作者: B Brian Johnson

Added code to allow setting wallet port for some tests. GH #5674

上级 fd6d31a7
......@@ -26,6 +26,7 @@ class AppArgs:
class TestHelper(object):
LOCAL_HOST="localhost"
DEFAULT_PORT=8888
DEFAULT_WALLET_PORT=9899
@staticmethod
# pylint: disable=too-many-branches
......@@ -70,6 +71,12 @@ class TestHelper(object):
if "--port" in includeArgs:
parser.add_argument("-p", "--port", type=int, help="%s host port" % Utils.EosServerName,
default=TestHelper.DEFAULT_PORT)
if "--wallet-host" in includeArgs:
parser.add_argument("--wallet-host", type=str, help="%s host" % Utils.EosWalletName,
default=TestHelper.LOCAL_HOST)
if "--wallet-port" in includeArgs:
parser.add_argument("--wallet-port", type=int, help="%s port" % Utils.EosWalletName,
default=TestHelper.DEFAULT_WALLET_PORT)
if "--prod-count" in includeArgs:
parser.add_argument("-c", "--prod-count", type=int, help="Per node producer count", default=1)
if "--defproducera_prvt_key" in includeArgs:
......
......@@ -65,16 +65,12 @@ class WalletMgr(object):
if self.isLocal():
self.port=self.findAvailablePort()
pgrepCmd=Utils.pgrepCmd(Utils.EosWalletName)
if Utils.Debug:
portStatus="N/A"
portTaken=False
if self.isLocal():
if Utils.arePortsAvailable(self.port):
portStatus="AVAILABLE"
else:
portStatus="NOT AVAILABLE"
if not Utils.arePortsAvailable(self.port):
portTaken=True
pgrepCmd=Utils.pgrepCmd(Utils.EosWalletName)
psOut=Utils.checkOutput(pgrepCmd.split(), ignoreError=True)
if psOut or portTaken:
statusMsg=""
......@@ -95,10 +91,11 @@ class WalletMgr(object):
time.sleep(2)
try:
if Utils.Debug: Utils.Print("Checking if %s launched. %s" % (Utils.EosWalletName, pgrepCmd))
psOut=Utils.checkOutput(pgrepCmd.split())
if Utils.Debug: Utils.Print("Launched %s. %s - {%s}" % (Utils.EosWalletName, pgrepCmd, psOut))
if Utils.Debug: Utils.Print("Launched %s. {%s}" % (Utils.EosWalletName, psOut))
except subprocess.CalledProcessError as ex:
Utils.errorExit("Failed to launch the wallet manager on")
Utils.errorExit("Failed to launch the wallet manager")
return True
......
......@@ -102,7 +102,8 @@ def getMinHeadAndLib(prodNodes):
args = TestHelper.parse_args({"--prod-count","--dump-error-details","--keep-logs","-v","--leave-running","--clean-run","--p2p-plugin"})
args = TestHelper.parse_args({"--prod-count","--dump-error-details","--keep-logs","-v","--leave-running","--clean-run",
"--p2p-plugin","--wallet-port"})
Utils.Debug=args.v
totalProducerNodes=2
totalNonProducerNodes=1
......@@ -116,8 +117,9 @@ dontKill=args.leave_running
prodCount=args.prod_count
killAll=args.clean_run
p2pPlugin=args.p2p_plugin
walletPort=args.wallet_port
walletMgr=WalletMgr(True)
walletMgr=WalletMgr(True, port=walletPort)
testSuccessful=False
killEosInstances=not dontKill
killWallet=not dontKill
......
......@@ -22,7 +22,7 @@ from core_symbol import CORE_SYMBOL
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","--p2p-plugin"})
,"--sanity-test","--p2p-plugin","--wallet-port"})
server=args.host
port=args.port
debug=args.v
......@@ -38,15 +38,16 @@ onlyBios=args.only_bios
killAll=args.clean_run
sanityTest=args.sanity_test
p2pPlugin=args.p2p_plugin
walletPort=args.wallet_port
Utils.Debug=debug
localTest=True if server == TestHelper.LOCAL_HOST else False
cluster=Cluster(walletd=True, enableMongo=enableMongo, defproduceraPrvtKey=defproduceraPrvtKey, defproducerbPrvtKey=defproducerbPrvtKey)
walletMgr=WalletMgr(True)
walletMgr=WalletMgr(True, port=walletPort)
testSuccessful=False
killEosInstances=not dontKill
killWallet=not dontKill
dontBootstrap=sanityTest
dontBootstrap=sanityTest # intent is to limit the scope of the sanity test to just verifying that nodes can be started
WalletdName=Utils.EosWalletName
ClientName="cleos"
......
......@@ -54,7 +54,7 @@ class NamedAccounts:
# --keep-logs <Don't delete var/lib/node_* folders upon test completion>
###############################################################
args = TestHelper.parse_args({"--dump-error-details","--keep-logs","-v","--leave-running","--clean-run"})
args = TestHelper.parse_args({"--dump-error-details","--keep-logs","-v","--leave-running","--clean-run","--wallet-port"})
Utils.Debug=args.v
totalNodes=4
cluster=Cluster(walletd=True)
......@@ -62,8 +62,9 @@ dumpErrorDetails=args.dump_error_details
keepLogs=args.keep_logs
dontKill=args.leave_running
killAll=args.clean_run
walletPort=args.wallet_port
walletMgr=WalletMgr(True)
walletMgr=WalletMgr(True, port=walletPort)
testSuccessful=False
killEosInstances=not dontKill
killWallet=not dontKill
......
......@@ -140,7 +140,8 @@ 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"})
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)
......@@ -150,8 +151,9 @@ dontKill=args.leave_running
prodCount=args.prod_count
killAll=args.clean_run
p2pPlugin=args.p2p_plugin
walletPort=args.wallet_port
walletMgr=WalletMgr(True)
walletMgr=WalletMgr(True, port=walletPort)
testSuccessful=False
killEosInstances=not dontKill
killWallet=not dontKill
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册