Unverified Commit 8584c38f authored by vipwzw's avatar vipwzw Committed by GitHub

Merge pull request #483 from zzh33cn/guess-rpc-test

Guess rpc test
parents e3d68c56 029eadd5
......@@ -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 ]
}
......@@ -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 ###
......
all:
chmod +x ./build.sh
./build.sh $(OUT) $(FLAG)
\ No newline at end of file
#!/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}"
This diff is collapsed.
......@@ -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
......
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