Browse Source

test/p2p: use PROXY_APP=persistent_dummy

pull/343/head
Anton Kalyaev 8 years ago
committed by Ethan Buchman
parent
commit
69a449a073
7 changed files with 23 additions and 13 deletions
  1. +2
    -0
      proxy/client.go
  2. +2
    -1
      test/p2p/fast_sync/test.sh
  3. +2
    -1
      test/p2p/fast_sync/test_peer.sh
  4. +3
    -0
      test/p2p/kill_all/test.sh
  5. +2
    -1
      test/p2p/local_testnet_start.sh
  6. +8
    -8
      test/p2p/peer.sh
  7. +4
    -2
      test/p2p/test.sh

+ 2
- 0
proxy/client.go View File

@ -71,6 +71,8 @@ func DefaultClientCreator(config cfg.Config) ClientCreator {
switch addr { switch addr {
case "dummy": case "dummy":
return NewLocalClientCreator(dummy.NewDummyApplication()) return NewLocalClientCreator(dummy.NewDummyApplication())
case "persistent_dummy":
return NewLocalClientCreator(dummy.NewPersistentDummyApplication(config.GetString("db_dir")))
case "nilapp": case "nilapp":
return NewLocalClientCreator(nilapp.NewNilApplication()) return NewLocalClientCreator(nilapp.NewNilApplication())
default: default:


+ 2
- 1
test/p2p/fast_sync/test.sh View File

@ -4,12 +4,13 @@ set -eu
DOCKER_IMAGE=$1 DOCKER_IMAGE=$1
NETWORK_NAME=$2 NETWORK_NAME=$2
N=$3 N=$3
PROXY_APP=$4
cd $GOPATH/src/github.com/tendermint/tendermint cd $GOPATH/src/github.com/tendermint/tendermint
# run it on each of them # run it on each of them
for i in `seq 1 $N`; do for i in `seq 1 $N`; do
bash test/p2p/fast_sync/test_peer.sh $DOCKER_IMAGE $NETWORK_NAME $i $N
bash test/p2p/fast_sync/test_peer.sh $DOCKER_IMAGE $NETWORK_NAME $i $N $PROXY_APP
done done

+ 2
- 1
test/p2p/fast_sync/test_peer.sh View File

@ -5,6 +5,7 @@ DOCKER_IMAGE=$1
NETWORK_NAME=$2 NETWORK_NAME=$2
ID=$3 ID=$3
N=$4 N=$4
PROXY_APP=$5
############################################################### ###############################################################
# this runs on each peer: # this runs on each peer:
@ -26,7 +27,7 @@ SEEDS="$(test/p2p/ip.sh 1):46656"
for j in `seq 2 $N`; do for j in `seq 2 $N`; do
SEEDS="$SEEDS,$(test/p2p/ip.sh $j):46656" SEEDS="$SEEDS,$(test/p2p/ip.sh $j):46656"
done done
bash test/p2p/peer.sh $DOCKER_IMAGE $NETWORK_NAME $ID $SEEDS
bash test/p2p/peer.sh $DOCKER_IMAGE $NETWORK_NAME $ID $PROXY_APP $SEEDS
# wait for peer to sync and check the app hash # wait for peer to sync and check the app hash
bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME fs_$ID "test/p2p/fast_sync/check_peer.sh $ID" bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME fs_$ID "test/p2p/fast_sync/check_peer.sh $ID"


+ 3
- 0
test/p2p/kill_all/test.sh View File

@ -15,6 +15,9 @@ cd "$GOPATH/src/github.com/tendermint/tendermint"
############################################################### ###############################################################
for i in $(seq 1 "$NUM_OF_CRASHES"); do for i in $(seq 1 "$NUM_OF_CRASHES"); do
echo ""
echo "Restarting all peers! Take $i ..."
# restart all peers # restart all peers
for i in $(seq 1 "$NUM_OF_PEERS"); do for i in $(seq 1 "$NUM_OF_PEERS"); do
docker stop "local_testnet_$i" docker stop "local_testnet_$i"


+ 2
- 1
test/p2p/local_testnet_start.sh View File

@ -4,6 +4,7 @@ set -eu
DOCKER_IMAGE=$1 DOCKER_IMAGE=$1
NETWORK_NAME=$2 NETWORK_NAME=$2
N=$3 N=$3
APP_PROXY=$4
cd $GOPATH/src/github.com/tendermint/tendermint cd $GOPATH/src/github.com/tendermint/tendermint
@ -17,5 +18,5 @@ done
echo "Seeds: $seeds" echo "Seeds: $seeds"
for i in `seq 1 $N`; do for i in `seq 1 $N`; do
bash test/p2p/peer.sh $DOCKER_IMAGE $NETWORK_NAME $i $seeds
bash test/p2p/peer.sh $DOCKER_IMAGE $NETWORK_NAME $i $APP_PROXY $seeds
done done

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

@ -4,9 +4,10 @@ set -eu
DOCKER_IMAGE=$1 DOCKER_IMAGE=$1
NETWORK_NAME=$2 NETWORK_NAME=$2
ID=$3 ID=$3
APP_PROXY=$4
set +u set +u
SEEDS=$4
SEEDS=$5
set -u set -u
if [[ "$SEEDS" != "" ]]; then if [[ "$SEEDS" != "" ]]; then
SEEDS=" --seeds $SEEDS " SEEDS=" --seeds $SEEDS "
@ -15,10 +16,9 @@ fi
echo "starting tendermint peer ID=$ID" echo "starting tendermint peer ID=$ID"
# start tendermint container on the network # start tendermint container on the network
docker run -d \ docker run -d \
--net=$NETWORK_NAME \
--ip=$(test/p2p/ip.sh $ID) \
--name local_testnet_$ID \
--entrypoint tendermint \
-v $GOPATH/src/github.com/tendermint/tendermint/test/p2p/:/go/src/github.com/tendermint/tendermint/test/p2p \
-e TMROOT=/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$ID/core \
$DOCKER_IMAGE node $SEEDS --proxy_app=dummy
--net=$NETWORK_NAME \
--ip=$(test/p2p/ip.sh $ID) \
--name local_testnet_$ID \
--entrypoint tendermint \
-e TMROOT=/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$ID/core \
$DOCKER_IMAGE node $SEEDS --proxy_app=$APP_PROXY

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

@ -4,6 +4,7 @@ set -eu
DOCKER_IMAGE=$1 DOCKER_IMAGE=$1
NETWORK_NAME=local_testnet NETWORK_NAME=local_testnet
N=4 N=4
PROXY_APP=persistent_dummy
cd $GOPATH/src/github.com/tendermint/tendermint cd $GOPATH/src/github.com/tendermint/tendermint
@ -13,7 +14,8 @@ bash test/p2p/local_testnet_stop.sh $NETWORK_NAME $N
set -e set -e
# start the testnet on a local network # start the testnet on a local network
bash test/p2p/local_testnet_start.sh $DOCKER_IMAGE $NETWORK_NAME $N
# NOTE we re-use the same network for all tests
bash test/p2p/local_testnet_start.sh $DOCKER_IMAGE $NETWORK_NAME $N $PROXY_APP
# test basic connectivity and consensus # test basic connectivity and consensus
# start client container and check the num peers and height for all nodes # start client container and check the num peers and height for all nodes
@ -25,7 +27,7 @@ bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME ab "test/p2p/atomic_broadcas
# test fast sync (from current state of network): # test fast sync (from current state of network):
# for each node, kill it and readd via fast sync # for each node, kill it and readd via fast sync
bash test/p2p/fast_sync/test.sh $DOCKER_IMAGE $NETWORK_NAME $N
bash test/p2p/fast_sync/test.sh $DOCKER_IMAGE $NETWORK_NAME $N $PROXY_APP
# test killing all peers # test killing all peers
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

Loading…
Cancel
Save