From 9bdf570fa5a9d6b53af3754b1c6b80b450f2731f Mon Sep 17 00:00:00 2001 From: Ryan Uber Date: Sat, 11 Apr 2015 13:21:56 -0700 Subject: [PATCH] Build consul to a temp dir for API tests --- Makefile | 4 ++-- scripts/test.sh | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100755 scripts/test.sh diff --git a/Makefile b/Makefile index 7d9022395d..5ca763f040 100644 --- a/Makefile +++ b/Makefile @@ -20,8 +20,8 @@ updatedeps: deps @go get -d -f -u ./... $(DEPS) test: deps - ./scripts/verify_no_uuid.sh - go list ./... | xargs -n1 go test + @./scripts/verify_no_uuid.sh + @./scripts/test.sh @$(MAKE) vet integ: diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100755 index 0000000000..a87a6f2c09 --- /dev/null +++ b/scripts/test.sh @@ -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