Browse Source

test/persist: wait for ports to be freed

pull/426/head
Ethan Buchman 8 years ago
parent
commit
b13924701e
4 changed files with 56 additions and 31 deletions
  1. +1
    -1
      test/docker/Dockerfile
  2. +27
    -2
      test/persist/test_failure_indices.sh
  3. +10
    -10
      test/run_test.sh
  4. +18
    -18
      test/test.sh

+ 1
- 1
test/docker/Dockerfile View File

@ -4,7 +4,7 @@ FROM golang:1.7.4
# Grab deps (jq, hexdump, xxd, killall)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
jq bsdmainutils vim-common psmisc
jq bsdmainutils vim-common psmisc netcat
# Setup tendermint repo with vendored dependencies
# but without code - docker caching prevents reinstall on code change!


+ 27
- 2
test/persist/test_failure_indices.sh View File

@ -43,6 +43,31 @@ function kill_procs(){
kill -9 "$PID_DUMMY" "$PID_TENDERMINT"
wait "$PID_DUMMY"
wait "$PID_TENDERMINT"
# wait for the ports to be released
wait_for_port 46656
wait_for_port 46657
}
# wait for port to be available
function wait_for_port() {
port=$1
# this will succeed while port is bound
nc -z 127.0.0.1 $port
ERR=$?
i=0
while [ "$ERR" == 0 ]; do
echo "... port $port is still bound. waiting ..."
sleep 1
nc -z 127.0.0.1 $port
ERR=$?
i=$((i + 1))
if [[ $i == 10 ]]; then
echo "Timed out waiting for port to be released"
exit 1
fi
done
echo "... port $port is free!"
}
@ -58,8 +83,8 @@ for failIndex in $(seq $failsStart $failsEnd); do
bash ./test/utils/txs.sh "localhost:46657" &
start_procs 1 "$failIndex"
# tendermint should already have paniced when it hits the fail index
# but kill -9 for OS cleanup
# tendermint should already have exited when it hits the fail index
# but kill -9 for good measure
kill_procs
start_procs 2


+ 10
- 10
test/run_test.sh View File

@ -6,17 +6,17 @@ pwd
BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo "Current branch: $BRANCH"
bash test/test_cover.sh
# run the app tests
bash test/app/test.sh
#bash test/test_cover.sh
#
## run the app tests
#bash test/app/test.sh
# run the persistence test
bash test/persist/test.sh
if [[ "$BRANCH" == "master" || $(echo "$BRANCH" | grep "release-") != "" ]]; then
echo ""
echo "* branch $BRANCH; testing libs"
# checkout every github.com/tendermint dir and run its tests
bash test/test_libs.sh
fi
#if [[ "$BRANCH" == "master" || $(echo "$BRANCH" | grep "release-") != "" ]]; then
# echo ""
# echo "* branch $BRANCH; testing libs"
# # checkout every github.com/tendermint dir and run its tests
# bash test/test_libs.sh
#fi

+ 18
- 18
test/test.sh View File

@ -35,21 +35,21 @@ else
docker run --name run_test -t tester bash test/run_test.sh
fi
# copy the coverage results out of docker container
docker cp run_test:/go/src/github.com/tendermint/tendermint/coverage.txt .
# test basic network connectivity
# by starting a local testnet and checking peers connect and make blocks
echo
echo "* [$(date +"%T")] running p2p tests on a local docker network"
bash "$DIR/p2p/test.sh" tester
# only run the cloud benchmark for releases
BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [[ $(echo "$BRANCH" | grep "release-") != "" ]]; then
echo
echo "TODO: run network tests"
#echo "* branch $BRANCH; running mintnet/netmon throughput benchmark"
# TODO: replace mintnet
#bash "$DIR/net/test.sh"
fi
## copy the coverage results out of docker container
#docker cp run_test:/go/src/github.com/tendermint/tendermint/coverage.txt .
#
## test basic network connectivity
## by starting a local testnet and checking peers connect and make blocks
#echo
#echo "* [$(date +"%T")] running p2p tests on a local docker network"
#bash "$DIR/p2p/test.sh" tester
#
## only run the cloud benchmark for releases
#BRANCH=$(git rev-parse --abbrev-ref HEAD)
#if [[ $(echo "$BRANCH" | grep "release-") != "" ]]; then
# echo
# echo "TODO: run network tests"
# #echo "* branch $BRANCH; running mintnet/netmon throughput benchmark"
# # TODO: replace mintnet
# #bash "$DIR/net/test.sh"
#fi

Loading…
Cancel
Save