Generate JUnit report in coverage stage and integrate with GitLab JUnit support

parent f5ba5b05
......@@ -291,10 +291,12 @@ git 1.7.1:
# Coverage stage
#
test coverage report: &test_coverage_report
<<: *except_docs
.coverage_job: &coverage_job
stage: coverage
image: golang:1.10
test coverage report: &test_coverage_report
<<: *coverage_job
coverage: /regular total:\s+\(statements\)\s+\d+.\d+\%/
script:
- source ci/touch_make_dependencies
......@@ -306,13 +308,20 @@ test coverage report: &test_coverage_report
expire_in: 7d
race conditions detector:
<<: *except_docs
stage: coverage
image: golang:1.10
<<: *test_coverage_report
script:
- source ci/touch_make_dependencies
- make check_race_conditions
test junit report:
<<: *coverage_job
script:
- source ci/touch_make_dependencies
- make parallel_test_junit_report
artifacts:
reports:
junit: out/junit/report.xml
#
# Build stage
#
......
......@@ -138,6 +138,10 @@ parallel_test_coverage_report: $(GOPATH_SETUP)
# Preparing coverage report
@./scripts/go_test_with_coverage_report coverage
parallel_test_junit_report: $(GOPATH_SETUP)
# Preparing jUnit test report
@./scripts/go_test_with_coverage_report junit
pull_images_for_tests: $(GOPATH_SETUP)
# Pulling images required for some tests
@go run ./scripts/pull-images-for-tests/main.go
......
......@@ -156,6 +156,18 @@ computeCoverageReport() {
fi
}
computeJUnitReport() {
local reportDirectory="out/junit"
local concatenatedOutputFile="/tmp/test-output.txt"
mkdir -p "${reportDirectory}"
cat .testoutput/*.${output}.output.txt > "${concatenatedOutputFile}"
go get -u github.com/jstemmer/go-junit-report
go-junit-report < "${concatenatedOutputFile}" > "${reportDirectory}/report.xml"
}
case "$1" in
prepare)
prepareTestCommands
......@@ -166,4 +178,7 @@ case "$1" in
coverage)
computeCoverageReport
;;
junit)
computeJUnitReport
;;
esac
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment