Merge pull request #3903 from hashicorp/build-fixes

[WIP] Attempt to find some low-hanging fruit for CI failures
This commit is contained in:
Paul Banks 2018-02-23 13:12:45 +00:00 committed by GitHub
commit 9b97bebc95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 5 deletions

View File

@ -7,7 +7,14 @@ branches:
only:
- master
script:
- GOTEST_FLAGS="-p 2 -parallel 2" make test
matrix:
include:
- env: GOTEST_PKGS="./api"
- env: GOTEST_PKGS="./agent"
- env: GOTEST_PKGS="./agent/consul"
- env: GOTEST_PKGS_EXCLUDE="./api|./agent|./agent/consul"
sudo: false
script:
- GOTEST_FLAGS="-p 3 -parallel 1" make test
sudo: true

View File

@ -11,6 +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)
@ -66,8 +71,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 $(GOTEST_FLAGS) -tags '$(GOTAGS)' -timeout 5m -v ./... &>test.log ; echo $$? > exit-code
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 $(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