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
95f6063b
Commit
95f6063b
authored
May 29, 2019
by
harrylee2015
Committed by
vipwzw
May 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify game rpc test for shellcheck
parent
7e9c761d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
14 deletions
+11
-14
test-rpc.sh
plugin/dapp/game/cmd/build/test-rpc.sh
+11
-14
No files found.
plugin/dapp/game/cmd/build/test-rpc.sh
View file @
95f6063b
...
@@ -4,16 +4,14 @@ set -e
...
@@ -4,16 +4,14 @@ set -e
set
-o
pipefail
set
-o
pipefail
MAIN_HTTP
=
""
MAIN_HTTP
=
""
PARA_HTTP
=
""
CASE_ERR
=
""
CASE_ERR
=
""
GAME_ID
=
""
GAME_ID
=
""
PASSWD
=
"ABCD"
PASSWD
=
"ABCD"
HASH_VALUE
=
$(
echo
-n
"ABCD1"
|
sha256sum
|
awk
'{print $1}'
)
HASH_VALUE
=
$(
echo
-n
"ABCD1"
|
sha256sum
|
awk
'{print $1}'
)
create_txHash
=
""
signedTx
=
""
match_txHash
=
""
txHash
=
""
close_txHash
=
""
ACCOUNT_A
=
"14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
ACCOUNT_A
=
"14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
PRIVA_A
=
"cc38546e9e659d15e6b4893f0ab32a06d103931a8230b0bde71459d2b27d6944"
#
PRIVA_A="cc38546e9e659d15e6b4893f0ab32a06d103931a8230b0bde71459d2b27d6944"
ACCOUNT_B
=
"19MJmA7GcE1NfMwdGqgLJioBjVbzQnVYvR"
ACCOUNT_B
=
"19MJmA7GcE1NfMwdGqgLJioBjVbzQnVYvR"
PRIVA_B
=
"5072a3b6ed612845a7c00b88b38e4564093f57ce652212d6e26da9fded83e951"
PRIVA_B
=
"5072a3b6ed612845a7c00b88b38e4564093f57ce652212d6e26da9fded83e951"
EXECTOR
=
""
EXECTOR
=
""
...
@@ -39,7 +37,7 @@ function chain33_GetExecAddr() {
...
@@ -39,7 +37,7 @@ function chain33_GetExecAddr() {
echo
"#request:
$req
"
echo
"#request:
$req
"
resp
=
$(
curl
-ksd
"{
$req
}"
"
${
MAIN_HTTP
}
"
)
resp
=
$(
curl
-ksd
"{
$req
}"
"
${
MAIN_HTTP
}
"
)
echo
"#response:
$resp
"
echo
"#response:
$resp
"
GAME_ADDR
=
$(
echo
"
${
res
}
"
| jq
-r
".result"
)
#
GAME_ADDR=$(echo "${res}" | jq -r ".result")
echo_rst
"
$FUNCNAME
"
"
$?
"
echo_rst
"
$FUNCNAME
"
"
$?
"
}
}
...
@@ -60,7 +58,7 @@ function CreateGameTx() {
...
@@ -60,7 +58,7 @@ function CreateGameTx() {
sendSignedTx
sendSignedTx
echo_rst
"CreateGame sendSignedTx"
"
$?
"
echo_rst
"CreateGame sendSignedTx"
"
$?
"
GAME_ID
=
"
${
txHash
}
"
GAME_ID
=
"
${
txHash
}
"
create_txHash
=
"
${
txHash
}
"
#
create_txHash="${txHash}"
query_tx
"
${
txHash
}
"
query_tx
"
${
txHash
}
"
echo_rst
"CreateGame query_tx"
"
$?
"
echo_rst
"CreateGame query_tx"
"
$?
"
}
}
...
@@ -79,7 +77,7 @@ function MatchGameTx() {
...
@@ -79,7 +77,7 @@ function MatchGameTx() {
echo_rst
"MatchGame signRawTx"
"
$?
"
echo_rst
"MatchGame signRawTx"
"
$?
"
sendSignedTx
sendSignedTx
echo_rst
"MatchGame sendSignedTx"
"
$?
"
echo_rst
"MatchGame sendSignedTx"
"
$?
"
match_txHash
=
"
${
txHash
}
"
#
match_txHash="${txHash}"
query_tx
"
${
txHash
}
"
query_tx
"
${
txHash
}
"
echo_rst
"MatchGame query_tx"
"
$?
"
echo_rst
"MatchGame query_tx"
"
$?
"
}
}
...
@@ -99,7 +97,6 @@ function CloseGameTx() {
...
@@ -99,7 +97,6 @@ function CloseGameTx() {
echo_rst
"CloseGame signRawTx"
"
$?
"
echo_rst
"CloseGame signRawTx"
"
$?
"
sendSignedTx
sendSignedTx
echo_rst
"CloseGame sendSignedTx"
"
$?
"
echo_rst
"CloseGame sendSignedTx"
"
$?
"
close_txHash
=
"
${
txHash
}
"
query_tx
"
${
txHash
}
"
query_tx
"
${
txHash
}
"
echo_rst
"CloseGame query_tx"
"
$?
"
echo_rst
"CloseGame query_tx"
"
$?
"
}
}
...
@@ -118,7 +115,7 @@ function CancleGameTx() {
...
@@ -118,7 +115,7 @@ function CancleGameTx() {
echo_rst
"CancleGame signRawTx"
"
$?
"
echo_rst
"CancleGame signRawTx"
"
$?
"
sendSignedTx
sendSignedTx
echo_rst
"CancleGame sendSignedTx"
"
$?
"
echo_rst
"CancleGame sendSignedTx"
"
$?
"
close_txHash
=
"
${
txHash
}
"
#
close_txHash="${txHash}"
query_tx
"
${
txHash
}
"
query_tx
"
${
txHash
}
"
echo_rst
"CancleGame query_tx"
"
$?
"
echo_rst
"CancleGame query_tx"
"
$?
"
}
}
...
@@ -152,7 +149,7 @@ function QueryGameByGameId() {
...
@@ -152,7 +149,7 @@ function QueryGameByGameId() {
function
chain33_ImportPrivkey
()
{
function
chain33_ImportPrivkey
()
{
local
pri
=
$2
local
pri
=
$2
local
acc
=
$3
#
local acc=$3
local
req
=
'"method":"Chain33.ImportPrivkey", "params":[{"privkey":"'
"
$pri
"
'", "label":"gameB"}]'
local
req
=
'"method":"Chain33.ImportPrivkey", "params":[{"privkey":"'
"
$pri
"
'", "label":"gameB"}]'
echo
"#request:
$req
"
echo
"#request:
$req
"
resp
=
$(
curl
-ksd
"{
$req
}"
"
$1
"
)
resp
=
$(
curl
-ksd
"{
$req
}"
"
$1
"
)
...
@@ -201,7 +198,7 @@ function block_wait() {
...
@@ -201,7 +198,7 @@ function block_wait() {
function
signRawTx
()
{
function
signRawTx
()
{
unsignedTx
=
$1
unsignedTx
=
$1
addr
=
$2
addr
=
$2
signedTx
=
$(
curl
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"Chain33.SignRawTx","params":[{"addr":"'
${
addr
}
'","txHex":"'
${
unsignedTx
}
'","expire":"120s","fee":1000000}]}'
-H
'content-type:text/plain;'
${
MAIN_HTTP
}
| jq
-r
".result"
)
signedTx
=
$(
curl
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"Chain33.SignRawTx","params":[{"addr":"'
"
${
addr
}
"
'","txHex":"'
"
${
unsignedTx
}
"
'","expire":"120s","fee":1000000}]}'
-H
'content-type:text/plain;'
${
MAIN_HTTP
}
| jq
-r
".result"
)
if
[
"
$signedTx
"
==
"null"
]
;
then
if
[
"
$signedTx
"
==
"null"
]
;
then
return
1
return
1
else
else
...
@@ -210,7 +207,7 @@ function signRawTx() {
...
@@ -210,7 +207,7 @@ function signRawTx() {
}
}
function
sendSignedTx
()
{
function
sendSignedTx
()
{
txHash
=
$(
curl
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"Chain33.SendTransaction","params":[{"token":"","data":"'
${
signedTx
}
'"}]}'
-H
'content-type:text/plain;'
${
MAIN_HTTP
}
| jq
-r
".result"
)
txHash
=
$(
curl
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"Chain33.SendTransaction","params":[{"token":"","data":"'
"
${
signedTx
}
"
'"}]}'
-H
'content-type:text/plain;'
${
MAIN_HTTP
}
| jq
-r
".result"
)
if
[
"
$txHash
"
==
"null"
]
;
then
if
[
"
$txHash
"
==
"null"
]
;
then
return
1
return
1
else
else
...
@@ -291,7 +288,7 @@ function run_test() {
...
@@ -291,7 +288,7 @@ function run_test() {
QueryGameByStatus 2
QueryGameByStatus 2
CloseGameTx
"
${
GAME_ID
}
"
1
CloseGameTx
"
${
GAME_ID
}
"
"
${
PASSWD
}
"
QueryGameByGameId
"
${
GAME_ID
}
"
4
QueryGameByGameId
"
${
GAME_ID
}
"
4
...
...
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