test: jq .result[1] -> jq .result
This commit is contained in:
parent
4e781961e9
commit
aa9e673ed7
|
@ -33,7 +33,7 @@ function sendTx() {
|
|||
ERROR=`echo $RESPONSE | jq .error`
|
||||
ERROR=$(echo "$ERROR" | tr -d '"') # remove surrounding quotes
|
||||
|
||||
RESPONSE=`echo $RESPONSE | jq .result[1]`
|
||||
RESPONSE=`echo $RESPONSE | jq .result`
|
||||
else
|
||||
if [ -f grpc_client ]; then
|
||||
rm grpc_client
|
||||
|
|
|
@ -57,7 +57,7 @@ echo "... testing query with /abci_query 2"
|
|||
|
||||
# we should be able to look up the key
|
||||
RESPONSE=`curl -s "127.0.0.1:46657/abci_query?path=\"\"&data=$(toHex $KEY)&prove=false"`
|
||||
RESPONSE=`echo $RESPONSE | jq .result[1].response.log`
|
||||
RESPONSE=`echo $RESPONSE | jq .result.response.log`
|
||||
|
||||
set +e
|
||||
A=`echo $RESPONSE | grep 'exists'`
|
||||
|
@ -70,7 +70,7 @@ set -e
|
|||
|
||||
# we should not be able to look up the value
|
||||
RESPONSE=`curl -s "127.0.0.1:46657/abci_query?path=\"\"&data=$(toHex $VALUE)&prove=false"`
|
||||
RESPONSE=`echo $RESPONSE | jq .result[1].response.log`
|
||||
RESPONSE=`echo $RESPONSE | jq .result.response.log`
|
||||
set +e
|
||||
A=`echo $RESPONSE | grep 'exists'`
|
||||
if [[ $? == 0 ]]; then
|
||||
|
|
|
@ -17,7 +17,7 @@ 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`
|
||||
HASH1=`curl -s $addr/status | jq .result.latest_app_hash`
|
||||
|
||||
# - send a tx
|
||||
TX=aadeadbeefbeefbeef0$i
|
||||
|
@ -26,15 +26,15 @@ for i in `seq 1 $N`; do
|
|||
echo ""
|
||||
|
||||
# we need to wait another block to get the new app_hash
|
||||
h1=`curl -s $addr/status | jq .result[1].latest_block_height`
|
||||
h1=`curl -s $addr/status | jq .result.latest_block_height`
|
||||
h2=$h1
|
||||
while [ "$h2" == "$h1" ]; do
|
||||
sleep 1
|
||||
h2=`curl -s $addr/status | jq .result[1].latest_block_height`
|
||||
h2=`curl -s $addr/status | jq .result.latest_block_height`
|
||||
done
|
||||
|
||||
# check that hash was updated
|
||||
HASH2=`curl -s $addr/status | jq .result[1].latest_app_hash`
|
||||
HASH2=`curl -s $addr/status | jq .result.latest_app_hash`
|
||||
if [[ "$HASH1" == "$HASH2" ]]; then
|
||||
echo "Expected state hash to update from $HASH1. Got $HASH2"
|
||||
exit 1
|
||||
|
@ -44,7 +44,7 @@ for i in `seq 1 $N`; do
|
|||
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`
|
||||
HASH3=`curl -s $addrJ/status | jq .result.latest_app_hash`
|
||||
|
||||
if [[ "$HASH2" != "$HASH3" ]]; then
|
||||
echo "App hash for node $j doesn't match. Got $HASH3, expected $HASH2"
|
||||
|
|
|
@ -31,19 +31,19 @@ for i in `seq 1 $N`; do
|
|||
N_1=$(($N - 1))
|
||||
|
||||
# - assert everyone has N-1 other peers
|
||||
N_PEERS=`curl -s $addr/net_info | jq '.result[1].peers | length'`
|
||||
N_PEERS=`curl -s $addr/net_info | jq '.result.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'`
|
||||
N_PEERS=`curl -s $addr/net_info | jq '.result.peers | length'`
|
||||
done
|
||||
|
||||
# - assert block height is greater than 1
|
||||
BLOCK_HEIGHT=`curl -s $addr/status | jq .result[1].latest_block_height`
|
||||
BLOCK_HEIGHT=`curl -s $addr/status | jq .result.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`
|
||||
BLOCK_HEIGHT=`curl -s $addr/status | jq .result.latest_block_height`
|
||||
done
|
||||
echo "Node $i is connected to all peers and at block $BLOCK_HEIGHT"
|
||||
done
|
||||
|
|
|
@ -15,10 +15,10 @@ 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`
|
||||
h1=`curl -s $peer_addr/status | jq .result.latest_block_height`
|
||||
|
||||
# get another peer's state
|
||||
root1=`curl -s $peer_addr/status | jq .result[1].latest_app_hash`
|
||||
root1=`curl -s $peer_addr/status | jq .result.latest_app_hash`
|
||||
|
||||
echo "Other peer is on height $h1 with state $root1"
|
||||
echo "Waiting for peer $ID to catch up"
|
||||
|
@ -29,12 +29,12 @@ set +o pipefail
|
|||
h2="0"
|
||||
while [[ "$h2" -lt "$(($h1+3))" ]]; do
|
||||
sleep 1
|
||||
h2=`curl -s $addr/status | jq .result[1].latest_block_height`
|
||||
h2=`curl -s $addr/status | jq .result.latest_block_height`
|
||||
echo "... $h2"
|
||||
done
|
||||
|
||||
# check the app hash
|
||||
root2=`curl -s $addr/status | jq .result[1].latest_app_hash`
|
||||
root2=`curl -s $addr/status | jq .result.latest_app_hash`
|
||||
|
||||
if [[ "$root1" != "$root2" ]]; then
|
||||
echo "App hash after fast sync does not match. Got $root2; expected $root1"
|
||||
|
|
|
@ -23,7 +23,7 @@ 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)
|
||||
h1=$(curl -s "$addr/status" | jq .result.latest_block_height)
|
||||
echo "1st peer is on height $h1"
|
||||
|
||||
echo "Waiting until other peers reporting a height higher than the 1st one"
|
||||
|
@ -33,14 +33,14 @@ for i in $(seq 2 "$NUM_OF_PEERS"); do
|
|||
|
||||
while [[ $hi -le $h1 ]] ; do
|
||||
addr=$(test/p2p/ip.sh "$i"):46657
|
||||
hi=$(curl -s "$addr/status" | jq .result[1].latest_block_height)
|
||||
hi=$(curl -s "$addr/status" | jq .result.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]
|
||||
curl -s "$addr/dump_consensus_state" | jq .result
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ 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")
|
||||
peers_count=$(curl -s "$addr/net_info" | jq ".result.peers | length")
|
||||
echo "... peers count = $peers_count, expected = $((N-1))"
|
||||
done
|
||||
|
||||
|
|
|
@ -107,11 +107,11 @@ for failIndex in $(seq $failsStart $failsEnd); do
|
|||
done
|
||||
|
||||
# wait for a new block
|
||||
h1=$(curl -s --unix-socket "$RPC_ADDR" http://localhost/status | jq .result[1].latest_block_height)
|
||||
h1=$(curl -s --unix-socket "$RPC_ADDR" http://localhost/status | jq .result.latest_block_height)
|
||||
h2=$h1
|
||||
while [ "$h2" == "$h1" ]; do
|
||||
sleep 1
|
||||
h2=$(curl -s --unix-socket "$RPC_ADDR" http://localhost/status | jq .result[1].latest_block_height)
|
||||
h2=$(curl -s --unix-socket "$RPC_ADDR" http://localhost/status | jq .result.latest_block_height)
|
||||
done
|
||||
|
||||
kill_procs
|
||||
|
|
|
@ -57,11 +57,11 @@ while [ "$ERR" != 0 ]; do
|
|||
done
|
||||
|
||||
# wait for a new block
|
||||
h1=`curl -s $addr/status | jq .result[1].latest_block_height`
|
||||
h1=`curl -s $addr/status | jq .result.latest_block_height`
|
||||
h2=$h1
|
||||
while [ "$h2" == "$h1" ]; do
|
||||
sleep 1
|
||||
h2=`curl -s $addr/status | jq .result[1].latest_block_height`
|
||||
h2=`curl -s $addr/status | jq .result.latest_block_height`
|
||||
done
|
||||
|
||||
kill_procs
|
||||
|
|
Loading…
Reference in New Issue