diff --git a/test/p2p/client.sh b/test/p2p/client.sh index f3025ba58..fa11ce870 100644 --- a/test/p2p/client.sh +++ b/test/p2p/client.sh @@ -11,9 +11,9 @@ NAME=test_container_$ID echo "starting test client container with CMD=$CMD" # run the test container on the local network docker run -t --rm \ - -v $GOPATH/src/github.com/tendermint/tendermint/test/p2p/:/go/src/github.com/tendermint/tendermint/test/p2p \ - --net=$NETWORK_NAME \ + -v "$GOPATH/src/github.com/tendermint/tendermint/test/p2p/:/go/src/github.com/tendermint/tendermint/test/p2p" \ + --net="$NETWORK_NAME" \ --ip=$(test/p2p/ip.sh "-1") \ - --name $NAME \ + --name "$NAME" \ --entrypoint bash \ - $DOCKER_IMAGE $CMD + "$DOCKER_IMAGE" $CMD diff --git a/test/p2p/local_testnet_start.sh b/test/p2p/local_testnet_start.sh index 9a280c594..b7cfb959e 100644 --- a/test/p2p/local_testnet_start.sh +++ b/test/p2p/local_testnet_start.sh @@ -14,11 +14,11 @@ if [[ "$SEEDS" != "" ]]; then fi set -u -cd $GOPATH/src/github.com/tendermint/tendermint +cd "$GOPATH/src/github.com/tendermint/tendermint" # create docker network -docker network create --driver bridge --subnet 172.57.0.0/16 $NETWORK_NAME +docker network create --driver bridge --subnet 172.57.0.0/16 "$NETWORK_NAME" -for i in `seq 1 $N`; do - bash test/p2p/peer.sh $DOCKER_IMAGE $NETWORK_NAME $i $APP_PROXY "$SEEDS --pex" +for i in $(seq 1 "$N"); do + bash test/p2p/peer.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$i" "$APP_PROXY" "$SEEDS --pex" done diff --git a/test/p2p/local_testnet_stop.sh b/test/p2p/local_testnet_stop.sh index 8edd3eeb7..1dace4694 100644 --- a/test/p2p/local_testnet_stop.sh +++ b/test/p2p/local_testnet_stop.sh @@ -4,9 +4,9 @@ set -u NETWORK_NAME=$1 N=$2 -for i in `seq 1 $N`; do - docker stop local_testnet_$i - docker rm -vf local_testnet_$i +for i in $(seq 1 "$N"); do + docker stop "local_testnet_$i" + docker rm -vf "local_testnet_$i" done -docker network rm $NETWORK_NAME +docker network rm "$NETWORK_NAME" diff --git a/test/p2p/peer.sh b/test/p2p/peer.sh index adeb01a10..5299a3c60 100644 --- a/test/p2p/peer.sh +++ b/test/p2p/peer.sh @@ -17,23 +17,23 @@ echo "starting tendermint peer ID=$ID" if [[ "$CIRCLECI" == true ]]; then set -u docker run -d \ - --net=$NETWORK_NAME \ + --net="$NETWORK_NAME" \ --ip=$(test/p2p/ip.sh $ID) \ - --name local_testnet_$ID \ + --name "local_testnet_$ID" \ --entrypoint tendermint \ - -e TMROOT=/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$ID/core \ + -e TMROOT="/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$ID/core" \ --log-driver=syslog \ --log-opt syslog-address=udp://127.0.0.1:5514 \ --log-opt syslog-facility=daemon \ --log-opt tag="{{.Name}}" \ - $DOCKER_IMAGE node $NODE_FLAGS --log_level=debug --proxy_app=$APP_PROXY + "$DOCKER_IMAGE" node $NODE_FLAGS --log_level=debug --proxy_app="$APP_PROXY" else set -u docker run -d \ - --net=$NETWORK_NAME \ + --net="$NETWORK_NAME" \ --ip=$(test/p2p/ip.sh $ID) \ - --name local_testnet_$ID \ + --name "local_testnet_$ID" \ --entrypoint tendermint \ - -e TMROOT=/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$ID/core \ - $DOCKER_IMAGE node $NODE_FLAGS --log_level=info --proxy_app=$APP_PROXY + -e TMROOT="/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$ID/core" \ + "$DOCKER_IMAGE" node $NODE_FLAGS --log_level=info --proxy_app="$APP_PROXY" fi diff --git a/test/p2p/seeds.sh b/test/p2p/seeds.sh index 471476ad0..4bf866cba 100644 --- a/test/p2p/seeds.sh +++ b/test/p2p/seeds.sh @@ -3,10 +3,10 @@ set -eu N=$1 -cd $GOPATH/src/github.com/tendermint/tendermint +cd "$GOPATH/src/github.com/tendermint/tendermint" seeds="$(test/p2p/ip.sh 1):46656" -for i in `seq 2 $N`; do +for i in $(seq 2 $N); do seeds="$seeds,$(test/p2p/ip.sh $i):46656" done -echo $seeds +echo "$seeds" diff --git a/test/p2p/test.sh b/test/p2p/test.sh index 3e67dfbd5..6a5537b98 100644 --- a/test/p2p/test.sh +++ b/test/p2p/test.sh @@ -6,33 +6,33 @@ NETWORK_NAME=local_testnet N=4 PROXY_APP=persistent_dummy -cd $GOPATH/src/github.com/tendermint/tendermint +cd "$GOPATH/src/github.com/tendermint/tendermint" # stop the existing testnet and remove local network set +e -bash test/p2p/local_testnet_stop.sh $NETWORK_NAME $N +bash test/p2p/local_testnet_stop.sh "$NETWORK_NAME" "$N" set -e SEEDS=$(bash test/p2p/seeds.sh $N) # start the testnet on a local network # NOTE we re-use the same network for all tests -bash test/p2p/local_testnet_start.sh $DOCKER_IMAGE $NETWORK_NAME $N $PROXY_APP $SEEDS +bash test/p2p/local_testnet_start.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$N" "$PROXY_APP" "$SEEDS" # test basic connectivity and consensus # start client container and check the num peers and height for all nodes -bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME basic "test/p2p/basic/test.sh $N" +bash test/p2p/client.sh "$DOCKER_IMAGE" "$NETWORK_NAME" basic "test/p2p/basic/test.sh $N" # test atomic broadcast: # start client container and test sending a tx to each node -bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME ab "test/p2p/atomic_broadcast/test.sh $N" +bash test/p2p/client.sh "$DOCKER_IMAGE" "$NETWORK_NAME" ab "test/p2p/atomic_broadcast/test.sh $N" - test fast sync (from current state of network): - for each node, kill it and readd via fast sync -bash test/p2p/fast_sync/test.sh $DOCKER_IMAGE $NETWORK_NAME $N $PROXY_APP +# test fast sync (from current state of network): +# for each node, kill it and readd via fast sync +bash test/p2p/fast_sync/test.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$N" "$PROXY_APP" # test killing all peers 3 times -bash test/p2p/kill_all/test.sh $DOCKER_IMAGE $NETWORK_NAME $N 3 +bash test/p2p/kill_all/test.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$N" 3 # test pex -bash test/p2p/pex/test.sh $DOCKER_IMAGE $NETWORK_NAME $N $PROXY_APP +bash test/p2p/pex/test.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$N" "$PROXY_APP"