Commit 49b19fdd authored by mdj33's avatar mdj33 Committed by vipwzw

add exit if rpc test fail

parent 2ae158c7
...@@ -2,15 +2,21 @@ ...@@ -2,15 +2,21 @@
MAIN_HTTP="" MAIN_HTTP=""
MAIN_HTTP=""
CASE_ERR=""
# $2=0 means true, other false # $2=0 means true, other false
echo_rst() { echo_rst() {
if [ "$2" -eq 0 ]; then if [ "$2" -eq 0 ]; then
echo "$1 ok" echo "$1 ok"
else else
echo "$1 err" echo "$1 err"
CASE_ERR="err"
fi fi
} }
chain33_lock() { chain33_lock() {
ok=$(curl -s --data-binary '{"jsonrpc":"2.0","id":2,"method":"Chain33.Lock","params":[]}' -H 'content-type:text/plain;' ${MAIN_HTTP} | jq -r ".result.isOK") ok=$(curl -s --data-binary '{"jsonrpc":"2.0","id":2,"method":"Chain33.Lock","params":[]}' -H 'content-type:text/plain;' ${MAIN_HTTP} | jq -r ".result.isOK")
[ "$ok" == true ] [ "$ok" == true ]
...@@ -32,6 +38,11 @@ function system_test_rpc() { ...@@ -32,6 +38,11 @@ function system_test_rpc() {
echo "ip=$MAIN_HTTP" echo "ip=$MAIN_HTTP"
chain33_lock chain33_lock
chain33_unlock chain33_unlock
if [ -n "$CASE_ERR" ]; then
echo "there some case error"
exit 1
fi
} }
#system_rpc_test #system_rpc_test
#!/usr/bin/env bash #!/usr/bin/env bash
MAIN_HTTP="" MAIN_HTTP=""
CASE_ERR=""
# $2=0 means true, other false # $2=0 means true, other false
echo_rst() { echo_rst() {
...@@ -8,6 +9,7 @@ echo_rst() { ...@@ -8,6 +9,7 @@ echo_rst() {
echo "$1 ok" echo "$1 ok"
else else
echo "$1 err" echo "$1 err"
CASE_ERR="err"
fi fi
} }
...@@ -38,8 +40,14 @@ function dapp_rpc_test() { ...@@ -38,8 +40,14 @@ function dapp_rpc_test() {
MAIN_HTTP="http://$ip:8901" MAIN_HTTP="http://$ip:8901"
echo "=========== # paracross rpc test =============" echo "=========== # paracross rpc test ============="
echo "ip=$MAIN_HTTP" echo "ip=$MAIN_HTTP"
paracross_GetBlock2MainInfo chain33_lock
chain33_unlock chain33_unlock
paracross_GetBlock2MainInfo
if [ -n "$CASE_ERR" ]; then
echo "paracross there some case error"
exit 1
fi
} }
#dapp_rpc_test $1 #dapp_rpc_test $1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment