From 8611b400740a95a05db6e4a0a5e1014b1ae4b33d Mon Sep 17 00:00:00 2001 From: sakridge Date: Fri, 24 May 2019 16:20:14 -0700 Subject: [PATCH] Add argument to net/net to specify number of nodes (#4429) Allows for testing different node counts without recreating the network. --- net/net.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/net/net.sh b/net/net.sh index ff109e4845..5fae426560 100755 --- a/net/net.sh +++ b/net/net.sh @@ -52,6 +52,7 @@ Operate a configured testnet --hashes-per-tick NUM_HASHES|sleep|auto - 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: -F - Discard validator nodes that didn't bootup successfully @@ -86,6 +87,7 @@ benchTpsExtraArgs= benchExchangeExtraArgs= failOnValidatorBootupFailure=true genesisOptions= +numFullnodesRequested= command=$1 [[ -n $command ]] || usage @@ -106,7 +108,7 @@ while [[ -n $1 ]]; do fi 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 h | \?) usage @@ -130,6 +132,9 @@ while getopts "h?T:t:o:f:rD:i:c:F" opt "${shortArgs[@]}"; do f) cargoFeatures=$OPTARG ;; + n) + numFullnodesRequested=$OPTARG + ;; i) updateManifestKeypairFile=$OPTARG 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\"" exit 1 fi - set -x local keyValue IFS='=' read -ra keyValue <<< "$OPTARG" local clientType=${keyValue[0]} @@ -198,6 +202,12 @@ done loadConfigFile +if [[ -n $numFullnodesRequested ]]; then + truncatedNodeList=( "${fullnodeIpList[@]:0:$numFullnodesRequested}" ) + unset fullnodeIpList + fullnodeIpList=( "${truncatedNodeList[@]}" ) +fi + numClients=${#clientIpList[@]} numClientsRequested=$((numBenchTpsClients+numBenchExchangeClients)) if [[ "$numClientsRequested" -eq 0 ]]; then