Commit 883f877b authored by liuyuhang's avatar liuyuhang

Merge branch 'master' into add_rpc_test

parents 02d27762 7c3f8b34
#!/usr/bin/env bash
# shellcheck disable=SC2128
RPC_TESTFILE=test-rpc.sh
function dapp_test_rpc() {
local ip=$1
echo "============ # dapp rpc test ============="
if [ -d dapptest ]; then
cd dapptest || return
dir=$(find . -maxdepth 1 -type d ! -name dapptest ! -name . | sed 's/^\.\///')
for app in $dir; do
echo "=========== # $app rpc test ============="
./"$app/${RPC_TESTFILE}" "$ip"
done
fi
}
#dapp_test_rpc $1
......@@ -60,6 +60,8 @@ fi
if [ -z "$DAPP" ]; then
# shellcheck source=/dev/null
source system-test-rpc.sh
# shellcheck source=/dev/null
source dapp-test-rpc.sh
fi
echo "=========== # env setting ============="
......@@ -331,6 +333,7 @@ function base_config() {
function base_test() {
if [ "$DAPP" == "" ]; then
system_test_rpc "${1}"
dapp_test_rpc "${1}"
fi
}
......
#!/usr/bin/env bash
# shellcheck disable=SC2128
MAIN_HTTP=""
PARA_HTTP=""
CASE_ERR=""
UNIT_HTTP=""
# $2=0 means true, other false
echo_rst() {
if [ "$2" -eq 0 ]; then
echo "$1 ok"
else
echo "$1 err"
CASE_ERR="err"
fi
}
chain33_lock() {
ok=$(curl -s --data-binary '{"jsonrpc":"2.0","id":2,"method":"Chain33.Lock","params":[]}' -H 'content-type:text/plain;' ${UNIT_HTTP} | jq -r ".result.isOK")
[ "$ok" == true ]
rst=$?
echo_rst "$FUNCNAME" "$rst"
}
chain33_unlock() {
ok=$(curl -s --data-binary '{"jsonrpc":"2.0","id":2,"method":"Chain33.UnLock","params":[{"passwd":"1314fuzamei","timeout":0}]}' -H 'content-type:text/plain;' ${UNIT_HTTP} | jq -r ".result.isOK")
[ "$ok" == true ]
rst=$?
echo_rst "$FUNCNAME" "$rst"
}
function run_testcases() {
chain33_lock
chain33_unlock
}
function paracross_rpc_test() {
local ip=$1
MAIN_HTTP="http://$ip:8801"
PARA_HTTP="http://$ip:8901"
echo "=========== # paracross rpc test ============="
echo "main_ip=$MAIN_HTTP,para_ip=$PARA_HTTP"
UNIT_HTTP=$MAIN_HTTP
run_testcases
if [ -n "$CASE_ERR" ]; then
echo "paracross there some case error"
exit 1
fi
}
paracross_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