Commit 8e527be5 authored by vipwzw's avatar vipwzw

auto ci

parent bf9bfa8b
...@@ -6,11 +6,10 @@ UNIT_HTTP="" ...@@ -6,11 +6,10 @@ UNIT_HTTP=""
source ../dapp-test-common.sh source ../dapp-test-common.sh
paracross_GetBlock2MainInfo() { paracross_GetBlock2MainInfo() {
local height local height
height=$(curl -ksd '{"method":"paracross.GetBlock2MainInfo","params":[{"start":1,"end":3}]}' ${UNIT_HTTP} | jq -r ".result.items[1].height") height=$(curl -ksd '{"method":"paracross.GetBlock2MainInfo","params":[{"start":1,"end":3}]}' ${UNIT_HTTP} | jq -r ".result.items[1].height")
[ "$height" -eq 2 ] [ "$height" -eq 2 ]
local rst=$? local rst=$?
echo_rst "$FUNCNAME" "$rst" echo_rst "$FUNCNAME" "$rst"
...@@ -19,7 +18,7 @@ paracross_GetBlock2MainInfo() { ...@@ -19,7 +18,7 @@ paracross_GetBlock2MainInfo() {
chain33_lock() { chain33_lock() {
local ok local ok
ok=$(curl -ksd '{"method":"Chain33.Lock","params":[]}' ${UNIT_HTTP} | jq -r ".result.isOK") ok=$(curl -ksd '{"method":"Chain33.Lock","params":[]}' ${UNIT_HTTP} | jq -r ".result.isOK")
[ "$ok" == true ] [ "$ok" == true ]
local rst=$? local rst=$?
echo_rst "$FUNCNAME" "$rst" echo_rst "$FUNCNAME" "$rst"
...@@ -27,7 +26,7 @@ chain33_lock() { ...@@ -27,7 +26,7 @@ chain33_lock() {
chain33_unlock() { chain33_unlock() {
local ok local ok
ok=$(curl -ksd '{"method":"Chain33.UnLock","params":[{"passwd":"1314fuzamei","timeout":0}]}' ${UNIT_HTTP} | jq -r ".result.isOK") ok=$(curl -ksd '{"method":"Chain33.UnLock","params":[{"passwd":"1314fuzamei","timeout":0}]}' ${UNIT_HTTP} | jq -r ".result.isOK")
[ "$ok" == true ] [ "$ok" == true ]
local rst=$? local rst=$?
echo_rst "$FUNCNAME" "$rst" echo_rst "$FUNCNAME" "$rst"
...@@ -40,7 +39,7 @@ function paracross_SignAndSend() { ...@@ -40,7 +39,7 @@ function paracross_SignAndSend() {
signedTx=$(curl -ksd '{"method":"Chain33.SignRawTx","params":[{"expire":"120s","fee":'"$1"',"privkey":"'"$2"'","txHex":"'"$3"'"}]}' ${UNIT_HTTP} | jq -r ".result") signedTx=$(curl -ksd '{"method":"Chain33.SignRawTx","params":[{"expire":"120s","fee":'"$1"',"privkey":"'"$2"'","txHex":"'"$3"'"}]}' ${UNIT_HTTP} | jq -r ".result")
#echo "signedTx:$signedTx" #echo "signedTx:$signedTx"
sendedTx=$(curl -ksd '{"method":"Chain33.SendTransaction","params":[{"data":"'"$signedTx"'"}]}' ${UNIT_HTTP} | jq -r ".result" ) sendedTx=$(curl -ksd '{"method":"Chain33.SendTransaction","params":[{"data":"'"$signedTx"'"}]}' ${UNIT_HTTP} | jq -r ".result")
echo "sendedTx:$sendedTx" echo "sendedTx:$sendedTx"
} }
...@@ -56,7 +55,6 @@ function paracross_QueryBalance() { ...@@ -56,7 +55,6 @@ function paracross_QueryBalance() {
return $? return $?
} }
function paracross_Transfer_Withdraw() { function paracross_Transfer_Withdraw() {
# 计数器,资产转移操作和取钱操作都成功才算成功,也就是 counter == 2 # 计数器,资产转移操作和取钱操作都成功才算成功,也就是 counter == 2
...@@ -104,7 +102,6 @@ function paracross_Transfer_Withdraw() { ...@@ -104,7 +102,6 @@ function paracross_Transfer_Withdraw() {
chain33_SignRawTx "$tx_hash" "$privkey" ${UNIT_HTTP} chain33_SignRawTx "$tx_hash" "$privkey" ${UNIT_HTTP}
#paracross_SignAndSend $fee "$privkey" "$tx_hash" #paracross_SignAndSend $fee "$privkey" "$tx_hash"
#4 查询转移后余额状态 #4 查询转移后余额状态
local times=100 local times=100
while true; do while true; do
...@@ -133,7 +130,6 @@ function paracross_Transfer_Withdraw() { ...@@ -133,7 +130,6 @@ function paracross_Transfer_Withdraw() {
chain33_SignRawTx "$tx_hash" "$privkey" ${UNIT_HTTP} chain33_SignRawTx "$tx_hash" "$privkey" ${UNIT_HTTP}
#paracross_SignAndSend $fee "$privkey" "$tx_hash" #paracross_SignAndSend $fee "$privkey" "$tx_hash"
#6 查询取钱后余额状态 #6 查询取钱后余额状态
local times=100 local times=100
while true; do while true; do
...@@ -156,7 +152,6 @@ function paracross_Transfer_Withdraw() { ...@@ -156,7 +152,6 @@ function paracross_Transfer_Withdraw() {
fi fi
done done
[ "$count" -eq 2 ] [ "$count" -eq 2 ]
local rst=$? local rst=$?
echo_rst "$FUNCNAME" "$rst" echo_rst "$FUNCNAME" "$rst"
...@@ -166,7 +161,7 @@ function paracross_Transfer_Withdraw() { ...@@ -166,7 +161,7 @@ function paracross_Transfer_Withdraw() {
function paracross_IsSync() { function paracross_IsSync() {
local ok local ok
ok=$(curl -ksd '{"method":"paracross.IsSync","params":[]}' ${UNIT_HTTP} | jq -r ".result") ok=$(curl -ksd '{"method":"paracross.IsSync","params":[]}' ${UNIT_HTTP} | jq -r ".result")
[ "$ok" == true ] [ "$ok" == true ]
local rst=$? local rst=$?
echo_rst "$FUNCNAME" "$rst" echo_rst "$FUNCNAME" "$rst"
...@@ -177,7 +172,7 @@ function paracross_ListTitles() { ...@@ -177,7 +172,7 @@ function paracross_ListTitles() {
local resp local resp
local ok local ok
resp=$(curl -ksd '{"method":"paracross.ListTitles","params":[]}' ${UNIT_HTTP}) resp=$(curl -ksd '{"method":"paracross.ListTitles","params":[]}' ${UNIT_HTTP})
echo $resp echo $resp
ok=$(jq '(.error|not) and (.result| [has("titles"),true])' <<<"$resp") ok=$(jq '(.error|not) and (.result| [has("titles"),true])' <<<"$resp")
[ "$ok" == true ] [ "$ok" == true ]
...@@ -189,7 +184,7 @@ function paracross_GetHeight() { ...@@ -189,7 +184,7 @@ function paracross_GetHeight() {
local resp local resp
local ok local ok
resp=$(curl -ksd '{"method":"paracross.GetHeight","params":[]}' ${UNIT_HTTP}) resp=$(curl -ksd '{"method":"paracross.GetHeight","params":[]}' ${UNIT_HTTP})
echo $resp echo $resp
ok=$(jq '(.error|not) and (.result| [has("consensHeight"),true])' <<<"$resp") ok=$(jq '(.error|not) and (.result| [has("consensHeight"),true])' <<<"$resp")
[ "$ok" == true ] [ "$ok" == true ]
...@@ -201,7 +196,7 @@ function paracross_GetNodeGroupAddrs() { ...@@ -201,7 +196,7 @@ function paracross_GetNodeGroupAddrs() {
local resp local resp
local ok local ok
resp=$(curl -ksd '{"method":"paracross.GetNodeGroupAddrs","params":[{"title":"user.p.para."}]}' ${UNIT_HTTP}) resp=$(curl -ksd '{"method":"paracross.GetNodeGroupAddrs","params":[{"title":"user.p.para."}]}' ${UNIT_HTTP})
echo $resp echo $resp
ok=$(jq '(.error|not) and (.result| [has("key","value"),true])' <<<"$resp") ok=$(jq '(.error|not) and (.result| [has("key","value"),true])' <<<"$resp")
[ "$ok" == true ] [ "$ok" == true ]
...@@ -213,7 +208,7 @@ function paracross_GetNodeGroupStatus() { ...@@ -213,7 +208,7 @@ function paracross_GetNodeGroupStatus() {
local resp local resp
local ok local ok
resp=$(curl -ksd '{"method":"paracross.GetNodeGroupStatus","params":[{"title":"user.p.para."}]}' ${UNIT_HTTP}) resp=$(curl -ksd '{"method":"paracross.GetNodeGroupStatus","params":[{"title":"user.p.para."}]}' ${UNIT_HTTP})
echo $resp echo $resp
ok=$(jq '(.error|not) and (.result| [has("status"),true])' <<<"$resp") ok=$(jq '(.error|not) and (.result| [has("status"),true])' <<<"$resp")
[ "$ok" == true ] [ "$ok" == true ]
...@@ -225,7 +220,7 @@ function paracross_ListNodeGroupStatus() { ...@@ -225,7 +220,7 @@ function paracross_ListNodeGroupStatus() {
local resp local resp
local ok local ok
resp=$(curl -ksd '{"method":"paracross.ListNodeGroupStatus","params":[{"title":"user.p.para.","status":2}]}' ${UNIT_HTTP}) resp=$(curl -ksd '{"method":"paracross.ListNodeGroupStatus","params":[{"title":"user.p.para.","status":2}]}' ${UNIT_HTTP})
echo $resp echo $resp
ok=$(jq '(.error|not) and (.result| [has("status"),true])' <<<"$resp") ok=$(jq '(.error|not) and (.result| [has("status"),true])' <<<"$resp")
[ "$ok" == true ] [ "$ok" == true ]
...@@ -237,7 +232,7 @@ function paracross_ListNodeStatus() { ...@@ -237,7 +232,7 @@ function paracross_ListNodeStatus() {
local resp local resp
local ok local ok
resp=$(curl -ksd '{"method":"paracross.ListNodeStatus","params":[{"title":"user.p.para.","status":4}]}' ${UNIT_HTTP}) resp=$(curl -ksd '{"method":"paracross.ListNodeStatus","params":[{"title":"user.p.para.","status":4}]}' ${UNIT_HTTP})
echo $resp echo $resp
ok=$(jq '(.error|not) and (.result| [has("status"),true])' <<<"$resp") ok=$(jq '(.error|not) and (.result| [has("status"),true])' <<<"$resp")
[ "$ok" == true ] [ "$ok" == true ]
...@@ -263,7 +258,6 @@ function run_testcases() { ...@@ -263,7 +258,6 @@ function run_testcases() {
fi fi
} }
function main() { function main() {
UNIT_HTTP=$1 UNIT_HTTP=$1
echo "=========== # paracross rpc test =============" echo "=========== # paracross rpc test ============="
......
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