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
8584c38f
Unverified
Commit
8584c38f
authored
Jun 04, 2019
by
vipwzw
Committed by
GitHub
Jun 04, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #483 from zzh33cn/guess-rpc-test
Guess rpc test
parents
e3d68c56
029eadd5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
359 additions
and
2 deletions
+359
-2
dapp-test-common.sh
build/dapp-test-common.sh
+26
-1
docker-compose.sh
build/docker-compose.sh
+2
-1
Makefile
plugin/dapp/guess/cmd/Makefile
+4
-0
build.sh
plugin/dapp/guess/cmd/build.sh
+15
-0
test-rpc.sh
plugin/dapp/guess/cmd/build/test-rpc.sh
+307
-0
guess.go
plugin/dapp/guess/executor/guess.go
+5
-0
No files found.
build/dapp-test-common.sh
View file @
8584c38f
...
...
@@ -106,7 +106,7 @@ chain33_ImportPrivkey() {
local
req
=
'"method":"Chain33.ImportPrivkey", "params":[{"privkey":"'
"
$pri
"
'", "label":"'
"
$label
"
'"}]'
resp
=
$(
curl
-ksd
"{
$req
}"
"
$MAIN_HTTP
"
)
ok
=
$(
jq
'(
.error|not) and (.result.label=="'
"
$label
"
'") and (.result.acc.addr == "'
"
$acc
"
'"
)'
<<<
"
$resp
"
)
ok
=
$(
jq
'(
((.error|not) and (.result.label=="'
"
$label
"
'") and (.result.acc.addr == "'
"
$acc
"
'")) or (.error=="ErrPrivkeyExist")
)'
<<<
"
$resp
"
)
[
"
$ok
"
==
true
]
}
...
...
@@ -125,3 +125,28 @@ chain33_SignRawTx() {
echo
"signedTx null error"
fi
}
chain33_QueryBalance
()
{
local
addr
=
$1
local
MAIN_HTTP
=
$2
req
=
'"method":"Chain33.GetAllExecBalance","params":[{"addr":"'
"
${
addr
}
"
'"}]'
#echo "#request: $req"
resp
=
$(
curl
-ksd
"{
$req
}"
"
${
MAIN_HTTP
}
"
)
echo
"#response:
$resp
"
ok
=
$(
jq
'(.error|not) and (.result != "")'
<<<
"
$resp
"
)
[
"
$ok
"
==
true
]
echo
"
$resp
"
| jq
-r
".result"
}
chain33_QueryExecBalance
()
{
local
addr
=
$1
local exec
=
$2
local
MAIN_HTTP
=
$3
req
=
'{"method":"Chain33.GetBalance", "params":[{"addresses" : ["'
"
${
addr
}
"
'"], "execer" : "'
"
${
exec
}
"
'"}]}'
resp
=
$(
curl
-ksd
"
$req
"
"
${
MAIN_HTTP
}
"
)
echo
"#response:
$resp
"
ok
=
$(
jq
'(.error|not) and (.result[0] | [has("balance", "frozen"), true] | unique | length == 1)'
<<<
"
$resp
"
)
[
"
$ok
"
==
true
]
}
build/docker-compose.sh
View file @
8584c38f
...
...
@@ -398,7 +398,8 @@ function main() {
dapp_run config
### test cases ###
ip
=
$(${
CLI
}
net info | jq
-r
".externalAddr[0:10]"
)
ip
=
$(${
CLI
}
net info | jq
-r
".externalAddr"
)
ip
=
$(
echo
"
$ip
"
|
cut
-d
':'
-f
1
)
dapp_run
test
"
${
ip
}
"
### rpc test ###
...
...
plugin/dapp/guess/cmd/Makefile
0 → 100644
View file @
8584c38f
all
:
chmod
+x ./build.sh
./build.sh
$(OUT)
$(FLAG)
\ No newline at end of file
plugin/dapp/guess/cmd/build.sh
0 → 100755
View file @
8584c38f
#!/usr/bin/env bash
strpwd
=
$(
pwd
)
strcmd
=
${
strpwd
##*dapp/
}
strapp
=
${
strcmd
%/cmd*
}
OUT_DIR
=
"
${
1
}
/
$strapp
"
#FLAG=$2
mkdir
-p
"
${
OUT_DIR
}
"
cp
./build/
*
"
${
OUT_DIR
}
"
OUT_TESTDIR
=
"
${
1
}
/dapptest/
$strapp
"
mkdir
-p
"
${
OUT_TESTDIR
}
"
chmod
+x ./build/test-rpc.sh
cp
./build/test-rpc.sh
"
${
OUT_TESTDIR
}
"
plugin/dapp/guess/cmd/build/test-rpc.sh
0 → 100755
View file @
8584c38f
This diff is collapsed.
Click to expand it.
plugin/dapp/guess/executor/guess.go
View file @
8584c38f
...
...
@@ -47,6 +47,11 @@ func GetName() string {
return
newGuessGame
()
.
GetName
()
}
//ExecutorOrder Exec 的时候 同时执行 ExecLocal
func
(
g
*
Guess
)
ExecutorOrder
()
int64
{
return
drivers
.
ExecLocalSameTime
}
//GetDriverName 获取Guess执行器的名称
func
(
g
*
Guess
)
GetDriverName
()
string
{
return
gty
.
GuessX
...
...
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