mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-19 22:44:24 +00:00
tests: cleanup and fix scripts
This commit is contained in:
+19
-35
@@ -1,44 +1,28 @@
|
||||
#! /bin/bash
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
###############################################################
|
||||
# for each peer:
|
||||
# kill peer
|
||||
# bring it back online via fast sync
|
||||
# check app hash
|
||||
###############################################################
|
||||
DOCKER_IMAGE=$1
|
||||
NETWORK_NAME=$2
|
||||
COUNT=$3
|
||||
N=$4
|
||||
|
||||
ID=$1
|
||||
echo "Testing fasysync on node $COUNT"
|
||||
|
||||
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
|
||||
# kill peer
|
||||
set +e # circle sigh :(
|
||||
docker rm -vf local_testnet_$COUNT
|
||||
set -e
|
||||
|
||||
# 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"
|
||||
# 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 $COUNT $SEEDS
|
||||
|
||||
# check the app hash
|
||||
root2=`curl -s $addr/status | jq .result[1].latest_app_hash`
|
||||
bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME fs_$COUNT "test/p2p/fast_sync/restart_peer.sh $COUNT"
|
||||
|
||||
echo ""
|
||||
echo "PASS"
|
||||
echo ""
|
||||
|
||||
if [[ "$root1" != "$root2" ]]; then
|
||||
echo "App hash after fast sync does not match. Got $root2; expected $root1"
|
||||
exit 1
|
||||
fi
|
||||
echo "... fast sync successful"
|
||||
|
||||
+1
-19
@@ -16,23 +16,5 @@ bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME ab test/p2p/atomic_broadcast
|
||||
# run it on each of them
|
||||
N=4
|
||||
for i in `seq 1 $N`; do
|
||||
echo "Testing fasysync on node $i"
|
||||
|
||||
# kill peer
|
||||
set +e # circle sigh :(
|
||||
docker rm -vf local_testnet_$i
|
||||
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 $i $SEEDS
|
||||
|
||||
bash test/p2p/client.sh $DOCKER_IMAGE $NETWORK_NAME fs_$i "test/p2p/fast_sync/test.sh $i"
|
||||
bash test/p2p/fast_sync/test.sh $DOCKER_IMAGE $NETWORK_NAME $i $N
|
||||
done
|
||||
echo ""
|
||||
echo "PASS"
|
||||
echo ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user