2015-04-11 20:21:56 +00:00
|
|
|
#!/usr/bin/env bash
|
2016-11-03 00:27:49 +00:00
|
|
|
set -e
|
2016-02-13 00:50:37 +00:00
|
|
|
|
2015-04-11 20:21:56 +00:00
|
|
|
# Create a temp dir and clean it up on exit
|
2015-04-12 01:36:13 +00:00
|
|
|
TEMPDIR=`mktemp -d -t consul-test.XXX`
|
2015-04-11 20:21:56 +00:00
|
|
|
trap "rm -rf $TEMPDIR" EXIT HUP INT QUIT TERM
|
|
|
|
|
|
|
|
# Build the Consul binary for the API tests
|
|
|
|
echo "--> Building consul"
|
2016-11-03 00:27:49 +00:00
|
|
|
go build -tags="${BUILD_TAGS}" -o $TEMPDIR/consul || exit 1
|
2015-04-11 20:21:56 +00:00
|
|
|
|
|
|
|
# Run the tests
|
|
|
|
echo "--> Running tests"
|
2016-11-04 04:14:56 +00:00
|
|
|
go list ./... | grep -v '/vendor/' | PATH=$TEMPDIR:$PATH xargs -n1 go test -tags="${BUILD_TAGS}" ${GOTEST_FLAGS:--cover -timeout=360s}
|