ci: use gotestsum for running tests

`gotestsum` has user friendlier output that emits final summary, also it can emit junit xml file for
automated analysis instead of current format that should significantly
ease automated analysis of CI.
This commit is contained in:
Mahmood Ali
2018-12-15 14:00:27 -05:00
committed by Mahmood Ali
parent ee652be312
commit 8b53ff978a
2 changed files with 8 additions and 2 deletions

View File

@@ -58,4 +58,7 @@ install:
- if [[ "$RUN_UI_TESTS" ]]; then . $HOME/.nvm/nvm.sh && cd ui && nvm use && cd .. ; fi
script:
- sudo -E "PATH=$PATH" make travis
- sudo -E "PATH=$PATH" GOTESTSUM_JUNITFILE=/tmp/results.xml make travis
after_script:
- cat /tmp/results.xml

View File

@@ -8,6 +8,8 @@ GIT_DIRTY := $(if $(shell git status --porcelain),+CHANGES)
GO_LDFLAGS := "-X github.com/hashicorp/nomad/version.GitCommit=$(GIT_COMMIT)$(GIT_DIRTY)"
GO_TAGS =
GO_TEST_CMD = $(if $(shell which gotestsum),gotestsum --,go test)
default: help
ifeq (,$(findstring $(THIS_OS),Darwin Linux FreeBSD))
@@ -153,6 +155,7 @@ deps: ## Install build and development dependencies
go get -u github.com/a8m/tree/cmd/tree
go get -u github.com/magiconair/vendorfmt/cmd/vendorfmt
go get -u github.com/golang/protobuf/protoc-gen-go
go get -u gotest.tools/gotestsum
.PHONY: lint-deps
lint-deps: ## Install linter dependencies
@@ -261,7 +264,7 @@ test: ## Run the Nomad test suite and/or the Nomad UI test suite
.PHONY: test-nomad
test-nomad: dev ## Run Nomad test suites
@echo "==> Running Nomad test suites:"
$(if $(ENABLE_RACE),GORACE="strip_path_prefix=$(GOPATH)/src") go test \
$(if $(ENABLE_RACE),GORACE="strip_path_prefix=$(GOPATH)/src") $(GO_TEST_CMD) \
$(if $(ENABLE_RACE),-race) $(if $(VERBOSE),-v) \
-cover \
-timeout=15m \