fix 2 errors when running p2p tests more than once

Error #1:

```
Error response from daemon: network with name local_testnet already exists
```

Fixed by stopping and removing local_testnet containers and removing
the network

Error #2:

```
docker: Error response from daemon: Conflict. The name "/test_container_basic" is already in use by container a7cd15d479a964675e7f259de4ed852e7dfef85b447514728f437cd0b980a709. You have to remove (or rename) that container to beable to reuse that name..
```

Fixed by adding `--rm` flag.
This commit is contained in:
Anton Kalyaev
2016-12-20 21:16:39 +04:00
committed by Ethan Buchman
parent 1c24031dd2
commit 57f3592411
4 changed files with 19 additions and 2 deletions

View File

@@ -8,7 +8,7 @@ CMD=$4
echo "starting test client container with CMD=$CMD"
# run the test container on the local network
docker run -t \
docker run -t --rm \
-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") \

View File

@@ -0,0 +1,12 @@
#! /bin/bash
set -u
NETWORK_NAME=$1
N=$2
for i in `seq 1 $N`; do
docker stop local_testnet_$i
docker rm local_testnet_$i
done
docker network rm $NETWORK_NAME

View File

@@ -7,8 +7,13 @@ N=4
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
set -e
# start the testnet on a local network
bash test/p2p/local_testnet.sh $DOCKER_IMAGE $NETWORK_NAME $N
bash test/p2p/local_testnet_start.sh $DOCKER_IMAGE $NETWORK_NAME $N
# test basic connectivity and consensus
# start client container and check the num peers and height for all nodes