Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSami Hiltunen <shiltunen@gitlab.com>2020-04-23 11:54:28 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2020-04-23 11:54:28 +0300
commit7681d70808936e3f70d5f992b3b125fb8f6d3727 (patch)
treef8f8b1407e2d3fa878673c19305e5db8ebc3cfb8
parent20b29fc2c3c029385cc87d910ba5d9d1cb9b64fc (diff)
parent426416992616d0b09607812357d15e536424307a (diff)
Merge branch 'po-junit-report-failures' into 'master'
JUnit reports should be captured on test failures See merge request gitlab-org/gitaly!2087
-rw-r--r--.gitignore1
-rw-r--r--.gitlab-ci.yml8
-rw-r--r--_support/Makefile.template20
3 files changed, 20 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index a8f8f0b3f..1f3382f5c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,4 +25,3 @@ gitaly.pid
/vendor
/gitaly-*.gem
/gitaly-blackbox
-report-*.xml
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cf6d4e670..a5b5c35d2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -79,9 +79,9 @@ danger-review:
- make test
artifacts:
paths:
- - report-${CI_JOB_NAME}.xml
+ - _build/reports/go-tests-report-${CI_JOB_NAME}.xml
reports:
- junit: report-${CI_JOB_NAME}.xml
+ junit: _build/reports/go-tests-report-${CI_JOB_NAME}.xml
verify:
<<: *ruby_definition
@@ -153,9 +153,9 @@ race:
- make race-go
artifacts:
paths:
- - report-${CI_JOB_NAME}.xml
+ - _build/reports/go-tests-report-${CI_JOB_NAME}.xml
reports:
- junit: report-${CI_JOB_NAME}.xml
+ junit: _build/reports/go-tests-report-${CI_JOB_NAME}.xml
cover:
<<: *ruby_definition
diff --git a/_support/Makefile.template b/_support/Makefile.template
index d44569024..353a850aa 100644
--- a/_support/Makefile.template
+++ b/_support/Makefile.template
@@ -11,7 +11,14 @@ 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 -e
+SHELL = /usr/bin/env bash -eo pipefail
+# These variables control test options and artifacts
+TEST_OPTIONS ?=
+TEST_REPORT_DIR ?= {{ .BuildDir }}/reports
+TEST_OUTPUT ?= $(TEST_REPORT_DIR)/go-tests-output-$(CI_JOB_NAME).txt
+TEST_REPORT ?= $(TEST_REPORT_DIR)/go-tests-report-$(CI_JOB_NAME).xml
+TEST_EXIT ?= $(TEST_REPORT_DIR)/go-tests-exit-$(CI_JOB_NAME).txt
+TEST_PACKAGES ?= {{ join .AllPackages " " }}
unexport GOROOT
export GOBIN = {{ .BuildDir }}/bin
@@ -100,7 +107,12 @@ 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) && exit $${PIPESTATUS[0]}
+ @mkdir -p $(TEST_REPORT_DIR)
+ @cd {{ .SourceDir }} && \
+ echo 0 > $(TEST_EXIT) && \
+ (go test $(TEST_OPTIONS) -v -tags "$(BUILD_TAGS)" -count=1 $(TEST_PACKAGES) 2>&1 | tee $(TEST_OUTPUT) || echo $$? > $(TEST_EXIT)) && \
+ cat $(TEST_OUTPUT) | {{ .GoJunitReport }} > $(TEST_REPORT) && \
+ exit `cat $(TEST_EXIT)`
.PHONY: test-with-proxies
test-with-proxies: prepare-tests
@@ -114,8 +126,8 @@ test-with-praefect: build prepare-tests
GITALY_TEST_PRAEFECT_BIN={{ .BuildDir }}/bin/praefect go test -tags "$(BUILD_TAGS)" -count=1 {{ join .AllPackages " " }} # count=1 bypasses go 1.10 test caching
.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) && exit $${PIPESTATUS[0]}
+race-go: TEST_OPTIONS = -race
+race-go: test-go
.PHONY: rspec
rspec: assemble-go prepare-tests