fix tests

This commit is contained in:
Ethan Buchman
2017-01-12 10:58:44 -05:00
parent 56341de5eb
commit 814ef37f75
8 changed files with 24 additions and 11 deletions

View File

@@ -9,11 +9,17 @@ import (
"testing"
"time"
"github.com/tendermint/tendermint/config/tendermint_test"
. "github.com/tendermint/go-common"
"github.com/tendermint/go-wire"
"github.com/tendermint/tendermint/types"
)
func init() {
config = tendermint_test.ResetConfig("consensus_replay_test")
}
// TODO: these tests ensure we can always recover from any state of the wal,
// assuming it comes with a correct related state for the priv_validator.json.
// It would be better to verify explicitly which states we can recover from without the wal

View File

@@ -82,7 +82,7 @@ func BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
Data: appendTxRes.Data,
Log: appendTxRes.Log,
}
log.Error("appendtx passed ", "r", appendTxR)
log.Notice("AppendTx passed ", "tx", []byte(tx), "response", appendTxR)
return &ctypes.ResultBroadcastTxCommit{
CheckTx: checkTxR,
AppendTx: appendTxR,

View File

@@ -1,3 +1,4 @@
killall tendermint
killall dummy
killall counter
rm -rf ~/.tendermint_app

View File

@@ -29,7 +29,7 @@ function getCode() {
function sendTx() {
TX=$1
if [[ "$GRPC_BROADCAST_TX" == "" ]]; then
RESPONSE=`curl -s localhost:46657/broadcast_tx_commit?tx=\"$TX\"`
RESPONSE=`curl -s localhost:46657/broadcast_tx_commit?tx=0x$TX`
ERROR=`echo $RESPONSE | jq .error`
ERROR=$(echo "$ERROR" | tr -d '"') # remove surrounding quotes

View File

@@ -2,7 +2,8 @@
set -e
function toHex() {
echo -n $1 | hexdump -ve '1/1 "%.2X"'
echo -n $1 | hexdump -ve '1/1 "%.2X"' | awk '{print "0x" $0}'
}
#####################
@@ -13,7 +14,8 @@ TESTNAME=$1
# store key value pair
KEY="abcd"
VALUE="dcba"
curl -s 127.0.0.1:46657/broadcast_tx_commit?tx=\"$(toHex $KEY=$VALUE)\"
echo $(toHex $KEY=$VALUE)
curl -s 127.0.0.1:46657/broadcast_tx_commit?tx=$(toHex $KEY=$VALUE)
echo $?
echo ""
@@ -22,8 +24,10 @@ echo ""
# test using the tmsp-cli
###########################
echo "... testing query with tmsp-cli"
# we should be able to look up the key
RESPONSE=`tmsp-cli query $KEY`
RESPONSE=`tmsp-cli query \"$KEY\"`
set +e
A=`echo $RESPONSE | grep '"exists":true'`
@@ -35,7 +39,7 @@ fi
set -e
# we should not be able to look up the value
RESPONSE=`tmsp-cli query $VALUE`
RESPONSE=`tmsp-cli query \"$VALUE\"`
set +e
A=`echo $RESPONSE | grep '"exists":true'`
if [[ $? == 0 ]]; then
@@ -49,8 +53,10 @@ set -e
# test using the /tmsp_query
#############################
echo "... testing query with /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=`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

View File

@@ -20,9 +20,9 @@ for i in `seq 1 $N`; do
HASH1=`curl -s $addr/status | jq .result[1].latest_app_hash`
# - send a tx
TX=\"aadeadbeefbeefbeef0$i\"
TX=aadeadbeefbeefbeef0$i
echo "Broadcast Tx $TX"
curl -s $addr/broadcast_tx_commit?tx=$TX
curl -s $addr/broadcast_tx_commit?tx=0x$TX
echo ""
# we need to wait another block to get the new app_hash

View File

@@ -46,7 +46,7 @@ function send_txs(){
for i in `seq 1 5`; do
for j in `seq 1 100`; do
tx=`head -c 8 /dev/urandom | hexdump -ve '1/1 "%.2X"'`
curl -s $addr/broadcast_tx_async?tx=\"$tx\" &> /dev/null
curl -s $addr/broadcast_tx_async?tx=0x$tx &> /dev/null
done
sleep 1
done

View File

@@ -27,7 +27,7 @@ function send_txs(){
for i in `seq 1 5`; do
for j in `seq 1 100`; do
tx=`head -c 8 /dev/urandom | hexdump -ve '1/1 "%.2X"'`
curl -s 127.0.0.1:46657/broadcast_tx_async?tx=\"$tx\" &> /dev/null
curl -s 127.0.0.1:46657/broadcast_tx_async?tx=0x$tx &> /dev/null
done
sleep 1
done