diff --git a/consensus/state.go b/consensus/state.go index 50488f8d1..f89de3921 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -1236,6 +1236,7 @@ func (cs *ConsensusState) finalizeCommit(height int) { } // txs committed, bad ones removed from mepool; fire events + // NOTE: the block.AppHash wont reflect these txs until the next block eventCache.Flush() // Save to blockStore. diff --git a/scripts/glide/parse.sh b/scripts/glide/parse.sh new file mode 100644 index 000000000..a2f68d540 --- /dev/null +++ b/scripts/glide/parse.sh @@ -0,0 +1,7 @@ +#! /bin/bash +set -euo pipefail + +GLIDE=$1 +LIB=$2 + +cat $GLIDE | grep -A1 $LIB | grep -v $LIB | awk '{print $2}' diff --git a/scripts/glide/glide_status.sh b/scripts/glide/status.sh similarity index 100% rename from scripts/glide/glide_status.sh rename to scripts/glide/status.sh diff --git a/scripts/glide/glide_update.sh b/scripts/glide/update.sh similarity index 67% rename from scripts/glide/glide_update.sh rename to scripts/glide/update.sh index 2d78da4f3..630859d84 100644 --- a/scripts/glide/glide_update.sh +++ b/scripts/glide/update.sh @@ -7,12 +7,7 @@ IFS=$'\n\t' GLIDE=$1 LIB=$2 -# get vendored commit for given lib -function parseGlide() { - cat $1 | grep -A1 $2 | grep -v $2 | awk '{print $2}' -} - -OLD_COMMIT=`parseGlide $GLIDE $LIB` +OLD_COMMIT=`bash scripts/glide/parse.sh $GLIDE $LIB` PWD=`pwd` cd $GOPATH/src/github.com/tendermint/$LIB diff --git a/scripts/install_tmsp_apps.sh b/scripts/install_tmsp_apps.sh new file mode 100644 index 000000000..035bc8d3e --- /dev/null +++ b/scripts/install_tmsp_apps.sh @@ -0,0 +1,11 @@ +#! /bin/bash + +go get github.com/tendermint/tmsp/... + +COMMIT=`bash scripts/glide/parse.sh $(pwd)/glide.lock tmsp` + +cd $GOPATH/src/github.com/tendermint/tmsp +git checkout $COMMIT +go install ./cmd/... + + diff --git a/test/Dockerfile b/test/Dockerfile index 9978d3674..26995de38 100644 --- a/test/Dockerfile +++ b/test/Dockerfile @@ -1,7 +1,23 @@ # Pull base image. FROM golang:1.6 +# Grab deps (jq, hexdump) +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + jq bsdmainutils && \ + rm -rf /var/lib/apt/lists/* + ENV TENDERMINT_ORG $GOPATH/src/github.com/tendermint/ RUN mkdir -p $TENDERMINT_ORG COPY . $TENDERMINT_ORG/tendermint WORKDIR $TENDERMINT_ORG/tendermint + +RUN make get_vendor_deps + +RUN go install ./cmd/tendermint + +RUN bash scripts/install_tmsp_apps.sh + + +EXPOSE 46656 +EXPOSE 46657 diff --git a/test/rpc/clean.sh b/test/broadcast_tx/clean.sh similarity index 100% rename from test/rpc/clean.sh rename to test/broadcast_tx/clean.sh diff --git a/test/rpc/counter_test.sh b/test/broadcast_tx/counter_test.sh similarity index 100% rename from test/rpc/counter_test.sh rename to test/broadcast_tx/counter_test.sh diff --git a/test/rpc/dummy_test.sh b/test/broadcast_tx/dummy_test.sh similarity index 84% rename from test/rpc/dummy_test.sh rename to test/broadcast_tx/dummy_test.sh index 9410c88da..d294e56f8 100644 --- a/test/rpc/dummy_test.sh +++ b/test/broadcast_tx/dummy_test.sh @@ -1,4 +1,5 @@ #! /bin/bash +set -e function toHex() { echo -n $1 | hexdump -ve '1/1 "%.2X"' @@ -12,23 +13,31 @@ TESTNAME=$1 # store key value pair KEY="abcd" VALUE="dcba" -curl localhost:46657/broadcast_tx_commit?tx=\"$(toHex $KEY=$VALUE)\" +curl 127.0.0.1:46657/broadcast_tx_commit?tx=\"$(toHex $KEY=$VALUE)\" +echo $? echo "" # we should be able to look up the key RESPONSE=`tmsp-cli query $KEY` + +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=`tmsp-cli query $VALUE` +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" diff --git a/test/rpc/test.sh b/test/broadcast_tx/test.sh similarity index 55% rename from test/rpc/test.sh rename to test/broadcast_tx/test.sh index f31b19c55..ee31d34da 100644 --- a/test/rpc/test.sh +++ b/test/broadcast_tx/test.sh @@ -8,37 +8,59 @@ set -e # TODO: install everything +export TMROOT=$HOME/.tendermint_broadcast_tx + function dummy_over_socket(){ + rm -rf $TMROOT + tendermint init + echo "Starting dummy and tendermint" dummy > /dev/null & + pid_dummy=$! tendermint node > tendermint.log & - sleep 3 + pid_tendermint=$! + sleep 5 + echo "running test" bash dummy_test.sh "Dummy over Socket" - killall dummy tendermint + kill -9 $pid_dummy $pid_tendermint } function counter_over_socket() { + rm -rf $TMROOT + tendermint init + echo "Starting counter and tendermint" counter --serial > /dev/null & + pid_counter=$! tendermint node > tendermint.log & - sleep 3 + pid_tendermint=$! + sleep 5 + echo "running test" bash counter_test.sh "Counter over Socket" - killall counter tendermint + kill -9 $pid_counter $pid_tendermint } function counter_over_grpc() { + rm -rf $TMROOT + tendermint init + echo "Starting counter and tendermint" counter --serial --tmsp grpc > /dev/null & + pid_counter=$! tendermint node --tmsp grpc > tendermint.log & - sleep 3 + pid_tendermint=$! + sleep 5 + echo "running test" bash counter_test.sh "Counter over GRPC" - killall counter tendermint + kill -9 $pid_counter $pid_tendermint } +cd $GOPATH/src/github.com/tendermint/tendermint/test/broadcast_tx + case "$1" in "dummy_over_socket") dummy_over_socket @@ -50,8 +72,11 @@ case "$1" in counter_over_grpc ;; *) + echo "Running all" dummy_over_socket + echo "" counter_over_socket + echo "" counter_over_grpc esac diff --git a/test/p2p/clean.sh b/test/p2p/clean.sh new file mode 100644 index 000000000..e0fb36956 --- /dev/null +++ b/test/p2p/clean.sh @@ -0,0 +1,4 @@ +#! /bin/bash + +docker rm -vf $(docker ps -aq) +docker network rm local_testnet diff --git a/test/p2p/data/app/init.sh b/test/p2p/data/app/init.sh new file mode 100755 index 000000000..abaccae43 --- /dev/null +++ b/test/p2p/data/app/init.sh @@ -0,0 +1,9 @@ +#! /bin/bash +# This is a sample bash script for a TMSP application + +cd app/ +git clone https://github.com/tendermint/nomnomcoin.git +cd nomnomcoin +npm install . + +node app.js --eyes="unix:///data/tendermint/data/data.sock" \ No newline at end of file diff --git a/test/p2p/data/chain_config.json b/test/p2p/data/chain_config.json new file mode 100644 index 000000000..54fcea524 --- /dev/null +++ b/test/p2p/data/chain_config.json @@ -0,0 +1,53 @@ +{ + "id": "", + "val_set_id": "anon", + "validators": [ + { + "validator": { + "id": "mach1", + "pub_key": [ + 1, + "BE8933DFF1600C026E34718F1785A4CDEAB90C35698B394E38B6947AE91DE116" + ] + }, + "p2p_addr": "", + "rpc_addr": "" + }, + { + "validator": { + "id": "mach2", + "pub_key": [ + 1, + "6DC534465323126587D2A2A93B59D689B717073B1DE968A25A6EF13D595318AD" + ] + }, + "p2p_addr": "", + "rpc_addr": "", + "index": 1 + }, + { + "validator": { + "id": "mach3", + "pub_key": [ + 1, + "AE67AC697D135AA0B4601EA57EAAB3FEBF4BAA4F229C45A598C2985B12FCD1A1" + ] + }, + "p2p_addr": "", + "rpc_addr": "", + "index": 2 + }, + { + "validator": { + "id": "mach4", + "pub_key": [ + 1, + "9EBC8F58CED4B46DCD5AB8ABA591DD253CD7CB5037273FDA32BC0B6461C4EFD9" + ] + }, + "p2p_addr": "", + "rpc_addr": "", + "index": 3 + } + ] +} \ No newline at end of file diff --git a/test/p2p/data/core/init.sh b/test/p2p/data/core/init.sh new file mode 100755 index 000000000..95db91191 --- /dev/null +++ b/test/p2p/data/core/init.sh @@ -0,0 +1,20 @@ +#! /bin/bash +# This is a sample bash script for tendermint core +# Edit this script before "mintnet start" to change +# the core blockchain engine. + +TMREPO="github.com/tendermint/tendermint" +BRANCH="master" + +go get -d $TMREPO/cmd/tendermint +### DEPENDENCIES (example) +# cd $GOPATH/src/github.com/tendermint/tmsp +# git fetch origin $BRANCH +# git checkout $BRANCH +### DEPENDENCIES END +cd $GOPATH/src/$TMREPO +git fetch origin $BRANCH +git checkout $BRANCH +make install + +tendermint node --seeds="$TMSEEDS" --moniker="$TMNAME" --proxy_app="$PROXYAPP" \ No newline at end of file diff --git a/test/p2p/data/data/init.sh b/test/p2p/data/data/init.sh new file mode 100755 index 000000000..41122a547 --- /dev/null +++ b/test/p2p/data/data/init.sh @@ -0,0 +1,7 @@ +#! /bin/bash +# This is a sample bash script for MerkleEyes. +# NOTE: mintnet expects data.sock to be created + +go get github.com/tendermint/merkleeyes/cmd/merkleeyes + +merkleeyes server --address="unix:///data/tendermint/data/data.sock" \ No newline at end of file diff --git a/test/p2p/data/mach1/core/genesis.json b/test/p2p/data/mach1/core/genesis.json new file mode 100644 index 000000000..3f6fbe5a2 --- /dev/null +++ b/test/p2p/data/mach1/core/genesis.json @@ -0,0 +1,39 @@ +{ + "app_hash": "", + "chain_id": "chain-9ujDWI", + "genesis_time": "2016-06-24T20:01:19.322Z", + "validators": [ + { + "amount": 1, + "name": "mach1", + "pub_key": [ + 1, + "BE8933DFF1600C026E34718F1785A4CDEAB90C35698B394E38B6947AE91DE116" + ] + }, + { + "amount": 1, + "name": "mach2", + "pub_key": [ + 1, + "6DC534465323126587D2A2A93B59D689B717073B1DE968A25A6EF13D595318AD" + ] + }, + { + "amount": 1, + "name": "mach3", + "pub_key": [ + 1, + "AE67AC697D135AA0B4601EA57EAAB3FEBF4BAA4F229C45A598C2985B12FCD1A1" + ] + }, + { + "amount": 1, + "name": "mach4", + "pub_key": [ + 1, + "9EBC8F58CED4B46DCD5AB8ABA591DD253CD7CB5037273FDA32BC0B6461C4EFD9" + ] + } + ] +} \ No newline at end of file diff --git a/test/p2p/data/mach1/core/priv_validator.json b/test/p2p/data/mach1/core/priv_validator.json new file mode 100644 index 000000000..242c7b9fc --- /dev/null +++ b/test/p2p/data/mach1/core/priv_validator.json @@ -0,0 +1,14 @@ +{ + "address": "0E6925C3EE4C599DFF1536A5071AF4A26DF33635", + "last_height": 0, + "last_round": 0, + "last_step": 0, + "priv_key": [ + 1, + "547AA07C7A8CE16C5CB2A40C6C26D15B0A32960410A9F1EA6E50B636F1AB389ABE8933DFF1600C026E34718F1785A4CDEAB90C35698B394E38B6947AE91DE116" + ], + "pub_key": [ + 1, + "BE8933DFF1600C026E34718F1785A4CDEAB90C35698B394E38B6947AE91DE116" + ] +} \ No newline at end of file diff --git a/test/p2p/data/mach2/core/genesis.json b/test/p2p/data/mach2/core/genesis.json new file mode 100644 index 000000000..3f6fbe5a2 --- /dev/null +++ b/test/p2p/data/mach2/core/genesis.json @@ -0,0 +1,39 @@ +{ + "app_hash": "", + "chain_id": "chain-9ujDWI", + "genesis_time": "2016-06-24T20:01:19.322Z", + "validators": [ + { + "amount": 1, + "name": "mach1", + "pub_key": [ + 1, + "BE8933DFF1600C026E34718F1785A4CDEAB90C35698B394E38B6947AE91DE116" + ] + }, + { + "amount": 1, + "name": "mach2", + "pub_key": [ + 1, + "6DC534465323126587D2A2A93B59D689B717073B1DE968A25A6EF13D595318AD" + ] + }, + { + "amount": 1, + "name": "mach3", + "pub_key": [ + 1, + "AE67AC697D135AA0B4601EA57EAAB3FEBF4BAA4F229C45A598C2985B12FCD1A1" + ] + }, + { + "amount": 1, + "name": "mach4", + "pub_key": [ + 1, + "9EBC8F58CED4B46DCD5AB8ABA591DD253CD7CB5037273FDA32BC0B6461C4EFD9" + ] + } + ] +} \ No newline at end of file diff --git a/test/p2p/data/mach2/core/priv_validator.json b/test/p2p/data/mach2/core/priv_validator.json new file mode 100644 index 000000000..ead45d5e6 --- /dev/null +++ b/test/p2p/data/mach2/core/priv_validator.json @@ -0,0 +1,14 @@ +{ + "address": "99DBBD2AFC28FB5BAC5574AFAF0D9C806CED3B55", + "last_height": 0, + "last_round": 0, + "last_step": 0, + "priv_key": [ + 1, + "D047889E60502FC3129D0AB7F334B1838ED9ED1ECD99CBB96B71AD5ABF5A81436DC534465323126587D2A2A93B59D689B717073B1DE968A25A6EF13D595318AD" + ], + "pub_key": [ + 1, + "6DC534465323126587D2A2A93B59D689B717073B1DE968A25A6EF13D595318AD" + ] +} \ No newline at end of file diff --git a/test/p2p/data/mach3/core/genesis.json b/test/p2p/data/mach3/core/genesis.json new file mode 100644 index 000000000..3f6fbe5a2 --- /dev/null +++ b/test/p2p/data/mach3/core/genesis.json @@ -0,0 +1,39 @@ +{ + "app_hash": "", + "chain_id": "chain-9ujDWI", + "genesis_time": "2016-06-24T20:01:19.322Z", + "validators": [ + { + "amount": 1, + "name": "mach1", + "pub_key": [ + 1, + "BE8933DFF1600C026E34718F1785A4CDEAB90C35698B394E38B6947AE91DE116" + ] + }, + { + "amount": 1, + "name": "mach2", + "pub_key": [ + 1, + "6DC534465323126587D2A2A93B59D689B717073B1DE968A25A6EF13D595318AD" + ] + }, + { + "amount": 1, + "name": "mach3", + "pub_key": [ + 1, + "AE67AC697D135AA0B4601EA57EAAB3FEBF4BAA4F229C45A598C2985B12FCD1A1" + ] + }, + { + "amount": 1, + "name": "mach4", + "pub_key": [ + 1, + "9EBC8F58CED4B46DCD5AB8ABA591DD253CD7CB5037273FDA32BC0B6461C4EFD9" + ] + } + ] +} \ No newline at end of file diff --git a/test/p2p/data/mach3/core/priv_validator.json b/test/p2p/data/mach3/core/priv_validator.json new file mode 100644 index 000000000..dd366d205 --- /dev/null +++ b/test/p2p/data/mach3/core/priv_validator.json @@ -0,0 +1,14 @@ +{ + "address": "4C5F061DAC28660853904A66705B12CA2B317572", + "last_height": 0, + "last_round": 0, + "last_step": 0, + "priv_key": [ + 1, + "C1A4E47F349FC5F556F4A9A27BA776B94424C312BAA6CF6EE44B867348D7C3F2AE67AC697D135AA0B4601EA57EAAB3FEBF4BAA4F229C45A598C2985B12FCD1A1" + ], + "pub_key": [ + 1, + "AE67AC697D135AA0B4601EA57EAAB3FEBF4BAA4F229C45A598C2985B12FCD1A1" + ] +} \ No newline at end of file diff --git a/test/p2p/data/mach4/core/genesis.json b/test/p2p/data/mach4/core/genesis.json new file mode 100644 index 000000000..3f6fbe5a2 --- /dev/null +++ b/test/p2p/data/mach4/core/genesis.json @@ -0,0 +1,39 @@ +{ + "app_hash": "", + "chain_id": "chain-9ujDWI", + "genesis_time": "2016-06-24T20:01:19.322Z", + "validators": [ + { + "amount": 1, + "name": "mach1", + "pub_key": [ + 1, + "BE8933DFF1600C026E34718F1785A4CDEAB90C35698B394E38B6947AE91DE116" + ] + }, + { + "amount": 1, + "name": "mach2", + "pub_key": [ + 1, + "6DC534465323126587D2A2A93B59D689B717073B1DE968A25A6EF13D595318AD" + ] + }, + { + "amount": 1, + "name": "mach3", + "pub_key": [ + 1, + "AE67AC697D135AA0B4601EA57EAAB3FEBF4BAA4F229C45A598C2985B12FCD1A1" + ] + }, + { + "amount": 1, + "name": "mach4", + "pub_key": [ + 1, + "9EBC8F58CED4B46DCD5AB8ABA591DD253CD7CB5037273FDA32BC0B6461C4EFD9" + ] + } + ] +} \ No newline at end of file diff --git a/test/p2p/data/mach4/core/priv_validator.json b/test/p2p/data/mach4/core/priv_validator.json new file mode 100644 index 000000000..4a73707e8 --- /dev/null +++ b/test/p2p/data/mach4/core/priv_validator.json @@ -0,0 +1,14 @@ +{ + "address": "86F6DA4B34F16D743D2D992B5ACB12F5E724CC2D", + "last_height": 0, + "last_round": 0, + "last_step": 0, + "priv_key": [ + 1, + "C4CC3ED28F020C2DBDA98BCDBF08C3CED370470E74F25E938D5D295E8E3D2B0C9EBC8F58CED4B46DCD5AB8ABA591DD253CD7CB5037273FDA32BC0B6461C4EFD9" + ], + "pub_key": [ + 1, + "9EBC8F58CED4B46DCD5AB8ABA591DD253CD7CB5037273FDA32BC0B6461C4EFD9" + ] +} \ No newline at end of file diff --git a/test/p2p/local_testnet.sh b/test/p2p/local_testnet.sh new file mode 100644 index 000000000..2b4183b95 --- /dev/null +++ b/test/p2p/local_testnet.sh @@ -0,0 +1,28 @@ +#! /bin/bash +set -eu + +DOCKER_IMAGE=$1 +NETWORK_NAME=$2 + +cd $GOPATH/src/github.com/tendermint/tendermint + +# create docker network +docker network create --driver bridge --subnet 172.57.0.0/16 $NETWORK_NAME + +N=4 +seeds="172.57.0.101:46656" +for i in `seq 2 $N`; do + seeds="$seeds,172.57.0.$((100+$i)):46656" +done +echo "Seeds: $seeds" + +for i in `seq 1 $N`; do + # start tendermint container + docker run -d \ + --net=$NETWORK_NAME \ + --ip=172.57.0.$((100+$i)) \ + --name local_testnet_$i \ + --entrypoint tendermint \ + -e TMROOT=/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$i/core \ + $DOCKER_IMAGE node --seeds $seeds --proxy_app=dummy +done diff --git a/test/p2p/run_test.sh b/test/p2p/run_test.sh new file mode 100644 index 000000000..87ab8e1f7 --- /dev/null +++ b/test/p2p/run_test.sh @@ -0,0 +1,79 @@ +#! /bin/bash + +# wait for everyone to come online +echo "Waiting for nodes to come online" +for i in `seq 1 4`; do + addr="172.57.0.$((100+$i)):46657" + curl -s $addr/status > /dev/null + ERR=$? + while [ "$ERR" != 0 ]; do + sleep 1 + curl -s $addr/status > /dev/null + ERR=$? + done + echo "... node $i is up" +done + +echo "" +# run the test on each of them +for i in `seq 1 4`; do + addr="172.57.0.$((100+$i)):46657" + + # - assert everyone has 3 other peers + N_PEERS=`curl -s $addr/net_info | jq '.result[1].peers | length'` + while [ "$N_PEERS" != 3 ]; do + echo "Waiting for node $i to connect to all peers ..." + sleep 1 + N_PEERS=`curl -s $addr/net_info | jq '.result[1].peers | length'` + done + + # - assert block height is greater than 1 + BLOCK_HEIGHT=`curl -s $addr/status | jq .result[1].latest_block_height` + while [ "$BLOCK_HEIGHT" -le 1 ]; do + echo "Waiting for node $i to commit a block ..." + sleep 1 + BLOCK_HEIGHT=`curl -s $addr/status | jq .result[1].latest_block_height` + done + echo "Node $i is connected to all peers and at block $BLOCK_HEIGHT" + + # current state + HASH1=`curl -s $addr/status | jq .result[1].latest_app_hash` + + # - send a tx + TX=\"aadeadbeefbeefbeef0$i\" + echo "Broadcast Tx $TX" + curl -s $addr/broadcast_tx_commit?tx=$TX + echo "" + + # we need to wait another block to get the new app_hash + h1=`curl -s $addr/status | jq .result[1].latest_block_height` + h2=$h1 + while [ "$h2" == "$h1" ]; do + sleep 1 + h2=`curl -s $addr/status | jq .result[1].latest_block_height` + done + + # check that hash was updated + HASH2=`curl -s $addr/status | jq .result[1].latest_app_hash` + if [[ "$HASH1" == "$HASH2" ]]; then + echo "Expected state hash to update from $HASH1. Got $HASH2" + exit 1 + fi + + # check we get the same new hash on all other nodes + for j in `seq 1 4`; do + if [[ "$i" != "$j" ]]; then + HASH3=`curl -s 172.57.0.$((100+$j)):46657/status | jq .result[1].latest_app_hash` + + if [[ "$HASH2" != "$HASH3" ]]; then + echo "App hash for node $j doesn't match. Got $HASH3, expected $HASH2" + exit 1 + fi + fi + done + + echo "All nodes are up to date" +done + +echo "" +echo "PASS" diff --git a/test/p2p/test.sh b/test/p2p/test.sh new file mode 100644 index 000000000..f139fd675 --- /dev/null +++ b/test/p2p/test.sh @@ -0,0 +1,10 @@ +#! /bin/bash + +DOCKER_IMAGE=$1 +NETWORK_NAME=local_testnet + +# start the testnet on a local network +bash test/p2p/local_testnet.sh $DOCKER_IMAGE $NETWORK_NAME + +# run the test +bash test/p2p/test_client.sh $DOCKER_IMAGE $NETWORK_NAME test/p2p/run_test.sh diff --git a/test/p2p/test_client.sh b/test/p2p/test_client.sh new file mode 100644 index 000000000..d9fe64c5c --- /dev/null +++ b/test/p2p/test_client.sh @@ -0,0 +1,16 @@ +#! /bin/bash +set -eu + +DOCKER_IMAGE=$1 +NETWORK_NAME=$2 +CMD=$3 + +# run the test container on the local network +docker run -t \ + --rm \ + -v $GOPATH/src/github.com/tendermint/tendermint/test/p2p/:/go/src/github.com/tendermint/tendermint/test/p2p \ + --net=$NETWORK_NAME \ + --ip=172.57.0.99 \ + --name test_container \ + --entrypoint bash \ + $DOCKER_IMAGE $CMD diff --git a/test/run_test.sh b/test/run_test.sh index 67d1f23ca..a7de6a141 100644 --- a/test/run_test.sh +++ b/test/run_test.sh @@ -1,14 +1,22 @@ #! /bin/bash +set -e echo `pwd` BRANCH=`git rev-parse --abbrev-ref HEAD` echo "Current branch: $BRANCH" -make get_vendor_deps - +# go test --race github.com/tendermint/tendermint/... make test_race +# run the broadcast_tx tests +bash test/broadcast_tx/test.sh + if [[ "$BRANCH" == "master" || "$BRANCH" == "staging" ]]; then + echo "" + echo "* branch $BRANCH; testing libs" + # checkout every github.com/tendermint dir and run its tests bash test/test_libs.sh + + # TODO: mintnet/netmon fi diff --git a/test/test.sh b/test/test.sh index 5c646c27a..83787f82b 100644 --- a/test/test.sh +++ b/test/test.sh @@ -8,5 +8,16 @@ # If we pushed to STAGING or MASTER, # it will also run the tests for all dependencies +echo "" +echo "* building docker file" docker build -t tester -f ./test/Dockerfile . + +echo "" +echo "* running go tests and broadcast tests" docker run -t tester bash test/run_test.sh + +# test basic network connectivity +# by starting a local testnet and checking peers connect and make blocks +echo "" +echo "* running basic peer tests" +bash test/p2p/test.sh tester