diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2020-04-07 11:55:09 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2020-04-07 12:11:15 +0300 |
commit | f1e11880d68c57f5c4f87712865b76be0dfcfcd9 (patch) | |
tree | cbc86382ccb2911c1cc9a43b061bdd0f5e23da03 | |
parent | 98103b3d885761f3b2ed6aff7beaee355ef9ec0b (diff) |
output junit report when tests fail
In 5109ed2d, pipefail was turned on in order to produce a correct
exit code on test failure. This caused the JUnit reporter not
to run on test failures. This commit turns off pipefail, ensuring
the JUnit reporter runs even after tests fail and returns the
exit code of 'go test'.
-rw-r--r-- | _support/Makefile.template | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/_support/Makefile.template b/_support/Makefile.template index 33cc8828c..09aacab45 100644 --- a/_support/Makefile.template +++ b/_support/Makefile.template @@ -11,7 +11,7 @@ INSTALL_DEST_DIR := $(DESTDIR)$(PREFIX)/bin/ BUNDLE_FLAGS ?= {{ .BundleFlags }} ASSEMBLY_ROOT ?= {{ .BuildDir }}/assembly BUILD_TAGS := tracer_static tracer_static_jaeger continuous_profiler_stackdriver -SHELL = /usr/bin/env bash -eo pipefail +SHELL = /usr/bin/env bash -e unexport GOROOT export GOBIN = {{ .BuildDir }}/bin @@ -100,7 +100,7 @@ test: test-go rspec rspec-gitlab-shell .PHONY: test-go test-go: prepare-tests {{ .GoJunitReport }} - @cd {{ .SourceDir }} && go test -v -tags "$(BUILD_TAGS)" -count=1 {{ join .AllPackages " " }} 2>&1 | tee >({{ .GoJunitReport }} > report-${CI_JOB_NAME}.xml) + @cd {{ .SourceDir }} && go test -v -tags "$(BUILD_TAGS)" -count=1 {{ join .AllPackages " " }} 2>&1 | tee >({{ .GoJunitReport }} > report-${CI_JOB_NAME}.xml) && exit $${PIPESTATUS[0]} .PHONY: test-with-proxies test-with-proxies: prepare-tests @@ -115,7 +115,7 @@ test-with-praefect: build prepare-tests .PHONY: race-go race-go: prepare-tests {{ .GoJunitReport }} - @cd {{ .SourceDir }} && go test -v -tags "$(BUILD_TAGS)" -race {{ join .AllPackages " " }} 2>&1 | tee >({{ .GoJunitReport }} > report-${CI_JOB_NAME}.xml) + @cd {{ .SourceDir }} && go test -v -tags "$(BUILD_TAGS)" -race {{ join .AllPackages " " }} 2>&1 | tee >({{ .GoJunitReport }} > report-${CI_JOB_NAME}.xml) && exit $${PIPESTATUS[0]} .PHONY: rspec rspec: assemble-go prepare-tests |