Build consul to a temp dir for API tests

This commit is contained in:
Ryan Uber 2015-04-11 13:21:56 -07:00
parent a54e8678a1
commit 9bdf570fa5
2 changed files with 15 additions and 2 deletions

View File

@ -20,8 +20,8 @@ updatedeps: deps
@go get -d -f -u ./... $(DEPS) @go get -d -f -u ./... $(DEPS)
test: deps test: deps
./scripts/verify_no_uuid.sh @./scripts/verify_no_uuid.sh
go list ./... | xargs -n1 go test @./scripts/test.sh
@$(MAKE) vet @$(MAKE) vet
integ: integ:

13
scripts/test.sh Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
# Create a temp dir and clean it up on exit
TEMPDIR=`mktemp -d -t consul-test`
trap "rm -rf $TEMPDIR" EXIT HUP INT QUIT TERM
# Build the Consul binary for the API tests
echo "--> Building consul"
go build -o $TEMPDIR/consul || exit 1
# Run the tests
echo "--> Running tests"
go list ./... | PATH=$TEMPDIR:$PATH xargs -n1 go test