diff options
author | Nick Thomas <nick@gitlab.com> | 2017-03-08 18:39:22 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2017-03-08 18:44:51 +0300 |
commit | 275cafa033f087748f66d12197d447e56537a048 (patch) | |
tree | 16e129ba1a96ca2e1dc15fc62a3a752c967975a1 | |
parent | 114d0f4075bdba7600f59e38771a75b82c9ae7c0 (diff) |
Rework the acceptance tests to use go test -short as a qualifier
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | acceptance_test.go | 13 |
2 files changed, 11 insertions, 7 deletions
@@ -40,10 +40,11 @@ complexity: test: go get golang.org/x/tools/cmd/cover - go test ./... -cover -v -timeout 1m + go test ./... -short -cover -v -timeout 1m acceptance: gitlab-pages - go test ./... -run-acceptance-tests -v -timeout 1m + go get golang.org/x/tools/cmd/cover + go test ./... -cover -v -timeout 1m docker: docker run --rm -it -v ${PWD}:/go/src/pages -w /go/src/pages golang:1.5 /bin/bash diff --git a/acceptance_test.go b/acceptance_test.go index 1cfd133a..e1a7167a 100644 --- a/acceptance_test.go +++ b/acceptance_test.go @@ -4,12 +4,12 @@ import ( "flag" "io/ioutil" "net/http" + "os" "testing" "github.com/stretchr/testify/assert" ) -var shouldRun = flag.Bool("run-acceptance-tests", false, "Run the acceptance tests?") var pagesBinary = flag.String("gitlab-pages-binary", "./gitlab-pages", "Path to the gitlab-pages binary") // TODO: Use TCP port 0 everywhere to avoid conflicts. The binary could output @@ -25,12 +25,15 @@ var listeners = []ListenSpec{ } func skipUnlessEnabled(t *testing.T) { - if *shouldRun { - return + if testing.Short() { + t.Log("Acceptance tests disabled") + t.SkipNow() } - t.Log("Acceptance tests disabled") - t.SkipNow() + if _, err := os.Stat(*pagesBinary); os.IsNotExist(err) { + t.Errorf("Couldn't find gitlab-pages binary at %s", *pagesBinary) + t.FailNow() + } } func TestUnknownHostReturnsNotFound(t *testing.T) { |