1417 status response format (#1424)

* Reformated the ResultStatus

* fix misuse of ResultStatus.

* updated changelog

* Fixed tests

* fixed rpc helper tests

* fixed rpc_tests

* fixed mock/status_test

* fixed typo

* fixed ommitempty on validatorstatus and the changelog

* fixed extra line in changelog

* Updated usage of the /status json response in tests after breaking changes

* Updated remaining tests with changes after searching the codebase for usage

* Reformated the ResultStatus

* fix misuse of ResultStatus.

* updated changelog

* Fixed tests

* fixed rpc helper tests

* fixed rpc_tests

* fixed mock/status_test

* fixed typo

* fixed ommitempty on validatorstatus and the changelog

* Updated usage of the /status json response in tests after breaking changes

* Updated remaining tests with changes after searching the codebase for usage

* rebased against develop
This commit is contained in:
Bric3d
2018-04-11 10:38:34 +02:00
committed by Anton Kaliaev
parent 7c22e47629
commit 64879c1e6a
16 changed files with 91 additions and 77 deletions
+7 -7
View File
@@ -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.latest_app_hash)
HASH1=$(curl -s "$addr/status" | jq .result.sync_info.latest_app_hash)
# - send a tx
TX=aadeadbeefbeefbeef0$i
@@ -26,11 +26,11 @@ 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.latest_block_height)
h1=$(curl -s "$addr/status" | jq .result.sync_info.latest_block_height)
h2=$h1
while [ "$h2" == "$h1" ]; do
sleep 1
h2=$(curl -s "$addr/status" | jq .result.latest_block_height)
h2=$(curl -s "$addr/status" | jq .result.sync_info.latest_block_height)
done
# wait for all other peers to get to this height
@@ -39,16 +39,16 @@ for i in $(seq 1 "$N"); do
if [[ "$i" != "$j" ]]; then
addrJ=$(test/p2p/ip.sh "$j"):46657
h=$(curl -s "$addrJ/status" | jq .result.latest_block_height)
h=$(curl -s "$addrJ/status" | jq .result.sync_info.latest_block_height)
while [ "$h" -lt "$minHeight" ]; do
sleep 1
h=$(curl -s "$addrJ/status" | jq .result.latest_block_height)
h=$(curl -s "$addrJ/status" | jq .result.sync_info.latest_block_height)
done
fi
done
# check that hash was updated
HASH2=$(curl -s "$addr/status" | jq .result.latest_app_hash)
HASH2=$(curl -s "$addr/status" | jq .result.sync_info.latest_app_hash)
if [[ "$HASH1" == "$HASH2" ]]; then
echo "Expected state hash to update from $HASH1. Got $HASH2"
exit 1
@@ -58,7 +58,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.latest_app_hash)
HASH3=$(curl -s "$addrJ/status" | jq .result.sync_info.latest_app_hash)
if [[ "$HASH2" != "$HASH3" ]]; then
echo "App hash for node $j doesn't match. Got $HASH3, expected $HASH2"
+2 -2
View File
@@ -54,12 +54,12 @@ for i in `seq 1 $N`; do
done
# - 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.sync_info.latest_block_height`
COUNT=0
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.latest_block_height`
BLOCK_HEIGHT=`curl -s $addr/status | jq .result.sync_info.latest_block_height`
COUNT=$((COUNT+1))
if [ "$COUNT" -gt "$MAX_SLEEP" ]; then
echo "Waited too long for node $i to commit a block"
+4 -4
View File
@@ -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.latest_block_height`
h1=`curl -s $peer_addr/status | jq .result.sync_info.latest_block_height`
# get another peer's state
root1=`curl -s $peer_addr/status | jq .result.latest_app_hash`
root1=`curl -s $peer_addr/status | jq .result.sync_info.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.latest_block_height`
h2=`curl -s $addr/status | jq .result.sync_info.latest_block_height`
echo "... $h2"
done
# check the app hash
root2=`curl -s $addr/status | jq .result.latest_app_hash`
root2=`curl -s $addr/status | jq .result.sync_info.latest_app_hash`
if [[ "$root1" != "$root2" ]]; then
echo "App hash after fast sync does not match. Got $root2; expected $root1"
+2 -2
View File
@@ -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.latest_block_height)
h1=$(curl -s "$addr/status" | jq .result.sync_info.latest_block_height)
echo "1st peer is on height $h1"
echo "Waiting until other peers reporting a height higher than the 1st one"
@@ -33,7 +33,7 @@ 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.latest_block_height)
hi=$(curl -s "$addr/status" | jq .result.sync_info.latest_block_height)
echo "... peer $i is on height $hi"
+6 -6
View File
@@ -31,7 +31,7 @@ function start_procs(){
if [[ "$CIRCLECI" == true ]]; then
$TM_CMD &
else
$TM_CMD &> "tendermint_${name}.log" &
$TM_CMD &> "tendermint_${name}.log" &
fi
PID_TENDERMINT=$!
else
@@ -60,8 +60,8 @@ function wait_for_port() {
i=0
while [ "$ERR" == 0 ]; do
echo "... port $port is still bound. waiting ..."
sleep 1
nc -z 127.0.0.1 $port
sleep 1
nc -z 127.0.0.1 $port
ERR=$?
i=$((i + 1))
if [[ $i == 10 ]]; then
@@ -97,7 +97,7 @@ for failIndex in $(seq $failsStart $failsEnd); do
ERR=$?
i=0
while [ "$ERR" != 0 ]; do
sleep 1
sleep 1
curl -s --unix-socket "$RPC_ADDR" http://localhost/status > /dev/null
ERR=$?
i=$((i + 1))
@@ -108,11 +108,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.latest_block_height)
h1=$(curl -s --unix-socket "$RPC_ADDR" http://localhost/status | jq .result.sync_info.latest_block_height)
h2=$h1
while [ "$h2" == "$h1" ]; do
sleep 1
h2=$(curl -s --unix-socket "$RPC_ADDR" http://localhost/status | jq .result.latest_block_height)
h2=$(curl -s --unix-socket "$RPC_ADDR" http://localhost/status | jq .result.sync_info.latest_block_height)
done
kill_procs
+3 -3
View File
@@ -46,7 +46,7 @@ curl -s $addr/status > /dev/null
ERR=$?
i=0
while [ "$ERR" != 0 ]; do
sleep 1
sleep 1
curl -s $addr/status > /dev/null
ERR=$?
i=$(($i + 1))
@@ -57,11 +57,11 @@ while [ "$ERR" != 0 ]; do
done
# wait for a new block
h1=`curl -s $addr/status | jq .result.latest_block_height`
h1=`curl -s $addr/status | jq .result.sync_info.latest_block_height`
h2=$h1
while [ "$h2" == "$h1" ]; do
sleep 1
h2=`curl -s $addr/status | jq .result.latest_block_height`
h2=`curl -s $addr/status | jq .result.sync_info.latest_block_height`
done
kill_procs