diff --git a/proxy/client.go b/proxy/client.go index c6e03e787..587b45466 100644 --- a/proxy/client.go +++ b/proxy/client.go @@ -71,6 +71,8 @@ func DefaultClientCreator(config cfg.Config) ClientCreator { switch addr { case "dummy": return NewLocalClientCreator(dummy.NewDummyApplication()) + case "persistent_dummy": + return NewLocalClientCreator(dummy.NewPersistentDummyApplication(config.GetString("db_dir"))) case "nilapp": return NewLocalClientCreator(nilapp.NewNilApplication()) default: diff --git a/test/p2p/fast_sync/test.sh b/test/p2p/fast_sync/test.sh index b4ac90f99..8820d199c 100644 --- a/test/p2p/fast_sync/test.sh +++ b/test/p2p/fast_sync/test.sh @@ -4,12 +4,13 @@ set -eu DOCKER_IMAGE=$1 NETWORK_NAME=$2 N=$3 +PROXY_APP=$4 cd $GOPATH/src/github.com/tendermint/tendermint # run it on each of them 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 diff --git a/test/p2p/fast_sync/test_peer.sh b/test/p2p/fast_sync/test_peer.sh index 135c5ddcd..a065ea5c7 100644 --- a/test/p2p/fast_sync/test_peer.sh +++ b/test/p2p/fast_sync/test_peer.sh @@ -5,6 +5,7 @@ DOCKER_IMAGE=$1 NETWORK_NAME=$2 ID=$3 N=$4 +PROXY_APP=$5 ############################################################### # this runs on each peer: @@ -26,7 +27,7 @@ SEEDS="$(test/p2p/ip.sh 1):46656" for j in `seq 2 $N`; do SEEDS="$SEEDS,$(test/p2p/ip.sh $j):46656" 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 bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME fs_$ID "test/p2p/fast_sync/check_peer.sh $ID" diff --git a/test/p2p/kill_all/test.sh b/test/p2p/kill_all/test.sh index e8157d7be..ab8e29c53 100644 --- a/test/p2p/kill_all/test.sh +++ b/test/p2p/kill_all/test.sh @@ -15,6 +15,9 @@ cd "$GOPATH/src/github.com/tendermint/tendermint" ############################################################### for i in $(seq 1 "$NUM_OF_CRASHES"); do + echo "" + echo "Restarting all peers! Take $i ..." + # restart all peers for i in $(seq 1 "$NUM_OF_PEERS"); do docker stop "local_testnet_$i" diff --git a/test/p2p/local_testnet_start.sh b/test/p2p/local_testnet_start.sh index 50297d62d..4dd2ab05d 100644 --- a/test/p2p/local_testnet_start.sh +++ b/test/p2p/local_testnet_start.sh @@ -4,6 +4,7 @@ set -eu DOCKER_IMAGE=$1 NETWORK_NAME=$2 N=$3 +APP_PROXY=$4 cd $GOPATH/src/github.com/tendermint/tendermint @@ -17,5 +18,5 @@ done echo "Seeds: $seeds" 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 diff --git a/test/p2p/peer.sh b/test/p2p/peer.sh index 32e696e76..76314f586 100644 --- a/test/p2p/peer.sh +++ b/test/p2p/peer.sh @@ -4,9 +4,10 @@ set -eu DOCKER_IMAGE=$1 NETWORK_NAME=$2 ID=$3 +APP_PROXY=$4 set +u -SEEDS=$4 +SEEDS=$5 set -u if [[ "$SEEDS" != "" ]]; then SEEDS=" --seeds $SEEDS " @@ -15,10 +16,9 @@ fi echo "starting tendermint peer ID=$ID" # start tendermint container on the network 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 diff --git a/test/p2p/test.sh b/test/p2p/test.sh index 2a45e7f8c..0f29aa199 100644 --- a/test/p2p/test.sh +++ b/test/p2p/test.sh @@ -4,6 +4,7 @@ set -eu DOCKER_IMAGE=$1 NETWORK_NAME=local_testnet N=4 +PROXY_APP=persistent_dummy cd $GOPATH/src/github.com/tendermint/tendermint @@ -13,7 +14,8 @@ bash test/p2p/local_testnet_stop.sh $NETWORK_NAME $N set -e # 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 # 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): # 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 bash test/p2p/kill_all/test.sh $DOCKER_IMAGE $NETWORK_NAME $N 3