Browse Source

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.
pull/343/head
Anton Kalyaev 8 years ago
committed by Ethan Buchman
parent
commit
57f3592411
4 changed files with 19 additions and 2 deletions
  1. +1
    -1
      test/p2p/client.sh
  2. +0
    -0
      test/p2p/local_testnet_start.sh
  3. +12
    -0
      test/p2p/local_testnet_stop.sh
  4. +6
    -1
      test/p2p/test.sh

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

@ -8,7 +8,7 @@ CMD=$4
echo "starting test client container with CMD=$CMD" echo "starting test client container with CMD=$CMD"
# run the test container on the local network # 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 \ -v $GOPATH/src/github.com/tendermint/tendermint/test/p2p/:/go/src/github.com/tendermint/tendermint/test/p2p \
--net=$NETWORK_NAME \ --net=$NETWORK_NAME \
--ip=$(test/p2p/ip.sh "-1") \ --ip=$(test/p2p/ip.sh "-1") \


test/p2p/local_testnet.sh → test/p2p/local_testnet_start.sh View File


+ 12
- 0
test/p2p/local_testnet_stop.sh 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

+ 6
- 1
test/p2p/test.sh View File

@ -7,8 +7,13 @@ N=4
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
set -e
# start the testnet on a local network # 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 # 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


Loading…
Cancel
Save