mirror of
https://github.com/fluencelabs/tendermint
synced 2025-05-19 18:01:18 +00:00
test/p2p: add some timeouts
This commit is contained in:
parent
992371b4cf
commit
abfdfe67e8
@ -10,16 +10,25 @@ N=$1
|
|||||||
# wait to be at height > 1
|
# wait to be at height > 1
|
||||||
###################################################################
|
###################################################################
|
||||||
|
|
||||||
|
# wait 60s per step per peer
|
||||||
|
MAX_SLEEP=60
|
||||||
|
|
||||||
# wait for everyone to come online
|
# wait for everyone to come online
|
||||||
echo "Waiting for nodes to come online"
|
echo "Waiting for nodes to come online"
|
||||||
for i in `seq 1 $N`; do
|
for i in `seq 1 $N`; do
|
||||||
addr=$(test/p2p/ip.sh $i):46657
|
addr=$(test/p2p/ip.sh $i):46657
|
||||||
curl -s $addr/status > /dev/null
|
curl -s $addr/status > /dev/null
|
||||||
ERR=$?
|
ERR=$?
|
||||||
|
COUNT=0
|
||||||
while [ "$ERR" != 0 ]; do
|
while [ "$ERR" != 0 ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
curl -s $addr/status > /dev/null
|
curl -s $addr/status > /dev/null
|
||||||
ERR=$?
|
ERR=$?
|
||||||
|
COUNT=$((COUNT+1))
|
||||||
|
if [ "$COUNT" -gt "$MAX_SLEEP" ]; then
|
||||||
|
echo "Waited too long for node $i to come online"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
echo "... node $i is up"
|
echo "... node $i is up"
|
||||||
done
|
done
|
||||||
@ -32,18 +41,30 @@ for i in `seq 1 $N`; do
|
|||||||
|
|
||||||
# - assert everyone has N-1 other peers
|
# - assert everyone has N-1 other peers
|
||||||
N_PEERS=`curl -s $addr/net_info | jq '.result.peers | length'`
|
N_PEERS=`curl -s $addr/net_info | jq '.result.peers | length'`
|
||||||
|
COUNT=0
|
||||||
while [ "$N_PEERS" != $N_1 ]; do
|
while [ "$N_PEERS" != $N_1 ]; do
|
||||||
echo "Waiting for node $i to connect to all peers ..."
|
echo "Waiting for node $i to connect to all peers ..."
|
||||||
sleep 1
|
sleep 1
|
||||||
N_PEERS=`curl -s $addr/net_info | jq '.result.peers | length'`
|
N_PEERS=`curl -s $addr/net_info | jq '.result.peers | length'`
|
||||||
|
COUNT=$((COUNT+1))
|
||||||
|
if [ "$COUNT" -gt "$MAX_SLEEP" ]; then
|
||||||
|
echo "Waited too long for node $i to connect to all peers"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# - assert block height is greater than 1
|
# - assert block height is greater than 1
|
||||||
BLOCK_HEIGHT=`curl -s $addr/status | jq .result.latest_block_height`
|
BLOCK_HEIGHT=`curl -s $addr/status | jq .result.latest_block_height`
|
||||||
|
COUNT=0
|
||||||
while [ "$BLOCK_HEIGHT" -le 1 ]; do
|
while [ "$BLOCK_HEIGHT" -le 1 ]; do
|
||||||
echo "Waiting for node $i to commit a block ..."
|
echo "Waiting for node $i to commit a block ..."
|
||||||
sleep 1
|
sleep 1
|
||||||
BLOCK_HEIGHT=`curl -s $addr/status | jq .result.latest_block_height`
|
BLOCK_HEIGHT=`curl -s $addr/status | jq .result.latest_block_height`
|
||||||
|
COUNT=$((COUNT+1))
|
||||||
|
if [ "$COUNT" -gt "$MAX_SLEEP" ]; then
|
||||||
|
echo "Waited too long for node $i to commit a block"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
echo "Node $i is connected to all peers and at block $BLOCK_HEIGHT"
|
echo "Node $i is connected to all peers and at block $BLOCK_HEIGHT"
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user