Add argument to net/net to specify number of nodes (#4429)

Allows for testing different node counts without recreating the network.
This commit is contained in:
sakridge 2019-05-24 16:20:14 -07:00 committed by GitHub
parent 916844d399
commit 8611b40074
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 2 deletions

View File

@ -52,6 +52,7 @@ Operate a configured testnet
--hashes-per-tick NUM_HASHES|sleep|auto --hashes-per-tick NUM_HASHES|sleep|auto
- Override the default --hashes-per-tick for the cluster - Override the default --hashes-per-tick for the cluster
-n NUM_FULL_NODES - Number of fullnodes to apply command to.
sanity/start/update-specific options: sanity/start/update-specific options:
-F - Discard validator nodes that didn't bootup successfully -F - Discard validator nodes that didn't bootup successfully
@ -86,6 +87,7 @@ benchTpsExtraArgs=
benchExchangeExtraArgs= benchExchangeExtraArgs=
failOnValidatorBootupFailure=true failOnValidatorBootupFailure=true
genesisOptions= genesisOptions=
numFullnodesRequested=
command=$1 command=$1
[[ -n $command ]] || usage [[ -n $command ]] || usage
@ -106,7 +108,7 @@ while [[ -n $1 ]]; do
fi fi
done done
while getopts "h?T:t:o:f:rD:i:c:F" opt "${shortArgs[@]}"; do while getopts "h?T:t:o:f:rD:i:c:Fn:" opt "${shortArgs[@]}"; do
case $opt in case $opt in
h | \?) h | \?)
usage usage
@ -130,6 +132,9 @@ while getopts "h?T:t:o:f:rD:i:c:F" opt "${shortArgs[@]}"; do
f) f)
cargoFeatures=$OPTARG cargoFeatures=$OPTARG
;; ;;
n)
numFullnodesRequested=$OPTARG
;;
i) i)
updateManifestKeypairFile=$OPTARG updateManifestKeypairFile=$OPTARG
if [[ ! -r $updateManifestKeypairFile ]]; then if [[ ! -r $updateManifestKeypairFile ]]; then
@ -159,7 +164,6 @@ while getopts "h?T:t:o:f:rD:i:c:F" opt "${shortArgs[@]}"; do
echo "Error: Expecting tuple \"clientType=numClientType=extraArgs\" but got \"$OPTARG\"" echo "Error: Expecting tuple \"clientType=numClientType=extraArgs\" but got \"$OPTARG\""
exit 1 exit 1
fi fi
set -x
local keyValue local keyValue
IFS='=' read -ra keyValue <<< "$OPTARG" IFS='=' read -ra keyValue <<< "$OPTARG"
local clientType=${keyValue[0]} local clientType=${keyValue[0]}
@ -198,6 +202,12 @@ done
loadConfigFile loadConfigFile
if [[ -n $numFullnodesRequested ]]; then
truncatedNodeList=( "${fullnodeIpList[@]:0:$numFullnodesRequested}" )
unset fullnodeIpList
fullnodeIpList=( "${truncatedNodeList[@]}" )
fi
numClients=${#clientIpList[@]} numClients=${#clientIpList[@]}
numClientsRequested=$((numBenchTpsClients+numBenchExchangeClients)) numClientsRequested=$((numBenchTpsClients+numBenchExchangeClients))
if [[ "$numClientsRequested" -eq 0 ]]; then if [[ "$numClientsRequested" -eq 0 ]]; then