Browse Source

README for local testnets [ci skip]

pull/386/head
Ethan Buchman 8 years ago
parent
commit
9707cb4471
2 changed files with 60 additions and 4 deletions
  1. +6
    -4
      test/README.md
  2. +54
    -0
      test/p2p/README.md

+ 6
- 4
test/README.md View File

@ -3,26 +3,28 @@
The unit tests (ie. the `go test` s) can be run with `make test`. The unit tests (ie. the `go test` s) can be run with `make test`.
The integration tests can be run wtih `make test_integrations`. The integration tests can be run wtih `make test_integrations`.
Running the integrations test will build a docker container with latest tendermint
Running the integrations test will build a docker container with local version of tendermint
and run the following tests in docker containers: and run the following tests in docker containers:
- go tests, with --race - go tests, with --race
- includes test coverage
- app tests - app tests
- dummy app over socket - dummy app over socket
- counter app over socket - counter app over socket
- counter app over grpc - counter app over grpc
- persistence tests
- crash tendermint at each of many predefined points, restart, and ensure it syncs properly with the app
- p2p tests - p2p tests
- start a local dummy app testnet on a docker network (requires docker version 1.10+) - start a local dummy app testnet on a docker network (requires docker version 1.10+)
- send a tx on each node and ensure the state root is updated on all of them - send a tx on each node and ensure the state root is updated on all of them
- crash and restart nodes one at a time and ensure they can sync back up (via fastsync)
- crash and restart all nodes at once and ensure they can sync back up
If on a `release-x.x.x` branch, we also run If on a `release-x.x.x` branch, we also run
- `go test` for all our dependency libs (test/test_libs.sh) - `go test` for all our dependency libs (test/test_libs.sh)
- network_testing - benchmark a mintnet based cloud deploy using netmon - network_testing - benchmark a mintnet based cloud deploy using netmon
# Coverage
TODO!

+ 54
- 0
test/p2p/README.md View File

@ -0,0 +1,54 @@
# 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 .
```

Loading…
Cancel
Save