|
@ -13,10 +13,15 @@ TESTNAME=$1 |
|
|
# store key value pair |
|
|
# store key value pair |
|
|
KEY="abcd" |
|
|
KEY="abcd" |
|
|
VALUE="dcba" |
|
|
VALUE="dcba" |
|
|
curl 127.0.0.1:46657/broadcast_tx_commit?tx=\"$(toHex $KEY=$VALUE)\" |
|
|
|
|
|
|
|
|
curl -s 127.0.0.1:46657/broadcast_tx_commit?tx=\"$(toHex $KEY=$VALUE)\" |
|
|
echo $? |
|
|
echo $? |
|
|
echo "" |
|
|
echo "" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
########################### |
|
|
|
|
|
# test using the tmsp-cli |
|
|
|
|
|
########################### |
|
|
|
|
|
|
|
|
# we should be able to look up the key |
|
|
# we should be able to look up the key |
|
|
RESPONSE=`tmsp-cli query $KEY` |
|
|
RESPONSE=`tmsp-cli query $KEY` |
|
|
|
|
|
|
|
@ -40,4 +45,34 @@ if [[ $? == 0 ]]; then |
|
|
fi |
|
|
fi |
|
|
set -e |
|
|
set -e |
|
|
|
|
|
|
|
|
|
|
|
############################# |
|
|
|
|
|
# test using the /tmsp_query |
|
|
|
|
|
############################# |
|
|
|
|
|
|
|
|
|
|
|
# we should be able to look up the key |
|
|
|
|
|
RESPONSE=`curl -s 127.0.0.1:46657/tmsp_query?query=\"$(toHex $KEY)\"` |
|
|
|
|
|
RESPONSE=`echo $RESPONSE | jq .result[1].result.Data | xxd -r -p` |
|
|
|
|
|
|
|
|
|
|
|
set +e |
|
|
|
|
|
A=`echo $RESPONSE | grep exists=true` |
|
|
|
|
|
if [[ $? != 0 ]]; then |
|
|
|
|
|
echo "Failed to find 'exists=true' for $KEY. Response:" |
|
|
|
|
|
echo "$RESPONSE" |
|
|
|
|
|
exit 1 |
|
|
|
|
|
fi |
|
|
|
|
|
set -e |
|
|
|
|
|
|
|
|
|
|
|
# we should not be able to look up the value |
|
|
|
|
|
RESPONSE=`curl -s 127.0.0.1:46657/tmsp_query?query=\"$(toHex $VALUE)\"` |
|
|
|
|
|
RESPONSE=`echo $RESPONSE | jq .result[1].result.Data | xxd -r -p` |
|
|
|
|
|
set +e |
|
|
|
|
|
A=`echo $RESPONSE | grep exists=true` |
|
|
|
|
|
if [[ $? == 0 ]]; then |
|
|
|
|
|
echo "Found 'exists=true' for $VALUE when we should not have. Response:" |
|
|
|
|
|
echo "$RESPONSE" |
|
|
|
|
|
exit 1 |
|
|
|
|
|
fi |
|
|
|
|
|
set -e |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "Passed Test: $TESTNAME" |
|
|
echo "Passed Test: $TESTNAME" |