Browse Source

fix tests

pull/364/head
Ethan Buchman 8 years ago
parent
commit
814ef37f75
8 changed files with 24 additions and 11 deletions
  1. +6
    -0
      consensus/replay_test.go
  2. +1
    -1
      rpc/core/mempool.go
  3. +1
    -0
      test/app/clean.sh
  4. +1
    -1
      test/app/counter_test.sh
  5. +11
    -5
      test/app/dummy_test.sh
  6. +2
    -2
      test/p2p/atomic_broadcast/test.sh
  7. +1
    -1
      test/persist/test_failure_indices.sh
  8. +1
    -1
      test/persist/test_simple.sh

+ 6
- 0
consensus/replay_test.go View File

@ -9,11 +9,17 @@ import (
"testing" "testing"
"time" "time"
"github.com/tendermint/tendermint/config/tendermint_test"
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
"github.com/tendermint/go-wire" "github.com/tendermint/go-wire"
"github.com/tendermint/tendermint/types" "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, // 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. // 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 // It would be better to verify explicitly which states we can recover from without the wal


+ 1
- 1
rpc/core/mempool.go View File

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


+ 1
- 0
test/app/clean.sh View File

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

+ 1
- 1
test/app/counter_test.sh View File

@ -29,7 +29,7 @@ function getCode() {
function sendTx() { function sendTx() {
TX=$1 TX=$1
if [[ "$GRPC_BROADCAST_TX" == "" ]]; then 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 $RESPONSE | jq .error`
ERROR=$(echo "$ERROR" | tr -d '"') # remove surrounding quotes ERROR=$(echo "$ERROR" | tr -d '"') # remove surrounding quotes


+ 11
- 5
test/app/dummy_test.sh View File

@ -2,7 +2,8 @@
set -e set -e
function toHex() { 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 # store key value pair
KEY="abcd" KEY="abcd"
VALUE="dcba" 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 $?
echo "" echo ""
@ -22,8 +24,10 @@ echo ""
# test using the tmsp-cli # test using the tmsp-cli
########################### ###########################
echo "... testing query with 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\"`
set +e set +e
A=`echo $RESPONSE | grep '"exists":true'` A=`echo $RESPONSE | grep '"exists":true'`
@ -35,7 +39,7 @@ fi
set -e set -e
# we should not be able to look up the value # we should not be able to look up the value
RESPONSE=`tmsp-cli query $VALUE`
RESPONSE=`tmsp-cli query \"$VALUE\"`
set +e set +e
A=`echo $RESPONSE | grep '"exists":true'` A=`echo $RESPONSE | grep '"exists":true'`
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
@ -49,8 +53,10 @@ set -e
# test using the /tmsp_query # test using the /tmsp_query
############################# #############################
echo "... testing query with /tmsp_query"
# we should be able to look up the key # 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` RESPONSE=`echo $RESPONSE | jq .result[1].result.Data | xxd -r -p`
set +e set +e


+ 2
- 2
test/p2p/atomic_broadcast/test.sh View File

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


+ 1
- 1
test/persist/test_failure_indices.sh View File

@ -46,7 +46,7 @@ function send_txs(){
for i in `seq 1 5`; do for i in `seq 1 5`; do
for j in `seq 1 100`; do for j in `seq 1 100`; do
tx=`head -c 8 /dev/urandom | hexdump -ve '1/1 "%.2X"'` 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 done
sleep 1 sleep 1
done done


+ 1
- 1
test/persist/test_simple.sh View File

@ -27,7 +27,7 @@ function send_txs(){
for i in `seq 1 5`; do for i in `seq 1 5`; do
for j in `seq 1 100`; do for j in `seq 1 100`; do
tx=`head -c 8 /dev/urandom | hexdump -ve '1/1 "%.2X"'` 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 done
sleep 1 sleep 1
done done


Loading…
Cancel
Save