Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
0a986a50
Unverified
Commit
0a986a50
authored
Jun 24, 2019
by
vipwzw
Committed by
GitHub
Jun 24, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #537 from freek99/para_rpc_test
optimize Para rpc testcase
parents
9c8dae93
f0e72100
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
243 additions
and
295 deletions
+243
-295
test-rpc.sh
plugin/dapp/paracross/cmd/build/test-rpc.sh
+0
-276
testcase.sh
plugin/dapp/paracross/cmd/build/testcase.sh
+1
-2
test-rpc.sh
plugin/dapp/paracross/cmd/test/test-rpc.sh
+242
-17
No files found.
plugin/dapp/paracross/cmd/build/test-rpc.sh
deleted
100755 → 0
View file @
9c8dae93
#!/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
}
paracross_GetBlock2MainInfo
()
{
local
height
height
=
$(
curl
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"paracross.GetBlock2MainInfo","params":[{"start":1,"end":3}]}'
-H
'content-type:text/plain;'
${
UNIT_HTTP
}
| jq
-r
".result.items[1].height"
)
[
"
$height
"
-eq
2
]
local
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
}
chain33_lock
()
{
local
ok
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
]
local
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
}
chain33_unlock
()
{
local
ok
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
]
local
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
}
function
paracross_SignAndSend
()
{
local
signedTx
local
sendedTx
signedTx
=
$(
curl
-ksd
'{"method":"Chain33.SignRawTx","params":[{"expire":"120s","fee":'
"
$1
"
',"privkey":"'
"
$2
"
'","txHex":"'
"
$3
"
'"}]}'
${
UNIT_HTTP
}
| jq
-r
".result"
)
#echo "signedTx:$signedTx"
sendedTx
=
$(
curl
-ksd
'{"method":"Chain33.SendTransaction","params":[{"data":"'
"
$signedTx
"
'"}]}'
${
UNIT_HTTP
}
| jq
-r
".result"
)
echo
"sendedTx:
$sendedTx
"
}
function
paracross_QueryBalance
()
{
local
req
local
resp
local
balance
req
=
'{"method":"Chain33.GetBalance", "params":[{"addresses" : ["'
"
$1
"
'"], "execer" : "paracross","asset_exec":"paracross","asset_symbol":"coins.bty"}]}'
resp
=
$(
curl
-ksd
"
$req
"
"
${
UNIT_HTTP
}
"
)
balance
=
$(
jq
-r
'.result[0].balance'
<<<
"
$resp
"
)
echo
"
$balance
"
return
$?
}
function
paracross_Transfer_Withdraw
()
{
echo
"=========== ## para cross transfer/withdraw (main to para) test start"
#fromAddr 跨链资产转移地址
local
fromAddr
=
"12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"
#privkey 地址签名
local
privkey
=
"0x4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01"
#paracrossAddr 合约地址
local
paracrossAddr
=
"1HPkPopVe3ERfvaAgedDtJQ792taZFEHCe"
#amount_save 存钱到合约地址
local
amount_save
=
100000000
#amount_should 应转移金额
local
amount_should
=
27000000
#withdraw_should 应取款金额
local
withdraw_should
=
13000000
#fee 交易费
local
fee
=
1000000
#转移前余额
local
para_balance_before
#转移后余额
local
para_balance_after
#取钱后余额
local
para_balance_withdraw_after
#构造交易哈希
local
tx_hash
#实际转移金额
local
amount_real
#实际取钱金额
local
withdraw_real
#1. 查询资产转移前余额状态
para_balance_before
=
$(
paracross_QueryBalance
"
$fromAddr
"
)
echo
"before transferring:
$para_balance_before
"
#2 存钱到合约地址
tx_hash
=
$(
curl
-ksd
'{"method":"Chain33.CreateRawTransaction","params":[{"to":"'
"
$paracrossAddr
"
'","amount":'
$amount_save
'}]}'
${
UNIT_HTTP
}
| jq
-r
".result"
)
##echo "tx:$tx"
paracross_SignAndSend
$fee
"
$privkey
"
"
$tx_hash
"
#3 资产从主链转移到平行链
tx_hash
=
$(
curl
-ksd
'{"method":"Chain33.CreateTransaction","params":[{"execer":"paracross","actionName":"ParacrossAssetTransfer","payload":{"execer":"user.p.para.paracross","execName":"user.p.para.paracross","to":"'
"
$fromAddr
"
'","amount":'
$amount_should
'}}]}'
${
UNIT_HTTP
}
| jq
-r
".result"
)
#echo "rawTx:$rawTx"
paracross_SignAndSend
$fee
"
$privkey
"
"
$tx_hash
"
sleep
30
#4 查询转移后余额状态
para_balance_after
=
$(
paracross_QueryBalance
"
$fromAddr
"
)
echo
"after transferring:
$para_balance_after
"
#real_amount 实际转移金额
amount_real
=
$((
para_balance_after
-
para_balance_before
))
#5 取钱
tx_hash
=
$(
curl
-ksd
'{"method":"Chain33.CreateTransaction","params":[{"execer":"paracross","actionName":"ParacrossAssetWithdraw","payload":{"IsWithdraw":true,"execer":"user.p.para.paracross","execName":"user.p.para.paracross","to":"'
"
$fromAddr
"
'","amount":'
$withdraw_should
'}}]}'
${
UNIT_HTTP
}
| jq
-r
".result"
)
#echo "rawTx:$rawTx"
paracross_SignAndSend
$fee
"
$privkey
"
"
$tx_hash
"
sleep
15
#6 查询取钱后余额状态
para_balance_withdraw_after
=
$(
paracross_QueryBalance
"
$fromAddr
"
)
echo
"after withdrawing :
$para_balance_withdraw_after
"
#实际取钱金额
withdraw_real
=
$((
para_balance_after
-
para_balance_withdraw_after
))
#echo $withdraw_real
#7 验证转移是否正确
[
"
$amount_real
"
==
"
$amount_should
"
]
&&
[
"
$withdraw_should
"
==
"
$withdraw_real
"
]
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
echo
"=========== ## para cross transfer/withdraw (main to para) test start end"
}
function
paracross_IsSync
()
{
local
ok
ok
=
$(
curl
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"paracross.IsSync","params":[]}'
-H
'content-type:text/plain;'
${
UNIT_HTTP
}
| jq
-r
".result"
)
[
"
$ok
"
==
true
]
local
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
}
function
paracross_ListTitles
()
{
local
resp
local
ok
resp
=
$(
curl
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"paracross.ListTitles","params":[]}'
-H
'content-type:text/plain;'
${
UNIT_HTTP
})
#echo $resp
ok
=
$(
jq
'(.error|not) and (.result| [has("titles"),true])'
<<<
"
$resp
"
)
[
"
$ok
"
==
true
]
local
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
}
function
paracross_GetHeight
()
{
local
resp
local
ok
resp
=
$(
curl
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"paracross.GetHeight","params":[]}'
-H
'content-type:text/plain;'
${
UNIT_HTTP
})
#echo $resp
ok
=
$(
jq
'(.error|not) and (.result| [has("consensHeight"),true])'
<<<
"
$resp
"
)
[
"
$ok
"
==
true
]
local
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
}
function
paracross_GetNodeGroupAddrs
()
{
local
resp
local
ok
resp
=
$(
curl
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"paracross.GetNodeGroupAddrs","params":[{"title":"user.p.para."}]}'
-H
'content-type:text/plain;'
${
UNIT_HTTP
})
#echo $resp
ok
=
$(
jq
'(.error|not) and (.result| [has("key","value"),true])'
<<<
"
$resp
"
)
[
"
$ok
"
==
true
]
local
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
}
function
paracross_GetNodeGroupStatus
()
{
local
resp
local
ok
resp
=
$(
curl
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"paracross.GetNodeGroupStatus","params":[{"title":"user.p.para."}]}'
-H
'content-type:text/plain;'
${
UNIT_HTTP
})
#echo $resp
ok
=
$(
jq
'(.error|not) and (.result| [has("status"),true])'
<<<
"
$resp
"
)
[
"
$ok
"
==
true
]
local
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
}
function
paracross_ListNodeGroupStatus
()
{
local
resp
local
ok
resp
=
$(
curl
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"paracross.ListNodeGroupStatus","params":[{"title":"user.p.para.","status":2}]}'
-H
'content-type:text/plain;'
${
UNIT_HTTP
})
#echo $resp
ok
=
$(
jq
'(.error|not) and (.result| [has("status"),true])'
<<<
"
$resp
"
)
[
"
$ok
"
==
true
]
local
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
}
function
paracross_ListNodeStatus
()
{
local
resp
local
ok
resp
=
$(
curl
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"paracross.ListNodeStatus","params":[{"title":"user.p.para.","status":4}]}'
-H
'content-type:text/plain;'
${
UNIT_HTTP
})
#echo $resp
ok
=
$(
jq
'(.error|not) and (.result| [has("status"),true])'
<<<
"
$resp
"
)
[
"
$ok
"
==
true
]
local
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
}
function
run_main_testcases
()
{
chain33_lock
chain33_unlock
paracross_GetBlock2MainInfo
#paracross_IsSync
paracross_ListTitles
#paracross_GetHeight
paracross_GetNodeGroupAddrs
paracross_GetNodeGroupStatus
paracross_ListNodeGroupStatus
paracross_ListNodeStatus
#paracross_Transfer_Withdraw
}
function
run_para_testcases
()
{
chain33_lock
chain33_unlock
paracross_GetBlock2MainInfo
paracross_IsSync
paracross_ListTitles
paracross_GetHeight
paracross_GetNodeGroupAddrs
paracross_GetNodeGroupStatus
paracross_ListNodeGroupStatus
paracross_ListNodeStatus
paracross_Transfer_Withdraw
}
function
dapp_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_main_testcases
UNIT_HTTP
=
$PARA_HTTP
run_para_testcases
if
[
-n
"
$CASE_ERR
"
]
;
then
echo
"paracross there some case error"
exit
1
fi
}
#dapp_rpc_test $1
plugin/dapp/paracross/cmd/build/testcase.sh
View file @
0a986a50
...
...
@@ -15,7 +15,7 @@ if [ "$(uname)" == "Darwin" ]; then
fi
# shellcheck source=/dev/null
source
test-rpc.sh
#
source test-rpc.sh
function
para_init
()
{
para_set_toml chain33.para33.toml
...
...
@@ -914,7 +914,6 @@ function paracross() {
elif
[
"
${
2
}
"
==
"test"
]
;
then
para_test
"
${
1
}
"
dapp_rpc_test
"
${
3
}
"
fi
if
[
"
${
2
}
"
==
"forkInit"
]
;
then
...
...
plugin/dapp/paracross/cmd/test/test-rpc.sh
View file @
0a986a50
#!/usr/bin/env bash
# shellcheck disable=SC2128
MAIN_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
# shellcheck source=/dev/null
source
../dapp-test-common.sh
paracross_GetBlock2MainInfo
()
{
local
height
height
=
$(
curl
-ksd
'{"method":"paracross.GetBlock2MainInfo","params":[{"start":1,"end":3}]}'
${
UNIT_HTTP
}
| jq
-r
".result.items[1].height"
)
[
"
$height
"
-eq
2
]
local
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
}
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"
)
local
ok
ok
=
$(
curl
-ksd
'{"method":"Chain33.Lock","params":[]}'
${
UNIT_HTTP
}
| jq
-r
".result.isOK"
)
[
"
$ok
"
==
true
]
rst
=
$?
local
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;'
${
MAIN_HTTP
}
| jq
-r
".result.isOK"
)
local
ok
ok
=
$(
curl
-ksd
'{"method":"Chain33.UnLock","params":[{"passwd":"1314fuzamei","timeout":0}]}'
${
UNIT_HTTP
}
| jq
-r
".result.isOK"
)
[
"
$ok
"
==
true
]
rst
=
$?
local
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
}
function
paracross_SignAndSend
()
{
local
signedTx
local
sendedTx
signedTx
=
$(
curl
-ksd
'{"method":"Chain33.SignRawTx","params":[{"expire":"120s","fee":'
"
$1
"
',"privkey":"'
"
$2
"
'","txHex":"'
"
$3
"
'"}]}'
${
UNIT_HTTP
}
| jq
-r
".result"
)
#echo "signedTx:$signedTx"
sendedTx
=
$(
curl
-ksd
'{"method":"Chain33.SendTransaction","params":[{"data":"'
"
$signedTx
"
'"}]}'
${
UNIT_HTTP
}
| jq
-r
".result"
)
echo
"sendedTx:
$sendedTx
"
}
function
paracross_QueryBalance
()
{
local
req
local
resp
local
balance
req
=
'{"method":"Chain33.GetBalance", "params":[{"addresses" : ["'
"
$1
"
'"], "execer" : "paracross","asset_exec":"paracross","asset_symbol":"coins.bty"}]}'
resp
=
$(
curl
-ksd
"
$req
"
"
${
UNIT_HTTP
}
"
)
balance
=
$(
jq
-r
'.result[0].balance'
<<<
"
$resp
"
)
echo
"
$balance
"
return
$?
}
function
paracross_Transfer_Withdraw
()
{
# 计数器,资产转移操作和取钱操作都成功才算成功,也就是 counter == 2
local
count
=
0
#fromAddr 跨链资产转移地址
local
fromAddr
=
"12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"
#privkey 地址签名
local
privkey
=
"0x4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01"
#paracrossAddr 合约地址
local
paracrossAddr
=
"1HPkPopVe3ERfvaAgedDtJQ792taZFEHCe"
#amount_save 存钱到合约地址
local
amount_save
=
100000000
#amount_should 应转移金额
local
amount_should
=
27000000
#withdraw_should 应取款金额
local
withdraw_should
=
13000000
#fee 交易费
#local fee=1000000
#转移前余额
local
para_balance_before
#转移后余额
local
para_balance_after
#取钱后余额
local
para_balance_withdraw_after
#构造交易哈希
local
tx_hash
#实际转移金额
local
amount_real
#实际取钱金额
local
withdraw_real
#1. 查询资产转移前余额状态
para_balance_before
=
$(
paracross_QueryBalance
"
$fromAddr
"
)
echo
"before transferring:
$para_balance_before
"
#2 存钱到合约地址
tx_hash
=
$(
curl
-ksd
'{"method":"Chain33.CreateRawTransaction","params":[{"to":"'
"
$paracrossAddr
"
'","amount":'
$amount_save
'}]}'
${
UNIT_HTTP
}
| jq
-r
".result"
)
##echo "tx:$tx"
chain33_SignRawTx
"
$tx_hash
"
"
$privkey
"
${
UNIT_HTTP
}
#paracross_SignAndSend $fee "$privkey" "$tx_hash"
#3 资产从主链转移到平行链
tx_hash
=
$(
curl
-ksd
'{"method":"Chain33.CreateTransaction","params":[{"execer":"paracross","actionName":"ParacrossAssetTransfer","payload":{"execer":"user.p.para.paracross","execName":"user.p.para.paracross","to":"'
"
$fromAddr
"
'","amount":'
$amount_should
'}}]}'
${
UNIT_HTTP
}
| jq
-r
".result"
)
#echo "rawTx:$rawTx"
chain33_SignRawTx
"
$tx_hash
"
"
$privkey
"
${
UNIT_HTTP
}
#paracross_SignAndSend $fee "$privkey" "$tx_hash"
#4 查询转移后余额状态
local times
=
100
while
true
;
do
para_balance_after
=
$(
paracross_QueryBalance
"
$fromAddr
"
)
echo
"after transferring:
$para_balance_after
"
#real_amount 实际转移金额
amount_real
=
$((
para_balance_after
-
para_balance_before
))
#echo $amount_real
if
[
"
$amount_real
"
!=
"
$amount_should
"
]
;
then
chain33_BlockWait 2
${
UNIT_HTTP
}
times
=
$((
times
-
1
))
if
[
$times
-le
0
]
;
then
echo
"para_cross_transfer_withdraw failed"
exit
1
fi
else
#echo "para_cross_transfer_withdraw success"
count
=
$((
count
+
1
))
break
fi
done
#5 取钱
tx_hash
=
$(
curl
-ksd
'{"method":"Chain33.CreateTransaction","params":[{"execer":"paracross","actionName":"ParacrossAssetWithdraw","payload":{"IsWithdraw":true,"execer":"user.p.para.paracross","execName":"user.p.para.paracross","to":"'
"
$fromAddr
"
'","amount":'
$withdraw_should
'}}]}'
${
UNIT_HTTP
}
| jq
-r
".result"
)
#echo "rawTx:$rawTx"
chain33_SignRawTx
"
$tx_hash
"
"
$privkey
"
${
UNIT_HTTP
}
#paracross_SignAndSend $fee "$privkey" "$tx_hash"
#6 查询取钱后余额状态
local times
=
100
while
true
;
do
para_balance_withdraw_after
=
$(
paracross_QueryBalance
"
$fromAddr
"
)
echo
"after withdrawing :
$para_balance_withdraw_after
"
#实际取钱金额
withdraw_real
=
$((
para_balance_after
-
para_balance_withdraw_after
))
#echo $withdraw_real
if
[
"
$withdraw_should
"
!=
"
$withdraw_real
"
]
;
then
chain33_BlockWait 2
${
UNIT_HTTP
}
times
=
$((
times
-
1
))
if
[
$times
-le
0
]
;
then
echo
"para_cross_transfer_withdraw failed"
exit
1
fi
else
#echo "para_cross_transfer_withdraw success"
count
=
$((
count
+
1
))
break
fi
done
[
"
$count
"
-eq
2
]
local
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
}
function
paracross_IsSync
()
{
local
ok
ok
=
$(
curl
-ksd
'{"method":"paracross.IsSync","params":[]}'
${
UNIT_HTTP
}
| jq
-r
".result"
)
[
"
$ok
"
==
true
]
local
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
}
function
paracross_ListTitles
()
{
local
resp
local
ok
resp
=
$(
curl
-ksd
'{"method":"paracross.ListTitles","params":[]}'
${
UNIT_HTTP
})
#echo $resp
ok
=
$(
jq
'(.error|not) and (.result| [has("titles"),true])'
<<<
"
$resp
"
)
[
"
$ok
"
==
true
]
local
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
}
function
paracross_GetHeight
()
{
local
resp
local
ok
resp
=
$(
curl
-ksd
'{"method":"paracross.GetHeight","params":[]}'
${
UNIT_HTTP
})
#echo $resp
ok
=
$(
jq
'(.error|not) and (.result| [has("consensHeight"),true])'
<<<
"
$resp
"
)
[
"
$ok
"
==
true
]
local
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
}
function
paracross_GetNodeGroupAddrs
()
{
local
resp
local
ok
resp
=
$(
curl
-ksd
'{"method":"paracross.GetNodeGroupAddrs","params":[{"title":"user.p.para."}]}'
${
UNIT_HTTP
})
#echo $resp
ok
=
$(
jq
'(.error|not) and (.result| [has("key","value"),true])'
<<<
"
$resp
"
)
[
"
$ok
"
==
true
]
local
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
}
function
paracross_GetNodeGroupStatus
()
{
local
resp
local
ok
resp
=
$(
curl
-ksd
'{"method":"paracross.GetNodeGroupStatus","params":[{"title":"user.p.para."}]}'
${
UNIT_HTTP
})
#echo $resp
ok
=
$(
jq
'(.error|not) and (.result| [has("status"),true])'
<<<
"
$resp
"
)
[
"
$ok
"
==
true
]
local
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
}
function
paracross_ListNodeGroupStatus
()
{
local
resp
local
ok
resp
=
$(
curl
-ksd
'{"method":"paracross.ListNodeGroupStatus","params":[{"title":"user.p.para.","status":2}]}'
${
UNIT_HTTP
})
#echo $resp
ok
=
$(
jq
'(.error|not) and (.result| [has("status"),true])'
<<<
"
$resp
"
)
[
"
$ok
"
==
true
]
local
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
}
function
paracross_ListNodeStatus
()
{
local
resp
local
ok
resp
=
$(
curl
-ksd
'{"method":"paracross.ListNodeStatus","params":[{"title":"user.p.para.","status":4}]}'
${
UNIT_HTTP
})
#echo $resp
ok
=
$(
jq
'(.error|not) and (.result| [has("status"),true])'
<<<
"
$resp
"
)
[
"
$ok
"
==
true
]
local
rst
=
$?
echo_rst
"
$FUNCNAME
"
"
$rst
"
}
function
run_testcases
()
{
local
ispara
chain33_lock
chain33_unlock
paracross_GetBlock2MainInfo
ispara
=
$(
echo
'"'
"
${
UNIT_HTTP
}
"
'"'
| jq
'.|contains("8901")'
)
if
[
"
$ispara
"
==
true
]
;
then
paracross_IsSync
paracross_GetHeight
paracross_ListTitles
paracross_GetNodeGroupAddrs
paracross_GetNodeGroupStatus
paracross_ListNodeGroupStatus
paracross_ListNodeStatus
paracross_Transfer_Withdraw
fi
}
function
paracross_rpc_test
()
{
MAIN_HTTP
=
"
$1
"
function
main
()
{
UNIT_HTTP
=
$1
echo
"=========== # paracross rpc test ============="
echo
"ip=
$MAIN_HTTP
"
run_testcases
...
...
@@ -48,4 +273,4 @@ function paracross_rpc_test() {
fi
}
paracross_rpc_test
"
$1
"
main
"
$1
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment