Files
nomad/scripts/test.sh
Sean Chittenden 25ac71b8b5 When sudo(1)'ing to run the tests, use the abspath of the current user's
go(1) instead of whatever is in root's PATH.
2016-07-11 12:49:26 -07:00

19 lines
489 B
Bash
Executable File

#!/usr/bin/env bash
# Create a temp dir and clean it up on exit
TEMPDIR=`mktemp -d -t nomad-test.XXX`
trap "rm -rf $TEMPDIR" EXIT HUP INT QUIT TERM
# Build the Nomad binary for the API tests
echo "--> Building nomad"
go build -o $TEMPDIR/nomad || exit 1
# Run the tests
echo "--> Running tests"
GOBIN="`which go`"
go list ./... | grep -v '/vendor/' | \
sudo \
-E PATH=$TEMPDIR:$PATH \
-E GOPATH=$GOPATH \
$GOBIN test ${GOTEST_FLAGS:--cover -timeout=900s -v}