From bf7ba17932e9cf18fbddbf4129d96173ad2709e1 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Sat, 27 Aug 2016 16:01:52 -0400 Subject: [PATCH] test/p2p: name client conts so we dont need to rm them because circle --- blockchain/reactor.go | 3 ++- test/p2p/a.sh | 8 -------- test/p2p/client.sh | 6 +++--- test/p2p/test.sh | 8 ++++++-- 4 files changed, 11 insertions(+), 14 deletions(-) delete mode 100644 test/p2p/a.sh diff --git a/blockchain/reactor.go b/blockchain/reactor.go index 1cf78dcee..e471633c0 100644 --- a/blockchain/reactor.go +++ b/blockchain/reactor.go @@ -231,6 +231,7 @@ FOR_LOOP: break SYNC_LOOP } else { bcR.pool.PopRequest() + // TODO: use ApplyBlock instead of Exec/Commit/SetAppHash/Save err := bcR.state.ExecBlock(bcR.evsw, bcR.proxyAppConn, first, firstPartsHeader) if err != nil { // TODO This is bad, are we zombie? @@ -245,7 +246,7 @@ FOR_LOOP: PanicQ(Fmt("Failed to commit block at application: %v", res)) } bcR.store.SaveBlock(first, firstParts, second.LastCommit) - bcR.state.AppHash = res.Data // ... + bcR.state.AppHash = res.Data bcR.state.Save() } } diff --git a/test/p2p/a.sh b/test/p2p/a.sh deleted file mode 100644 index 189548f9e..000000000 --- a/test/p2p/a.sh +++ /dev/null @@ -1,8 +0,0 @@ -#! /bin/bash - -h1=10 -h2=0 -while [ $h2 -lt $(($h1+3)) ]; do - echo "$h2" - h2=$(($h2+1)) -done diff --git a/test/p2p/client.sh b/test/p2p/client.sh index 3cf39d5b5..efc5096ef 100644 --- a/test/p2p/client.sh +++ b/test/p2p/client.sh @@ -3,7 +3,8 @@ set -eu DOCKER_IMAGE=$1 NETWORK_NAME=$2 -CMD=$3 +ID=$3 +CMD=$4 echo "starting test client container with CMD=$CMD" # run the test container on the local network @@ -11,8 +12,7 @@ docker run -t \ -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 test_container \ + --name test_container_$ID \ --entrypoint bash \ $DOCKER_IMAGE $CMD -docker rm -vf test_container diff --git a/test/p2p/test.sh b/test/p2p/test.sh index 2a109f0bb..4d021a4ee 100644 --- a/test/p2p/test.sh +++ b/test/p2p/test.sh @@ -4,11 +4,13 @@ set -eu DOCKER_IMAGE=$1 NETWORK_NAME=local_testnet +cd $GOPATH/src/github.com/tendermint/tendermint + # start the testnet on a local network bash test/p2p/local_testnet.sh $DOCKER_IMAGE $NETWORK_NAME # test atomic broadcast -bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME test/p2p/atomic_broadcast/test.sh +bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME ab test/p2p/atomic_broadcast/test.sh # test fast sync (from current state of network) # run it on each of them @@ -17,7 +19,9 @@ for i in `seq 1 $N`; do echo "Testing fasysync on node $i" # kill peer + set +e # circle sigh :( docker rm -vf local_testnet_$i + set -e # restart peer - should have an empty blockchain SEEDS="$(test/p2p/ip.sh 1):46656" @@ -26,7 +30,7 @@ for i in `seq 1 $N`; do done bash test/p2p/peer.sh $DOCKER_IMAGE $NETWORK_NAME $i $SEEDS - bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME "test/p2p/fast_sync/test.sh $i" + bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME fs_$i "test/p2p/fast_sync/test.sh $i" done echo "" echo "PASS"