Browse Source

fix bash linter warnings for atomic_broadcast integration test

pull/834/head
Anton Kaliaev 7 years ago
parent
commit
533f7c45eb
No known key found for this signature in database GPG Key ID: 7B6881D965918214
1 changed files with 12 additions and 12 deletions
  1. +12
    -12
      test/p2p/atomic_broadcast/test.sh

+ 12
- 12
test/p2p/atomic_broadcast/test.sh View File

@ -13,39 +13,39 @@ N=$1
echo "" echo ""
# run the test on each of them # run the test on each of them
for i in `seq 1 $N`; do
addr=$(test/p2p/ip.sh $i):46657
for i in $(seq 1 "$N"); do
addr=$(test/p2p/ip.sh "$i"):46657
# current state # current state
HASH1=`curl -s $addr/status | jq .result.latest_app_hash`
HASH1=$(curl -s "$addr/status" | jq .result.latest_app_hash)
# - send a tx # - send a tx
TX=aadeadbeefbeefbeef0$i TX=aadeadbeefbeefbeef0$i
echo "Broadcast Tx $TX" echo "Broadcast Tx $TX"
curl -s $addr/broadcast_tx_commit?tx=0x$TX
curl -s "$addr/broadcast_tx_commit?tx=0x$TX"
echo "" echo ""
# we need to wait another block to get the new app_hash # we need to wait another block to get the new app_hash
h1=`curl -s $addr/status | jq .result.latest_block_height`
h1=$(curl -s "$addr/status" | jq .result.latest_block_height)
h2=$h1 h2=$h1
while [ "$h2" == "$h1" ]; do while [ "$h2" == "$h1" ]; do
sleep 1 sleep 1
h2=`curl -s $addr/status | jq .result.latest_block_height`
h2=$(curl -s "$addr/status" | jq .result.latest_block_height)
done done
# check that hash was updated # check that hash was updated
HASH2=`curl -s $addr/status | jq .result.latest_app_hash`
HASH2=$(curl -s "$addr/status" | jq .result.latest_app_hash)
if [[ "$HASH1" == "$HASH2" ]]; then if [[ "$HASH1" == "$HASH2" ]]; then
echo "Expected state hash to update from $HASH1. Got $HASH2" echo "Expected state hash to update from $HASH1. Got $HASH2"
exit 1 exit 1
fi fi
# check we get the same new hash on all other nodes # check we get the same new hash on all other nodes
for j in `seq 1 $N`; do
for j in $(seq 1 "$N"); do
if [[ "$i" != "$j" ]]; then if [[ "$i" != "$j" ]]; then
addrJ=$(test/p2p/ip.sh $j):46657
HASH3=`curl -s $addrJ/status | jq .result.latest_app_hash`
addrJ=$(test/p2p/ip.sh "$j"):46657
HASH3=$(curl -s "$addrJ/status" | jq .result.latest_app_hash)
if [[ "$HASH2" != "$HASH3" ]]; then if [[ "$HASH2" != "$HASH3" ]]; then
echo "App hash for node $j doesn't match. Got $HASH3, expected $HASH2" echo "App hash for node $j doesn't match. Got $HASH3, expected $HASH2"
exit 1 exit 1


Loading…
Cancel
Save