github.com/diptanu/nomad@v0.5.7-0.20170516172507-d72e86cbe3d9/scripts/test.sh (about) 1 #!/usr/bin/env bash 2 set -e 3 4 GOTEST_TAGS="nomad_test" 5 if [[ $(uname) == "Linux" ]]; then 6 if pkg-config --exists lxc; then 7 GOTEST_TAGS="$GOTEST_TAGS lxc" 8 fi 9 fi 10 11 # Create a temp dir and clean it up on exit 12 TEMPDIR=`mktemp -d -t nomad-test.XXX` 13 trap "rm -rf $TEMPDIR" EXIT HUP INT QUIT TERM 14 15 # Build the Nomad binary for the API tests 16 echo "--> Building nomad" 17 echo go build -i -tags \"$GOTEST_TAGS\" -o $TEMPDIR/nomad 18 go build -i -tags "$GOTEST_TAGS" -o $TEMPDIR/nomad || exit 1 19 20 # Run the tests 21 echo "--> Running tests" 22 GOBIN="`which go`" 23 sudo -E PATH=$TEMPDIR:$PATH -E GOPATH=$GOPATH -E NOMAD_TEST_RKT=1 \ 24 $GOBIN test -tags "$GOTEST_TAGS" ${GOTEST_FLAGS:--cover -timeout=900s} $($GOBIN list ./... | grep -v /vendor/) 25