This commit is contained in:
Ethan Buchman
2017-04-21 17:38:40 -04:00
parent 3240ce21b8
commit 0017fb7ffe
88 changed files with 0 additions and 0 deletions
-54
View File
@@ -1,54 +0,0 @@
# 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 TMHOME=/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 .
```
-61
View File
@@ -1,61 +0,0 @@
#! /bin/bash
set -u
N=$1
###################################################################
# assumes peers are already synced up
# test sending txs
# for each peer:
# send a tx, wait for commit
# assert app hash on every peer reflects the post tx state
###################################################################
echo ""
# run the test on each of them
for i in `seq 1 $N`; do
addr=$(test/p2p/ip.sh $i):46657
# current state
HASH1=`curl -s $addr/status | jq .result[1].latest_app_hash`
# - send a tx
TX=aadeadbeefbeefbeef0$i
echo "Broadcast Tx $TX"
curl -s $addr/broadcast_tx_commit?tx=0x$TX
echo ""
# we need to wait another block to get the new app_hash
h1=`curl -s $addr/status | jq .result[1].latest_block_height`
h2=$h1
while [ "$h2" == "$h1" ]; do
sleep 1
h2=`curl -s $addr/status | jq .result[1].latest_block_height`
done
# check that hash was updated
HASH2=`curl -s $addr/status | jq .result[1].latest_app_hash`
if [[ "$HASH1" == "$HASH2" ]]; then
echo "Expected state hash to update from $HASH1. Got $HASH2"
exit 1
fi
# check we get the same new hash on all other nodes
for j in `seq 1 $N`; do
if [[ "$i" != "$j" ]]; then
addrJ=$(test/p2p/ip.sh $j):46657
HASH3=`curl -s $addrJ/status | jq .result[1].latest_app_hash`
if [[ "$HASH2" != "$HASH3" ]]; then
echo "App hash for node $j doesn't match. Got $HASH3, expected $HASH2"
exit 1
fi
fi
done
echo "All nodes are up to date"
done
echo ""
echo "PASS"
echo ""
-53
View File
@@ -1,53 +0,0 @@
#! /bin/bash
set -u
N=$1
###################################################################
# wait for all peers to come online
# for each peer:
# wait to have N-1 peers
# wait to be at height > 1
###################################################################
# wait for everyone to come online
echo "Waiting for nodes to come online"
for i in `seq 1 $N`; do
addr=$(test/p2p/ip.sh $i):46657
curl -s $addr/status > /dev/null
ERR=$?
while [ "$ERR" != 0 ]; do
sleep 1
curl -s $addr/status > /dev/null
ERR=$?
done
echo "... node $i is up"
done
echo ""
# wait for each of them to sync up
for i in `seq 1 $N`; do
addr=$(test/p2p/ip.sh $i):46657
N_1=$(($N - 1))
# - assert everyone has N-1 other peers
N_PEERS=`curl -s $addr/net_info | jq '.result[1].peers | length'`
while [ "$N_PEERS" != $N_1 ]; do
echo "Waiting for node $i to connect to all peers ..."
sleep 1
N_PEERS=`curl -s $addr/net_info | jq '.result[1].peers | length'`
done
# - assert block height is greater than 1
BLOCK_HEIGHT=`curl -s $addr/status | jq .result[1].latest_block_height`
while [ "$BLOCK_HEIGHT" -le 1 ]; do
echo "Waiting for node $i to commit a block ..."
sleep 1
BLOCK_HEIGHT=`curl -s $addr/status | jq .result[1].latest_block_height`
done
echo "Node $i is connected to all peers and at block $BLOCK_HEIGHT"
done
echo ""
echo "PASS"
echo ""
-5
View File
@@ -1,5 +0,0 @@
#! /bin/bash
# clean everything
docker rm -vf $(docker ps -aq)
docker network rm local_testnet
-19
View File
@@ -1,19 +0,0 @@
#! /bin/bash
set -eu
DOCKER_IMAGE=$1
NETWORK_NAME=$2
ID=$3
CMD=$4
NAME=test_container_$ID
echo "starting test client container with CMD=$CMD"
# run the test container on the local network
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") \
--name "$NAME" \
--entrypoint bash \
"$DOCKER_IMAGE" $CMD
-9
View File
@@ -1,9 +0,0 @@
#! /bin/bash
# This is a sample bash script for a ABCI application
cd app/
git clone https://github.com/tendermint/nomnomcoin.git
cd nomnomcoin
npm install .
node app.js --eyes="unix:///data/tendermint/data/data.sock"
-53
View File
@@ -1,53 +0,0 @@
{
"id": "",
"val_set_id": "anon",
"validators": [
{
"validator": {
"id": "mach1",
"pub_key": {
"type": "ed25519",
"data": "BE8933DFF1600C026E34718F1785A4CDEAB90C35698B394E38B6947AE91DE116"
}
},
"p2p_addr": "",
"rpc_addr": ""
},
{
"validator": {
"id": "mach2",
"pub_key": {
"type": "ed25519",
"data": "6DC534465323126587D2A2A93B59D689B717073B1DE968A25A6EF13D595318AD"
}
},
"p2p_addr": "",
"rpc_addr": "",
"index": 1
},
{
"validator": {
"id": "mach3",
"pub_key": {
"type": "ed25519",
"data": "AE67AC697D135AA0B4601EA57EAAB3FEBF4BAA4F229C45A598C2985B12FCD1A1"
}
},
"p2p_addr": "",
"rpc_addr": "",
"index": 2
},
{
"validator": {
"id": "mach4",
"pub_key": {
"type": "ed25519",
"data": "9EBC8F58CED4B46DCD5AB8ABA591DD253CD7CB5037273FDA32BC0B6461C4EFD9"
}
},
"p2p_addr": "",
"rpc_addr": "",
"index": 3
}
]
}
-20
View File
@@ -1,20 +0,0 @@
#! /bin/bash
# This is a sample bash script for tendermint core
# Edit this script before "mintnet start" to change
# the core blockchain engine.
TMREPO="github.com/tendermint/tendermint"
BRANCH="master"
go get -d $TMREPO/cmd/tendermint
### DEPENDENCIES (example)
# cd $GOPATH/src/github.com/tendermint/abci
# git fetch origin $BRANCH
# git checkout $BRANCH
### DEPENDENCIES END
cd $GOPATH/src/$TMREPO
git fetch origin $BRANCH
git checkout $BRANCH
make install
tendermint node --seeds="$TMSEEDS" --moniker="$TMNAME" --proxy_app="$PROXYAPP"
-7
View File
@@ -1,7 +0,0 @@
#! /bin/bash
# This is a sample bash script for MerkleEyes.
# NOTE: mintnet expects data.sock to be created
go get github.com/tendermint/merkleeyes/cmd/merkleeyes
merkleeyes server --address="unix:///data/tendermint/data/data.sock"
-39
View File
@@ -1,39 +0,0 @@
{
"app_hash": "",
"chain_id": "chain-9ujDWI",
"genesis_time": "2016-06-24T20:01:19.322Z",
"validators": [
{
"amount": 1,
"name": "mach1",
"pub_key": {
"type": "ed25519",
"data": "BE8933DFF1600C026E34718F1785A4CDEAB90C35698B394E38B6947AE91DE116"
}
},
{
"amount": 1,
"name": "mach2",
"pub_key": {
"type": "ed25519",
"data": "6DC534465323126587D2A2A93B59D689B717073B1DE968A25A6EF13D595318AD"
}
},
{
"amount": 1,
"name": "mach3",
"pub_key": {
"type": "ed25519",
"data": "AE67AC697D135AA0B4601EA57EAAB3FEBF4BAA4F229C45A598C2985B12FCD1A1"
}
},
{
"amount": 1,
"name": "mach4",
"pub_key": {
"type": "ed25519",
"data": "9EBC8F58CED4B46DCD5AB8ABA591DD253CD7CB5037273FDA32BC0B6461C4EFD9"
}
}
]
}
@@ -1,14 +0,0 @@
{
"address": "0E6925C3EE4C599DFF1536A5071AF4A26DF33635",
"last_height": 0,
"last_round": 0,
"last_step": 0,
"priv_key": {
"type": "ed25519",
"data": "547AA07C7A8CE16C5CB2A40C6C26D15B0A32960410A9F1EA6E50B636F1AB389ABE8933DFF1600C026E34718F1785A4CDEAB90C35698B394E38B6947AE91DE116"
},
"pub_key": {
"type": "ed25519",
"data": "BE8933DFF1600C026E34718F1785A4CDEAB90C35698B394E38B6947AE91DE116"
}
}
-39
View File
@@ -1,39 +0,0 @@
{
"app_hash": "",
"chain_id": "chain-9ujDWI",
"genesis_time": "2016-06-24T20:01:19.322Z",
"validators": [
{
"amount": 1,
"name": "mach1",
"pub_key": {
"type": "ed25519",
"data": "BE8933DFF1600C026E34718F1785A4CDEAB90C35698B394E38B6947AE91DE116"
}
},
{
"amount": 1,
"name": "mach2",
"pub_key": {
"type": "ed25519",
"data": "6DC534465323126587D2A2A93B59D689B717073B1DE968A25A6EF13D595318AD"
}
},
{
"amount": 1,
"name": "mach3",
"pub_key": {
"type": "ed25519",
"data": "AE67AC697D135AA0B4601EA57EAAB3FEBF4BAA4F229C45A598C2985B12FCD1A1"
}
},
{
"amount": 1,
"name": "mach4",
"pub_key": {
"type": "ed25519",
"data": "9EBC8F58CED4B46DCD5AB8ABA591DD253CD7CB5037273FDA32BC0B6461C4EFD9"
}
}
]
}
@@ -1,14 +0,0 @@
{
"address": "99DBBD2AFC28FB5BAC5574AFAF0D9C806CED3B55",
"last_height": 0,
"last_round": 0,
"last_step": 0,
"priv_key": {
"type": "ed25519",
"data": "D047889E60502FC3129D0AB7F334B1838ED9ED1ECD99CBB96B71AD5ABF5A81436DC534465323126587D2A2A93B59D689B717073B1DE968A25A6EF13D595318AD"
},
"pub_key": {
"type": "ed25519",
"data": "6DC534465323126587D2A2A93B59D689B717073B1DE968A25A6EF13D595318AD"
}
}
-39
View File
@@ -1,39 +0,0 @@
{
"app_hash": "",
"chain_id": "chain-9ujDWI",
"genesis_time": "2016-06-24T20:01:19.322Z",
"validators": [
{
"amount": 1,
"name": "mach1",
"pub_key": {
"type": "ed25519",
"data": "BE8933DFF1600C026E34718F1785A4CDEAB90C35698B394E38B6947AE91DE116"
}
},
{
"amount": 1,
"name": "mach2",
"pub_key": {
"type": "ed25519",
"data": "6DC534465323126587D2A2A93B59D689B717073B1DE968A25A6EF13D595318AD"
}
},
{
"amount": 1,
"name": "mach3",
"pub_key": {
"type": "ed25519",
"data": "AE67AC697D135AA0B4601EA57EAAB3FEBF4BAA4F229C45A598C2985B12FCD1A1"
}
},
{
"amount": 1,
"name": "mach4",
"pub_key": {
"type": "ed25519",
"data": "9EBC8F58CED4B46DCD5AB8ABA591DD253CD7CB5037273FDA32BC0B6461C4EFD9"
}
}
]
}
@@ -1,14 +0,0 @@
{
"address": "4C5F061DAC28660853904A66705B12CA2B317572",
"last_height": 0,
"last_round": 0,
"last_step": 0,
"priv_key": {
"type": "ed25519",
"data": "C1A4E47F349FC5F556F4A9A27BA776B94424C312BAA6CF6EE44B867348D7C3F2AE67AC697D135AA0B4601EA57EAAB3FEBF4BAA4F229C45A598C2985B12FCD1A1"
},
"pub_key": {
"type": "ed25519",
"data": "AE67AC697D135AA0B4601EA57EAAB3FEBF4BAA4F229C45A598C2985B12FCD1A1"
}
}
-39
View File
@@ -1,39 +0,0 @@
{
"app_hash": "",
"chain_id": "chain-9ujDWI",
"genesis_time": "2016-06-24T20:01:19.322Z",
"validators": [
{
"amount": 1,
"name": "mach1",
"pub_key": {
"type": "ed25519",
"data": "BE8933DFF1600C026E34718F1785A4CDEAB90C35698B394E38B6947AE91DE116"
}
},
{
"amount": 1,
"name": "mach2",
"pub_key": {
"type": "ed25519",
"data": "6DC534465323126587D2A2A93B59D689B717073B1DE968A25A6EF13D595318AD"
}
},
{
"amount": 1,
"name": "mach3",
"pub_key": {
"type": "ed25519",
"data": "AE67AC697D135AA0B4601EA57EAAB3FEBF4BAA4F229C45A598C2985B12FCD1A1"
}
},
{
"amount": 1,
"name": "mach4",
"pub_key": {
"type": "ed25519",
"data": "9EBC8F58CED4B46DCD5AB8ABA591DD253CD7CB5037273FDA32BC0B6461C4EFD9"
}
}
]
}
@@ -1,14 +0,0 @@
{
"address": "86F6DA4B34F16D743D2D992B5ACB12F5E724CC2D",
"last_height": 0,
"last_round": 0,
"last_step": 0,
"priv_key": {
"type": "ed25519",
"data": "C4CC3ED28F020C2DBDA98BCDBF08C3CED370470E74F25E938D5D295E8E3D2B0C9EBC8F58CED4B46DCD5AB8ABA591DD253CD7CB5037273FDA32BC0B6461C4EFD9"
},
"pub_key": {
"type": "ed25519",
"data": "9EBC8F58CED4B46DCD5AB8ABA591DD253CD7CB5037273FDA32BC0B6461C4EFD9"
}
}
-43
View File
@@ -1,43 +0,0 @@
#! /bin/bash
set -eu
set -o pipefail
ID=$1
###########################################
#
# Wait for peer to catchup to other peers
#
###########################################
addr=$(test/p2p/ip.sh $ID):46657
peerID=$(( $(($ID % 4)) + 1 )) # 1->2 ... 3->4 ... 4->1
peer_addr=$(test/p2p/ip.sh $peerID):46657
# get another peer's height
h1=`curl -s $peer_addr/status | jq .result[1].latest_block_height`
# get another peer's state
root1=`curl -s $peer_addr/status | jq .result[1].latest_app_hash`
echo "Other peer is on height $h1 with state $root1"
echo "Waiting for peer $ID to catch up"
# wait for it to sync to past its previous height
set +e
set +o pipefail
h2="0"
while [[ "$h2" -lt "$(($h1+3))" ]]; do
sleep 1
h2=`curl -s $addr/status | jq .result[1].latest_block_height`
echo "... $h2"
done
# check the app hash
root2=`curl -s $addr/status | jq .result[1].latest_app_hash`
if [[ "$root1" != "$root2" ]]; then
echo "App hash after fast sync does not match. Got $root2; expected $root1"
exit 1
fi
echo "... fast sync successful"
-16
View File
@@ -1,16 +0,0 @@
#! /bin/bash
set -eu
DOCKER_IMAGE=$1
NETWORK_NAME=$2
N=$3
PROXY_APP=$4
cd $GOPATH/src/github.com/tendermint/tendermint
# run it on each of them
for i in `seq 1 $N`; do
bash test/p2p/fast_sync/test_peer.sh $DOCKER_IMAGE $NETWORK_NAME $i $N $PROXY_APP
done
-38
View File
@@ -1,38 +0,0 @@
#! /bin/bash
set -eu
DOCKER_IMAGE=$1
NETWORK_NAME=$2
ID=$3
N=$4
PROXY_APP=$5
###############################################################
# this runs on each peer:
# kill peer
# bring it back online via fast sync
# wait for it to sync and check the app hash
###############################################################
echo "Testing fastsync on node $ID"
# kill peer
set +e # circle sigh :(
docker rm -vf local_testnet_$ID
set -e
# restart peer - should have an empty blockchain
SEEDS="$(test/p2p/ip.sh 1):46656"
for j in `seq 2 $N`; do
SEEDS="$SEEDS,$(test/p2p/ip.sh $j):46656"
done
bash test/p2p/peer.sh $DOCKER_IMAGE $NETWORK_NAME $ID $PROXY_APP "--seeds $SEEDS --pex"
# wait for peer to sync and check the app hash
bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME fs_$ID "test/p2p/fast_sync/check_peer.sh $ID"
echo ""
echo "PASS"
echo ""
-7
View File
@@ -1,7 +0,0 @@
#! /bin/bash
set -eu
ID=$1
echo "172.57.0.$((100+$ID))"
-49
View File
@@ -1,49 +0,0 @@
#! /bin/bash
set -eu
NUM_OF_PEERS=$1
# how many attempts for each peer to catch up by height
MAX_ATTEMPTS_TO_CATCH_UP=20
echo "Waiting for nodes to come online"
set +e
for i in $(seq 1 "$NUM_OF_PEERS"); do
addr=$(test/p2p/ip.sh "$i"):46657
curl -s "$addr/status" > /dev/null
ERR=$?
while [ "$ERR" != 0 ]; do
sleep 1
curl -s "$addr/status" > /dev/null
ERR=$?
done
echo "... node $i is up"
done
set -e
# get the first peer's height
addr=$(test/p2p/ip.sh 1):46657
h1=$(curl -s "$addr/status" | jq .result[1].latest_block_height)
echo "1st peer is on height $h1"
echo "Waiting until other peers reporting a height higher than the 1st one"
for i in $(seq 2 "$NUM_OF_PEERS"); do
attempt=1
hi=0
while [[ $hi -le $h1 ]] ; do
addr=$(test/p2p/ip.sh "$i"):46657
hi=$(curl -s "$addr/status" | jq .result[1].latest_block_height)
echo "... peer $i is on height $hi"
((attempt++))
if [ "$attempt" -ge $MAX_ATTEMPTS_TO_CATCH_UP ] ; then
echo "$attempt unsuccessful attempts were made to catch up"
curl -s "$addr/dump_consensus_state" | jq .result[1]
exit 1
fi
sleep 1
done
done
-32
View File
@@ -1,32 +0,0 @@
#! /bin/bash
set -eu
DOCKER_IMAGE=$1
NETWORK_NAME=$2
NUM_OF_PEERS=$3
NUM_OF_CRASHES=$4
cd "$GOPATH/src/github.com/tendermint/tendermint"
###############################################################
# NUM_OF_CRASHES times:
# restart all peers
# wait for them to sync and check that they are making progress
###############################################################
for i in $(seq 1 "$NUM_OF_CRASHES"); do
echo ""
echo "Restarting all peers! Take $i ..."
# restart all peers
for j in $(seq 1 "$NUM_OF_PEERS"); do
docker stop "local_testnet_$j"
docker start "local_testnet_$j"
done
bash test/p2p/client.sh "$DOCKER_IMAGE" "$NETWORK_NAME" kill_all_$i "test/p2p/kill_all/check_peers.sh $NUM_OF_PEERS"
done
echo ""
echo "PASS"
echo ""
-24
View File
@@ -1,24 +0,0 @@
#! /bin/bash
set -eu
DOCKER_IMAGE=$1
NETWORK_NAME=$2
N=$3
APP_PROXY=$4
set +u
SEEDS=$5
if [[ "$SEEDS" != "" ]]; then
echo "Seeds: $SEEDS"
SEEDS="--seeds $SEEDS"
fi
set -u
cd "$GOPATH/src/github.com/tendermint/tendermint"
# create docker network
docker network create --driver bridge --subnet 172.57.0.0/16 "$NETWORK_NAME"
for i in $(seq 1 "$N"); do
bash test/p2p/peer.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$i" "$APP_PROXY" "$SEEDS --pex"
done
-12
View File
@@ -1,12 +0,0 @@
#! /bin/bash
set -u
NETWORK_NAME=$1
N=$2
for i in $(seq 1 "$N"); do
docker stop "local_testnet_$i"
docker rm -vf "local_testnet_$i"
done
docker network rm "$NETWORK_NAME"
-40
View File
@@ -1,40 +0,0 @@
#! /bin/bash
set -eu
DOCKER_IMAGE=$1
NETWORK_NAME=$2
ID=$3
APP_PROXY=$4
set +u
NODE_FLAGS=$5
set -u
set +eu
echo "starting tendermint peer ID=$ID"
# start tendermint container on the network
if [[ "$CIRCLECI" == true ]]; then
set -u
docker run -d \
--net="$NETWORK_NAME" \
--ip=$(test/p2p/ip.sh $ID) \
--name "local_testnet_$ID" \
--entrypoint tendermint \
-e TMHOME="/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$ID/core" \
--log-driver=syslog \
--log-opt syslog-address=udp://127.0.0.1:5514 \
--log-opt syslog-facility=daemon \
--log-opt tag="{{.Name}}" \
"$DOCKER_IMAGE" node $NODE_FLAGS --log_level=debug --proxy_app="$APP_PROXY"
else
set -u
docker run -d \
--net="$NETWORK_NAME" \
--ip=$(test/p2p/ip.sh $ID) \
--name "local_testnet_$ID" \
--entrypoint tendermint \
-e TMHOME="/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$ID/core" \
"$DOCKER_IMAGE" node $NODE_FLAGS --log_level=info --proxy_app="$APP_PROXY"
fi
-17
View File
@@ -1,17 +0,0 @@
#! /bin/bash
set -u
ID=$1
N=$2
addr=$(test/p2p/ip.sh "$ID"):46657
echo "2. wait until peer $ID connects to other nodes using pex reactor"
peers_count="0"
while [[ "$peers_count" -lt "$((N-1))" ]]; do
sleep 1
peers_count=$(curl -s "$addr/net_info" | jq ".result[1].peers | length")
echo "... peers count = $peers_count, expected = $((N-1))"
done
echo "... successful"
-31
View File
@@ -1,31 +0,0 @@
#! /bin/bash
set -u
N=$1
cd $GOPATH/src/github.com/tendermint/tendermint
echo "Waiting for nodes to come online"
for i in `seq 1 $N`; do
addr=$(test/p2p/ip.sh $i):46657
curl -s $addr/status > /dev/null
ERR=$?
while [ "$ERR" != 0 ]; do
sleep 1
curl -s $addr/status > /dev/null
ERR=$?
done
echo "... node $i is up"
done
set -e
# seeds need quotes
seeds="\"$(test/p2p/ip.sh 1):46656\""
for i in `seq 2 $N`; do
seeds="$seeds,\"$(test/p2p/ip.sh $i):46656\""
done
echo $seeds
echo $seeds
IP=$(test/p2p/ip.sh 1)
curl --data-urlencode "seeds=[$seeds]" "$IP:46657/dial_seeds"
-15
View File
@@ -1,15 +0,0 @@
#! /bin/bash
set -eu
DOCKER_IMAGE=$1
NETWORK_NAME=$2
N=$3
PROXY_APP=$4
cd $GOPATH/src/github.com/tendermint/tendermint
echo "Test reconnecting from the address book"
bash test/p2p/pex/test_addrbook.sh $DOCKER_IMAGE $NETWORK_NAME $N $PROXY_APP
echo "Test connecting via /dial_seeds"
bash test/p2p/pex/test_dial_seeds.sh $DOCKER_IMAGE $NETWORK_NAME $N $PROXY_APP
-57
View File
@@ -1,57 +0,0 @@
#! /bin/bash
set -eu
DOCKER_IMAGE=$1
NETWORK_NAME=$2
N=$3
PROXY_APP=$4
ID=1
echo "----------------------------------------------------------------------"
echo "Testing pex creates the addrbook and uses it if seeds are not provided"
echo "(assuming peers are started with pex enabled)"
CLIENT_NAME="pex_addrbook_$ID"
echo "1. restart peer $ID"
docker stop "local_testnet_$ID"
# preserve addrbook.json
docker cp "local_testnet_$ID:/go/src/github.com/tendermint/tendermint/test/p2p/data/mach1/core/addrbook.json" "/tmp/addrbook.json"
set +e #CIRCLE
docker rm -vf "local_testnet_$ID"
set -e
# NOTE that we do not provide seeds
bash test/p2p/peer.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$ID" "$PROXY_APP" "--pex"
docker cp "/tmp/addrbook.json" "local_testnet_$ID:/go/src/github.com/tendermint/tendermint/test/p2p/data/mach1/core/addrbook.json"
echo "with the following addrbook:"
cat /tmp/addrbook.json
# exec doesn't work on circle
# docker exec "local_testnet_$ID" cat "/go/src/github.com/tendermint/tendermint/test/p2p/data/mach1/core/addrbook.json"
echo ""
# if the client runs forever, it means addrbook wasn't saved or was empty
bash test/p2p/client.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$CLIENT_NAME" "test/p2p/pex/check_peer.sh $ID $N"
echo "----------------------------------------------------------------------"
echo "Testing other peers connect to us if we have neither seeds nor the addrbook"
echo "(assuming peers are started with pex enabled)"
CLIENT_NAME="pex_no_addrbook_$ID"
echo "1. restart peer $ID"
docker stop "local_testnet_$ID"
set +e #CIRCLE
docker rm -vf "local_testnet_$ID"
set -e
# NOTE that we do not provide seeds
bash test/p2p/peer.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$ID" "$PROXY_APP" "--pex"
# if the client runs forever, it means other peers have removed us from their books (which should not happen)
bash test/p2p/client.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$CLIENT_NAME" "test/p2p/pex/check_peer.sh $ID $N"
echo ""
echo "PASS"
echo ""
-36
View File
@@ -1,36 +0,0 @@
#! /bin/bash
set -eu
DOCKER_IMAGE=$1
NETWORK_NAME=$2
N=$3
PROXY_APP=$4
ID=1
cd $GOPATH/src/github.com/tendermint/tendermint
echo "----------------------------------------------------------------------"
echo "Testing full network connection using one /dial_seeds call"
echo "(assuming peers are started with pex enabled)"
# 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
# NOTE we re-use the same network for all tests
SEEDS=""
bash test/p2p/local_testnet_start.sh $DOCKER_IMAGE $NETWORK_NAME $N $PROXY_APP $SEEDS
# dial seeds from one node
CLIENT_NAME="dial_seeds"
bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME $CLIENT_NAME "test/p2p/pex/dial_seeds.sh $N"
# test basic connectivity and consensus
# start client container and check the num peers and height for all nodes
CLIENT_NAME="dial_seeds_basic"
bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME $CLIENT_NAME "test/p2p/basic/test.sh $N"
-12
View File
@@ -1,12 +0,0 @@
#! /bin/bash
set -eu
N=$1
cd "$GOPATH/src/github.com/tendermint/tendermint"
seeds="$(test/p2p/ip.sh 1):46656"
for i in $(seq 2 $N); do
seeds="$seeds,$(test/p2p/ip.sh $i):46656"
done
echo "$seeds"
-38
View File
@@ -1,38 +0,0 @@
#! /bin/bash
set -eu
DOCKER_IMAGE=$1
NETWORK_NAME=local_testnet
N=4
PROXY_APP=persistent_dummy
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
SEEDS=$(bash test/p2p/seeds.sh $N)
# start the testnet on a local network
# NOTE we re-use the same network for all tests
bash test/p2p/local_testnet_start.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$N" "$PROXY_APP" "$SEEDS"
# test basic connectivity and consensus
# start client container and check the num peers and height for all nodes
bash test/p2p/client.sh "$DOCKER_IMAGE" "$NETWORK_NAME" basic "test/p2p/basic/test.sh $N"
# test atomic broadcast:
# start client container and test sending a tx to each node
bash test/p2p/client.sh "$DOCKER_IMAGE" "$NETWORK_NAME" ab "test/p2p/atomic_broadcast/test.sh $N"
# test fast sync (from current state of network):
# for each node, kill it and readd via fast sync
bash test/p2p/fast_sync/test.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$N" "$PROXY_APP"
# test killing all peers 3 times
bash test/p2p/kill_all/test.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$N" 3
# test pex
bash test/p2p/pex/test.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$N" "$PROXY_APP"