rename manual peers to persistent peers

This commit is contained in:
Anton Kaliaev
2018-01-09 16:18:05 -06:00
parent 37f86f9518
commit e4897b7bdd
27 changed files with 72 additions and 72 deletions

View File

@ -38,7 +38,7 @@ for i in $(seq 1 4); do
--name local_testnet_$i \
--entrypoint tendermint \
-e TMHOME=/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$i/core \
tendermint_tester node --p2p.manual_peers 172.57.0.101:46656,172.57.0.102:46656,172.57.0.103:46656,172.57.0.104:46656 --proxy_app=dummy
tendermint_tester node --p2p.persistent_peers 172.57.0.101:46656,172.57.0.102:46656,172.57.0.103:46656,172.57.0.104:46656 --proxy_app=dummy
done
```

View File

@ -23,11 +23,11 @@ docker rm -vf local_testnet_$ID
set -e
# restart peer - should have an empty blockchain
MANUAL_PEERS="$(test/p2p/ip.sh 1):46656"
PERSISTENT_PEERS="$(test/p2p/ip.sh 1):46656"
for j in `seq 2 $N`; do
MANUAL_PEERS="$MANUAL_PEERS,$(test/p2p/ip.sh $j):46656"
PERSISTENT_PEERS="$PERSISTENT_PEERS,$(test/p2p/ip.sh $j):46656"
done
bash test/p2p/peer.sh $DOCKER_IMAGE $NETWORK_NAME $ID $PROXY_APP "--p2p.manual_peers $MANUAL_PEERS --p2p.pex --rpc.unsafe"
bash test/p2p/peer.sh $DOCKER_IMAGE $NETWORK_NAME $ID $PROXY_APP "--p2p.persistent_peers $PERSISTENT_PEERS --p2p.pex --rpc.unsafe"
# 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"

View File

@ -7,10 +7,10 @@ N=$3
APP_PROXY=$4
set +u
MANUAL_PEERS=$5
if [[ "$MANUAL_PEERS" != "" ]]; then
echo "ManualPeers: $MANUAL_PEERS"
MANUAL_PEERS="--p2p.manual_peers $MANUAL_PEERS"
PERSISTENT_PEERS=$5
if [[ "$PERSISTENT_PEERS" != "" ]]; then
echo "PersistentPeers: $PERSISTENT_PEERS"
PERSISTENT_PEERS="--p2p.persistent_peers $PERSISTENT_PEERS"
fi
set -u
@ -20,5 +20,5 @@ cd "$GOPATH/src/github.com/tendermint/tendermint"
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" "$MANUAL_PEERS --p2p.pex --rpc.unsafe"
bash test/p2p/peer.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$i" "$APP_PROXY" "$PERSISTENT_PEERS --p2p.pex --rpc.unsafe"
done

View File

@ -5,8 +5,8 @@ N=$1
cd "$GOPATH/src/github.com/tendermint/tendermint"
manual_peers="$(test/p2p/ip.sh 1):46656"
persistent_peers="$(test/p2p/ip.sh 1):46656"
for i in $(seq 2 $N); do
manual_peers="$manual_peers,$(test/p2p/ip.sh $i):46656"
persistent_peers="$persistent_peers,$(test/p2p/ip.sh $i):46656"
done
echo "$manual_peers"
echo "$persistent_peers"

View File

@ -1,4 +1,4 @@
#! /bin/bash
#! /bin/bash
set -u
N=$1
@ -11,7 +11,7 @@ for i in `seq 1 $N`; do
curl -s $addr/status > /dev/null
ERR=$?
while [ "$ERR" != 0 ]; do
sleep 1
sleep 1
curl -s $addr/status > /dev/null
ERR=$?
done
@ -19,13 +19,13 @@ for i in `seq 1 $N`; do
done
set -e
# manual_peers need quotes
manual_peers="\"$(test/p2p/ip.sh 1):46656\""
# persistent_peers need quotes
persistent_peers="\"$(test/p2p/ip.sh 1):46656\""
for i in `seq 2 $N`; do
manual_peers="$manual_peers,\"$(test/p2p/ip.sh $i):46656\""
persistent_peers="$persistent_peers,\"$(test/p2p/ip.sh $i):46656\""
done
echo $manual_peers
echo $persistent_peers
echo $manual_peers
echo $persistent_peers
IP=$(test/p2p/ip.sh 1)
curl --data-urlencode "manual_peers=[$manual_peers]" "$IP:46657/dial_manual_peers"
curl --data-urlencode "persistent_peers=[$persistent_peers]" "$IP:46657/dial_persistent_peers"

View File

@ -11,5 +11,5 @@ 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_manual_peers"
bash test/p2p/pex/test_dial_manual_peers.sh $DOCKER_IMAGE $NETWORK_NAME $N $PROXY_APP
echo "Test connecting via /dial_persistent_peers"
bash test/p2p/pex/test_dial_persistent_peers.sh $DOCKER_IMAGE $NETWORK_NAME $N $PROXY_APP

View File

@ -9,7 +9,7 @@ PROXY_APP=$4
ID=1
echo "----------------------------------------------------------------------"
echo "Testing pex creates the addrbook and uses it if manual_peers are not provided"
echo "Testing pex creates the addrbook and uses it if persistent_peers are not provided"
echo "(assuming peers are started with pex enabled)"
CLIENT_NAME="pex_addrbook_$ID"
@ -22,7 +22,7 @@ set +e #CIRCLE
docker rm -vf "local_testnet_$ID"
set -e
# NOTE that we do not provide manual_peers
# NOTE that we do not provide persistent_peers
bash test/p2p/peer.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$ID" "$PROXY_APP" "--p2p.pex --rpc.unsafe"
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:"
@ -35,7 +35,7 @@ echo ""
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 manual_peers nor the addrbook"
echo "Testing other peers connect to us if we have neither persistent_peers nor the addrbook"
echo "(assuming peers are started with pex enabled)"
CLIENT_NAME="pex_no_addrbook_$ID"
@ -46,7 +46,7 @@ set +e #CIRCLE
docker rm -vf "local_testnet_$ID"
set -e
# NOTE that we do not provide manual_peers
# NOTE that we do not provide persistent_peers
bash test/p2p/peer.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$ID" "$PROXY_APP" "--p2p.pex --rpc.unsafe"
# if the client runs forever, it means other peers have removed us from their books (which should not happen)

View File

@ -11,7 +11,7 @@ ID=1
cd $GOPATH/src/github.com/tendermint/tendermint
echo "----------------------------------------------------------------------"
echo "Testing full network connection using one /dial_manual_peers call"
echo "Testing full network connection using one /dial_persistent_peers call"
echo "(assuming peers are started with pex enabled)"
# stop the existing testnet and remove local network
@ -21,16 +21,16 @@ set -e
# start the testnet on a local network
# NOTE we re-use the same network for all tests
MANUAL_PEERS=""
bash test/p2p/local_testnet_start.sh $DOCKER_IMAGE $NETWORK_NAME $N $PROXY_APP $MANUAL_PEERS
PERSISTENT_PEERS=""
bash test/p2p/local_testnet_start.sh $DOCKER_IMAGE $NETWORK_NAME $N $PROXY_APP $PERSISTENT_PEERS
# dial manual_peers from one node
CLIENT_NAME="dial_manual_peers"
bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME $CLIENT_NAME "test/p2p/pex/dial_manual_peers.sh $N"
# dial persistent_peers from one node
CLIENT_NAME="dial_persistent_peers"
bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME $CLIENT_NAME "test/p2p/pex/dial_persistent_peers.sh $N"
# test basic connectivity and consensus
# start client container and check the num peers and height for all nodes
CLIENT_NAME="dial_manual_peers_basic"
CLIENT_NAME="dial_persistent_peers_basic"
bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME $CLIENT_NAME "test/p2p/basic/test.sh $N"

View File

@ -13,11 +13,11 @@ set +e
bash test/p2p/local_testnet_stop.sh "$NETWORK_NAME" "$N"
set -e
MANUAL_PEERS=$(bash test/p2p/manual_peers.sh $N)
PERSISTENT_PEERS=$(bash test/p2p/persistent_peers.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" "$MANUAL_PEERS"
bash test/p2p/local_testnet_start.sh "$DOCKER_IMAGE" "$NETWORK_NAME" "$N" "$PROXY_APP" "$PERSISTENT_PEERS"
# test basic connectivity and consensus
# start client container and check the num peers and height for all nodes