tendermint/test/p2p
Anton Kaliaev d0ca0cb308
otherwise we end up with unmount errors due to busy disk
```
local_testnet_1
Failed to remove container (local_testnet_1): Error response from daemon: Unable to remove filesystem for 74e1104c705d4f21137bbe9e6710f33511948fc04d26475b482d1314fe70d537: remove /var/lib/docker/containers/74e1104c705d4f21137bbe9e6710f33511948fc04d26475b482d1314fe70d537/shm: device or resource busy
local_testnet_2
Failed to remove container (local_testnet_2): Error response from daemon: Unable to remove filesystem for 6f2ec44e01afd85875c1d9958afa957f1623ed9464df2b4fcac06feb8254145e: remove /var/lib/docker/containers/6f2ec44e01afd85875c1d9958afa957f1623ed9464df2b4fcac06feb8254145e/shm: device or resource busy
local_testnet_3
Failed to remove container (local_testnet_3): Error response from daemon: Unable to remove filesystem for 6160c73d45376920d90473a487a07f0e283e383011a0d23050b22cd82ab5d255: remove /var/lib/docker/containers/6160c73d45376920d90473a487a07f0e283e383011a0d23050b22cd82ab5d255/shm: device or resource busy
local_testnet_4
Failed to remove container (local_testnet_4): Error response from daemon: Driver btrfs failed to remove root filesystem c93a30d66ff3710617915a8f6075755ebc45aebf73569420225105cc81003e2f: Failed to destroy btrfs snapshot /var/lib/docker/btrfs/subvolumes for cac56069a3682b6d133e239f479fb82a67c4ccd09b877794d9f440a1125d59d6: operation not permitted

* [15:37:40] stopping rsyslog container
Failed to remove container (rsyslog): Error response from daemon: Driver btrfs failed to remove root filesystem 477287a170a48156e663c55092257064e1f14770d0b6c634a9972893636d9451: Failed to destroy btrfs snapshot /var/lib/docker/btrfs/subvolumes for 76b66d582a478743c099f479bf88eb334ad303ef607f91021dfa58d28c9161eb: operation not permitted
make: *** [test_integrations] Error 1
```
2017-02-14 20:40:23 +04:00
..
atomic_broadcast fix tests 2017-01-12 10:58:44 -05:00
basic test: more cleanup on p2p 2016-12-12 16:00:21 -05:00
data TMSP -> ABCI 2017-01-12 15:53:32 -05:00
fast_sync test/p2p: use PROXY_APP=persistent_dummy 2016-12-22 01:43:23 -05:00
kill_all fix tests 2017-01-13 00:54:01 -05:00
README.md README for local testnets [ci skip] 2017-01-28 19:25:28 -05:00
clean.sh test: refactor bash; test fastsync (failing) 2016-08-27 14:50:07 -04:00
client.sh test: more unique container names 2016-12-22 22:10:40 -05:00
ip.sh test: refactor bash; test fastsync (failing) 2016-08-27 14:50:07 -04:00
local_testnet_start.sh test/p2p: use PROXY_APP=persistent_dummy 2016-12-22 01:43:23 -05:00
local_testnet_stop.sh test/p2p: kill and restart all nodes 2016-12-22 01:42:51 -05:00
peer.sh collect and add docker logs to CircleCI artifacts (Refs #387) 2017-02-14 19:02:11 +04:00
test.sh otherwise we end up with unmount errors due to busy disk 2017-02-14 20:40:23 +04:00

README.md

Tendermint P2P Tests

These scripts facilitate setting up and testing a local testnet using docker containers.

Setup your own local testnet as follows.

For consistency, we assume all commands are run from the Tendermint repository root (ie. $GOPATH/src/github.com/tendermint/tendermint).

First, build the docker image:

docker build -t tendermint_tester -f ./test/docker/Dockerfile .

Now create the docker network:

docker network create --driver bridge --subnet 172.57.0.0/16 my_testnet

This gives us a new network with IP addresses in the rage 172.57.0.0 - 172.57.255.255. Peers on the network can have any IP address in this range. For our four node network, let's pick 172.57.0.101 - 172.57.0.104. Since we use Tendermint's default listening port of 46656, our list of seed nodes will look like:

172.57.0.101:46656,172.57.0.102:46656,172.57.0.103:46656,172.57.0.104:46656

Now we can start up the peers. We already have config files setup in test/p2p/data/. Let's use a for-loop to start our peers:

for i in $(seq 1 4); do
	docker run -d \
	  --net=my_testnet\
	  --ip="172.57.0.$((100 + $i))" \
	  --name local_testnet_$i \
	  --entrypoint tendermint \
	  -e TMROOT=/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$i/core \
	  tendermint_tester node --seeds 172.57.0.101:46656,172.57.0.102:46656,172.57.0.103:46656,172.57.0.104:46656 --proxy_app=dummy
done

If you now run docker ps, you'll see your containers!

We can confirm they are making blocks by checking the /status message using curl and jq to pretty print the output json:

curl 172.57.0.101:46657/status | jq .