integrations tests and coverage badge

This commit is contained in:
Ethan Buchman
2016-07-23 13:38:30 -04:00
parent eac43dc62b
commit cb6c3fb0b6
7 changed files with 97 additions and 1 deletions
+8
View File
@@ -0,0 +1,8 @@
# Pull base image.
FROM golang:1.5
COPY test/test_libs.sh /
COPY glide.lock /glide.lock
ENV GLIDE /glide.lock
+14
View File
@@ -0,0 +1,14 @@
#! /bin/bash
# integrations test!
# if we pushed to STAGING or MASTER,
# run the integrations tests.
BRANCH=`git rev-parse --abbrev-ref HEAD`
echo "Current branch: $BRANCH"
if [[ "$BRANCH" == "master" || "$BRANCH" == "staging" ]]; then
docker build -t tester -f ./test/Dockerfile .
docker run -t tester bash /test_libs.sh
fi
+63
View File
@@ -0,0 +1,63 @@
#! /bin/bash
# set glide.lock path
if [[ "$GLIDE" == "" ]]; then
GLIDE=$GOPATH/src/github.com/tendermint/tendermint/glide.lock
fi
# get vendored commit for given lib
function parseGlide() {
cat $1 | grep -A1 $2 | grep -v $2 | awk '{print $2}'
}
# fetch and checkout vendored dep
function getDep() {
lib=$1
echo "----------------------------------"
echo "Getting $lib ..."
go get -t github.com/tendermint/$lib/...
VENDORED=$(parseGlide $GLIDE $lib)
cd $GOPATH/src/github.com/tendermint/$lib
MASTER=$(git rev-parse origin/master)
if [[ "$VENDORED" != "$MASTER" ]]; then
echo "... VENDORED != MASTER ($VENDORED != $MASTER)"
echo "... Checking out commit $VENDORED"
git checkout $VENDORED &> /dev/null
fi
}
####################
# libs we depend on
####################
LIBS_GO_TEST=(go-clist go-common go-config go-crypto go-db go-events go-merkle go-p2p)
LIBS_MAKE_TEST=(go-rpc go-wire tmsp)
for lib in "${LIBS_GO_TEST[@]}"; do
getDep $lib
echo "Testing $lib ..."
go test --race github.com/tendermint/$lib/...
if [[ "$?" != 0 ]]; then
echo "FAIL"
exit 1
fi
done
for lib in "${LIBS_MAKE_TEST[@]}"; do
getDep $lib
echo "Testing $lib ..."
cd $GOPATH/src/github.com/tendermint/$lib
make test
if [[ "$?" != 0 ]]; then
echo "FAIL"
exit 1
fi
done
echo ""
echo "PASS"