From e416f828dc47b08d6e076ad8944b6bce2f3de128 Mon Sep 17 00:00:00 2001 From: Paul Banks Date: Tue, 20 Feb 2018 13:16:53 +0000 Subject: [PATCH 1/8] Output from test as we run to stop travis killing us and try no parallelism to avoid timing issues on their contended CPUs --- .travis.yml | 2 +- GNUmakefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7d99c9bd3d..d56c6f3ff8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,6 @@ branches: - master script: - - GOTEST_FLAGS="-p 2 -parallel 2" make test + - GOTEST_FLAGS="-p 1 -parallel 1" make test sudo: false diff --git a/GNUmakefile b/GNUmakefile index 47d8a4dcf6..2e8bb12d41 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -67,7 +67,7 @@ test: other-consul dev-build vet @echo "--> Running go test" @rm -f test.log exit-code go test -tags '$(GOTAGS)' -i ./... - go test $(GOTEST_FLAGS) -tags '$(GOTAGS)' -timeout 5m -v ./... &>test.log ; echo $$? > exit-code + { go test $(GOTEST_FLAGS) -tags '$(GOTAGS)' -timeout 5m -v ./... 2>&1 ; echo $$? > exit-code ; } | tee test.log @echo "Exit code: $$(cat exit-code)" >> test.log @grep -A5 'DATA RACE' test.log || true @grep -A10 'panic: test timed out' test.log || true From 6f266a0103591f8579bf34dee39e721cf1dcf05d Mon Sep 17 00:00:00 2001 From: Paul Banks Date: Tue, 20 Feb 2018 15:32:44 +0000 Subject: [PATCH 2/8] Only output sparse lines to keep Travis happy while logging verbosely to disk --- GNUmakefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/GNUmakefile b/GNUmakefile index 2e8bb12d41..77e6c4f5eb 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -67,7 +67,11 @@ test: other-consul dev-build vet @echo "--> Running go test" @rm -f test.log exit-code go test -tags '$(GOTAGS)' -i ./... - { go test $(GOTEST_FLAGS) -tags '$(GOTAGS)' -timeout 5m -v ./... 2>&1 ; echo $$? > exit-code ; } | tee test.log + @# Dump verbose output to test.log so we can surface test names on failure but + @# hide it from travis as it exceeds their log limits and causes job to be + @# terminated (over 4MB and over 10k lines in the UI). We need to output + @# _something_ to stop them terminating us due to inactivity... + { go test $(GOTEST_FLAGS) -tags '$(GOTAGS)' -timeout 5m ./... 2>&1 ; echo $$? > exit-code ; } | tee test.log | grep -p '^\(ok\|FAIL\)\s*github.com/hashicorp/consul' @echo "Exit code: $$(cat exit-code)" >> test.log @grep -A5 'DATA RACE' test.log || true @grep -A10 'panic: test timed out' test.log || true From 29feb66fbd0b944f3a9ecb0396291fa779d822fa Mon Sep 17 00:00:00 2001 From: Paul Banks Date: Tue, 20 Feb 2018 15:48:18 +0000 Subject: [PATCH 3/8] Portability! --- GNUmakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GNUmakefile b/GNUmakefile index 77e6c4f5eb..5c64d4d708 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -71,7 +71,7 @@ test: other-consul dev-build vet @# hide it from travis as it exceeds their log limits and causes job to be @# terminated (over 4MB and over 10k lines in the UI). We need to output @# _something_ to stop them terminating us due to inactivity... - { go test $(GOTEST_FLAGS) -tags '$(GOTAGS)' -timeout 5m ./... 2>&1 ; echo $$? > exit-code ; } | tee test.log | grep -p '^\(ok\|FAIL\)\s*github.com/hashicorp/consul' + { go test $(GOTEST_FLAGS) -tags '$(GOTAGS)' -timeout 5m ./... 2>&1 ; echo $$? > exit-code ; } | tee test.log | egrep '^(ok|FAIL)\s*github.com/hashicorp/consul' @echo "Exit code: $$(cat exit-code)" >> test.log @grep -A5 'DATA RACE' test.log || true @grep -A10 'panic: test timed out' test.log || true From 390487866f7a5dda697da7cd734dd7c4bf152388 Mon Sep 17 00:00:00 2001 From: Jack Pearkes Date: Tue, 20 Feb 2018 10:52:51 -0800 Subject: [PATCH 4/8] try enabling sudo in Travis to run builds in GCE https://docs.travis-ci.com/user/reference/overview/#Virtualisation-Environment-vs-Operating-System --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d56c6f3ff8..b8594bb6ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,4 +10,4 @@ branches: script: - GOTEST_FLAGS="-p 1 -parallel 1" make test -sudo: false +sudo: true From 6272148d1f78e9292cc3f42bc53bf547cedd13ef Mon Sep 17 00:00:00 2001 From: Paul Banks Date: Wed, 21 Feb 2018 11:58:51 +0000 Subject: [PATCH 5/8] Try parallel packages but not tests --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b8594bb6ad..df04206ed9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,6 @@ branches: - master script: - - GOTEST_FLAGS="-p 1 -parallel 1" make test + - GOTEST_FLAGS="-p 3 -parallel 1" make test sudo: true From 41ae19c6779b88aeed79ce8082a078072405a5de Mon Sep 17 00:00:00 2001 From: Paul Banks Date: Wed, 21 Feb 2018 12:20:33 +0000 Subject: [PATCH 6/8] Split the heavy test packages out to their own Jobs. --- .travis.yml | 9 ++++++++- GNUmakefile | 5 +++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index df04206ed9..f68a9619d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,14 @@ branches: only: - master +matrix: + include: + - env: GOTEST_FLAGS="-p 1 -parallel 1" GOTEST_PKGS="./api" + - env: GOTEST_FLAGS="-p 1 -parallel 1" GOTEST_PKGS="./agent" + - env: GOTEST_FLAGS="-p 1 -parallel 1" GOTEST_PKGS="./agent/consul" + - env: GOTEST_FLAGS="-p 3 -parallel 1" GOTEST_PKGS="$(go list ./... | egrep -v '(/agent|/agent/consul|/api)$')" + script: - - GOTEST_FLAGS="-p 3 -parallel 1" make test + - make test sudo: true diff --git a/GNUmakefile b/GNUmakefile index 5c64d4d708..7c0b26b72c 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -11,6 +11,7 @@ GOTOOLS = \ GOTAGS ?= GOFILES ?= $(shell go list ./... | grep -v /vendor/) +GOTEST_PKGS ?= "./..." GOOS=$(shell go env GOOS) GOARCH=$(shell go env GOARCH) GOPATH=$(shell go env GOPATH) @@ -66,12 +67,12 @@ cov: test: other-consul dev-build vet @echo "--> Running go test" @rm -f test.log exit-code - go test -tags '$(GOTAGS)' -i ./... + go test -tags '$(GOTAGS)' -i $(GOTEST_PKGS) @# Dump verbose output to test.log so we can surface test names on failure but @# hide it from travis as it exceeds their log limits and causes job to be @# terminated (over 4MB and over 10k lines in the UI). We need to output @# _something_ to stop them terminating us due to inactivity... - { go test $(GOTEST_FLAGS) -tags '$(GOTAGS)' -timeout 5m ./... 2>&1 ; echo $$? > exit-code ; } | tee test.log | egrep '^(ok|FAIL)\s*github.com/hashicorp/consul' + { go test $(GOTEST_FLAGS) -tags '$(GOTAGS)' -timeout 5m $(GOTEST_PKGS) 2>&1 ; echo $$? > exit-code ; } | tee test.log | egrep '^(ok|FAIL)\s*github.com/hashicorp/consul' @echo "Exit code: $$(cat exit-code)" >> test.log @grep -A5 'DATA RACE' test.log || true @grep -A10 'panic: test timed out' test.log || true From 0166b34b5d10f445c72ade344d228115616f04a4 Mon Sep 17 00:00:00 2001 From: Paul Banks Date: Wed, 21 Feb 2018 12:27:30 +0000 Subject: [PATCH 7/8] Use relative paths as Travis doesn't setup GOPATH right --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index f68a9619d0..914072e3b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,12 +9,12 @@ branches: matrix: include: - - env: GOTEST_FLAGS="-p 1 -parallel 1" GOTEST_PKGS="./api" - - env: GOTEST_FLAGS="-p 1 -parallel 1" GOTEST_PKGS="./agent" - - env: GOTEST_FLAGS="-p 1 -parallel 1" GOTEST_PKGS="./agent/consul" - - env: GOTEST_FLAGS="-p 3 -parallel 1" GOTEST_PKGS="$(go list ./... | egrep -v '(/agent|/agent/consul|/api)$')" + - env: GOTEST_PKGS="./api" + - env: GOTEST_PKGS="./agent" + - env: GOTEST_PKGS="./agent/consul" + - env: GOTEST_PKGS="$(go list ./... | sed 's/github.com\/hashicorp\/consul/./' | egrep -v './agent|./agent/consul|./api')" script: - - make test + - GOTEST_FLAGS="-p 3 -parallel 1" make test sudo: true From 7b85f09d59eaa159d9cbaa956401e92c4f247373 Mon Sep 17 00:00:00 2001 From: Paul Banks Date: Wed, 21 Feb 2018 12:53:35 +0000 Subject: [PATCH 8/8] Travis evaluates ENV before cloning git repo and cding so we need to delay gathering packages until the makefile --- .travis.yml | 2 +- GNUmakefile | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 914072e3b9..ef1db8a50a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ matrix: - env: GOTEST_PKGS="./api" - env: GOTEST_PKGS="./agent" - env: GOTEST_PKGS="./agent/consul" - - env: GOTEST_PKGS="$(go list ./... | sed 's/github.com\/hashicorp\/consul/./' | egrep -v './agent|./agent/consul|./api')" + - env: GOTEST_PKGS_EXCLUDE="./api|./agent|./agent/consul" script: - GOTEST_FLAGS="-p 3 -parallel 1" make test diff --git a/GNUmakefile b/GNUmakefile index 7c0b26b72c..1a40f25bfa 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -11,7 +11,11 @@ GOTOOLS = \ GOTAGS ?= GOFILES ?= $(shell go list ./... | grep -v /vendor/) +ifeq ($(origin GOTEST_PKGS_EXCLUDE), undefined) GOTEST_PKGS ?= "./..." +else +GOTEST_PKGS=$(shell go list ./... | sed 's/github.com\/hashicorp\/consul/./' | egrep -v "^($(GOTEST_PKGS_EXCLUDE))$$") +endif GOOS=$(shell go env GOOS) GOARCH=$(shell go env GOARCH) GOPATH=$(shell go env GOPATH)