Browse Source

test/p2p: shellcheck

pull/426/head
Ethan Buchman 8 years ago
parent
commit
097da55a2c
6 changed files with 33 additions and 33 deletions
  1. +4
    -4
      test/p2p/client.sh
  2. +4
    -4
      test/p2p/local_testnet_start.sh
  3. +4
    -4
      test/p2p/local_testnet_stop.sh
  4. +8
    -8
      test/p2p/peer.sh
  5. +3
    -3
      test/p2p/seeds.sh
  6. +10
    -10
      test/p2p/test.sh

+ 4
- 4
test/p2p/client.sh View File

@ -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

+ 4
- 4
test/p2p/local_testnet_start.sh View File

@ -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

+ 4
- 4
test/p2p/local_testnet_stop.sh View File

@ -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"

+ 8
- 8
test/p2p/peer.sh View File

@ -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

+ 3
- 3
test/p2p/seeds.sh View File

@ -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"

+ 10
- 10
test/p2p/test.sh View File

@ -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"

Loading…
Cancel
Save