Testing refactor for Jenkins (#1098)

* de-mystify tests & run them in parallel (#1031)

* test optimization for jenkins (#1093)

* makefile cleanup

* tests: split fast and slow go tests, closes #1055

* pr comments

* restore circle conditions

* fix need_abci

* ...

* docker run: no :Z for circle?

* Remove cmd breaking comment
This commit is contained in:
Zach
2018-03-08 22:52:38 +08:00
committed by Anton Kaliaev
parent 2ce57a65ff
commit 13a2013229
13 changed files with 69 additions and 99 deletions

0
test/app/clean.sh Normal file → Executable file
View File

0
test/app/counter_test.sh Normal file → Executable file
View File

0
test/app/grpc_client.go Normal file → Executable file
View File

0
test/app/kvstore_test.sh Normal file → Executable file
View File

0
test/app/test.sh Normal file → Executable file
View File

View File

@ -26,6 +26,7 @@ ADD scripts scripts
RUN bash scripts/install_abci_apps.sh
# Now copy in the code
# NOTE: this will overwrite whatever is in vendor/
COPY . $REPO

0
test/p2p/basic/test.sh Normal file → Executable file
View File

View File

@ -1,5 +0,0 @@
#! /bin/bash
cd "$GOPATH/src/github.com/tendermint/tendermint"
bash ./test/persist/test_failure_indices.sh

View File

@ -25,22 +25,22 @@ function start_procs(){
PID_DUMMY=$!
# before starting tendermint, remove the rpc socket
rm $RPC_ADDR
rm -f $RPC_ADDR
if [[ "$indexToFail" == "" ]]; then
# run in background, dont fail
if [[ "$CIRCLECI" == true ]]; then
$TM_CMD &
else
if [[ "$CIRCLECI" == true ]]; then
$TM_CMD &
else
$TM_CMD &> "tendermint_${name}.log" &
fi
fi
PID_TENDERMINT=$!
else
# run in foreground, fail
if [[ "$CIRCLECI" == true ]]; then
FAIL_TEST_INDEX=$indexToFail $TM_CMD
else
if [[ "$CIRCLECI" == true ]]; then
FAIL_TEST_INDEX=$indexToFail $TM_CMD
else
FAIL_TEST_INDEX=$indexToFail $TM_CMD &> "tendermint_${name}.log"
fi
fi
PID_TENDERMINT=$!
fi
}

View File

@ -1,23 +0,0 @@
#! /bin/bash
set -e
pwd
BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo "Current branch: $BRANCH"
# run the go unit tests with coverage
bash test/test_cover.sh
# run the app tests using bash
bash test/app/test.sh
# run the persistence tests using bash
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

View File

@ -1,50 +0,0 @@
#! /bin/bash
set -eu
# Get the directory of where this script is.
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
LOGS_DIR="$DIR/logs"
echo
echo "* [$(date +"%T")] cleaning up $LOGS_DIR"
rm -rf "$LOGS_DIR"
mkdir -p "$LOGS_DIR"
set +e
echo
echo "* [$(date +"%T")] removing run_test container"
docker rm -vf run_test
set -e
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 [[ "$SKIP_BUILD" == "" ]]; then
echo
echo "* [$(date +"%T")] building docker image"
bash "$DIR/docker/build.sh"
fi
echo
echo "* [$(date +"%T")] running go tests and app tests in docker container"
# sometimes its helpful to mount the local test folder
# -v $DIR:/go/src/github.com/tendermint/tendermint/test
if [[ "$CIRCLECI" == true ]]; then
docker run --name run_test -e CIRCLECI=true -t tester bash test/run_test.sh
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

View File

@ -3,6 +3,7 @@
PKGS=$(go list github.com/tendermint/tendermint/... | grep -v /vendor/)
set -e
echo "mode: atomic" > coverage.txt
for pkg in ${PKGS[@]}; do
go test -v -timeout 30m -race -coverprofile=profile.out -covermode=atomic "$pkg"