From d754d210cda3505ef5db23f93901b091c2692254 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Tue, 21 Feb 2017 01:28:58 -0500 Subject: [PATCH] test: only use syslog on circle --- test/p2p/peer.sh | 36 +++++++++++++++++++--------- test/persist/test_failure_indices.sh | 25 +------------------ test/test.sh | 12 ++++++---- test/utils/txs.sh | 23 ++++++++++++++++++ 4 files changed, 57 insertions(+), 39 deletions(-) create mode 100644 test/utils/txs.sh diff --git a/test/p2p/peer.sh b/test/p2p/peer.sh index 19586b124..7ee942bb5 100644 --- a/test/p2p/peer.sh +++ b/test/p2p/peer.sh @@ -13,16 +13,30 @@ if [[ "$SEEDS" != "" ]]; then SEEDS=" --seeds $SEEDS " fi +set +eu + echo "starting tendermint peer ID=$ID" # start tendermint container on the network -docker run -d \ - --net=$NETWORK_NAME \ - --ip=$(test/p2p/ip.sh $ID) \ - --name local_testnet_$ID \ - --entrypoint tendermint \ - -e TMROOT=/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$ID/core \ - --log-driver=syslog \ - --log-opt syslog-address=udp://127.0.0.1:5514 \ - --log-opt syslog-facility=daemon \ - --log-opt tag="{{.Name}}" \ - $DOCKER_IMAGE node $SEEDS --proxy_app=$APP_PROXY +if [[ "$CIRCLECI" == true ]]; then + set -u + docker run -d \ + --net=$NETWORK_NAME \ + --ip=$(test/p2p/ip.sh $ID) \ + --name local_testnet_$ID \ + --entrypoint tendermint \ + -e TMROOT=/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$ID/core \ + --log-driver=syslog \ + --log-opt syslog-address=udp://127.0.0.1:5514 \ + --log-opt syslog-facility=daemon \ + --log-opt tag="{{.Name}}" \ + $DOCKER_IMAGE node $SEEDS --proxy_app=$APP_PROXY +else + set -u + docker run -d \ + --net=$NETWORK_NAME \ + --ip=$(test/p2p/ip.sh $ID) \ + --name local_testnet_$ID \ + --entrypoint tendermint \ + -e TMROOT=/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$ID/core \ + $DOCKER_IMAGE node $SEEDS --proxy_app=$APP_PROXY +fi diff --git a/test/persist/test_failure_indices.sh b/test/persist/test_failure_indices.sh index 8feb0005c..af29f637c 100644 --- a/test/persist/test_failure_indices.sh +++ b/test/persist/test_failure_indices.sh @@ -46,29 +46,6 @@ function kill_procs(){ } -# wait till node is up, send txs -function send_txs(){ - addr="127.0.0.1:46657" - curl -s $addr/status > /dev/null - ERR=$? - while [ "$ERR" != 0 ]; do - sleep 1 - curl -s $addr/status > /dev/null - ERR=$? - done - - # send a bunch of txs over a few blocks - echo "Node is up, sending txs" - for i in $(seq 1 5); do - for _ in $(seq 1 100); do - tx=$(head -c 8 /dev/urandom | hexdump -ve '1/1 "%.2X"') - curl -s "$addr/broadcast_tx_async?tx=0x$tx" &> /dev/null - done - sleep 1 - done -} - - failsStart=0 fails=$(grep -r "fail.Fail" --include \*.go . | wc -l) failsEnd=$((fails-1)) @@ -78,7 +55,7 @@ for failIndex in $(seq $failsStart $failsEnd); do echo "* Test FailIndex $failIndex" # test failure at failIndex - send_txs & + bash ./test/utils/txs.sh "localhost:46657" & start_procs 1 "$failIndex" # tendermint should fail when it hits the fail index diff --git a/test/test.sh b/test/test.sh index 69c4199dc..1c1faca20 100644 --- a/test/test.sh +++ b/test/test.sh @@ -12,10 +12,14 @@ echo "* [$(date +"%T")] cleaning up $LOGS_DIR" rm -rf "$LOGS_DIR" mkdir -p "$LOGS_DIR" -echo -echo "* [$(date +"%T")] starting rsyslog container" -docker rm -f rsyslog || true -docker run -d -v "$LOGS_DIR:/var/log/" -p 127.0.0.1:5514:514/udp --name rsyslog voxxit/rsyslog +set +u +if [[ "$CIRCLECI" == true ]]; then + set -u + echo + echo "* [$(date +"%T")] starting rsyslog container" + docker rm -f rsyslog || true + docker run -d -v "$LOGS_DIR:/var/log/" -p 127.0.0.1:5514:514/udp --name rsyslog voxxit/rsyslog +fi echo echo "* [$(date +"%T")] building docker image" diff --git a/test/utils/txs.sh b/test/utils/txs.sh new file mode 100644 index 000000000..c49d12c0c --- /dev/null +++ b/test/utils/txs.sh @@ -0,0 +1,23 @@ +#! /bin/bash +set -u + +# wait till node is up, send txs +ADDR=$1 #="127.0.0.1:46657" +curl -s $ADDR/status > /dev/null +ERR=$? +while [ "$ERR" != 0 ]; do + sleep 1 + curl -s $ADDR/status > /dev/null + ERR=$? +done + +# send a bunch of txs over a few blocks +echo "Node is up, sending txs" +for i in $(seq 1 5); do + for _ in $(seq 1 100); do + tx=$(head -c 8 /dev/urandom | hexdump -ve '1/1 "%.2X"') + curl -s "$ADDR/broadcast_tx_async?tx=0x$tx" &> /dev/null + done + echo "sent 100" + sleep 1 +done