mirror of
https://github.com/fluencelabs/tendermint
synced 2025-07-31 20:21:56 +00:00
bash tests for broadcast_tx through rpc
This commit is contained in:
34
test/rpc/dummy_test.sh
Normal file
34
test/rpc/dummy_test.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
#! /bin/bash
|
||||
|
||||
function toHex() {
|
||||
echo -n $1 | hexdump -ve '1/1 "%.2X"'
|
||||
}
|
||||
|
||||
#####################
|
||||
# dummy with curl
|
||||
#####################
|
||||
TESTNAME=$1
|
||||
|
||||
# store key value pair
|
||||
KEY="abcd"
|
||||
VALUE="dcba"
|
||||
curl localhost:46657/broadcast_tx_commit?tx=\"$(toHex $KEY=$VALUE)\"
|
||||
echo ""
|
||||
|
||||
# we should be able to look up the key
|
||||
RESPONSE=`tmsp-cli query $KEY`
|
||||
A=`echo $RESPONSE | grep exists=true`
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to find 'exists=true' for $KEY. Response:"
|
||||
echo "$RESPONSE"
|
||||
fi
|
||||
|
||||
# we should not be able to look up the value
|
||||
RESPONSE=`tmsp-cli query $VALUE`
|
||||
A=`echo $RESPONSE | grep exists=true`
|
||||
if [[ $? == 0 ]]; then
|
||||
echo "Found 'exists=true' for $VALUE when we should not have. Response:"
|
||||
echo "$RESPONSE"
|
||||
fi
|
||||
|
||||
echo "Passed Test: $TESTNAME"
|
Reference in New Issue
Block a user