Skip to content
Snippets Groups Projects
Verified Commit 39bd2710 authored by Jaime Martinez's avatar Jaime Martinez :palm_tree:
Browse files

Use junit report

parent 0a158775
No related branches found
No related tags found
1 merge request!403Add junit report for tests
......@@ -4,12 +4,11 @@ shared/pages/.update
/vendor
/gitlab-pages.conf
/gl-code-quality-report.json
/gl-license-scanning-report.json
/coverage.html
/junit-test-report.xml
/tests.out
# Used by the makefile
/.GOPATH
/bin
# reports
gl-license-scanning-report.json
gl-code-quality-report.json
......@@ -7,6 +7,7 @@
script:
- echo "Running all tests without daemonizing..."
- make test
- make junit-report
- echo "Running just the acceptance tests daemonized (tmpdir)...."
- TEST_DAEMONIZE=tmpdir make acceptance
- echo "Running just the acceptance tests daemonized (inplace)...."
......@@ -74,3 +75,14 @@ check deps:
needs: ['download deps']
script:
- make deps-check
## Use https://github.com/jstemmer/go-junit-report to generate a JUnit report format XML file with go
golang:
stage: test
script:
- go get -u github.com/jstemmer/go-junit-report
- go test -v 2>&1 | go-junit-report -set-exit-code > report.xml
artifacts:
when: always
reports:
junit: report.xml
......@@ -10,6 +10,7 @@ setup: clean .GOPATH/.ok
go get github.com/wadey/gocovmerge@v0.0.0-20160331181800-b5bfa59ec0ad
go get github.com/golang/mock/mockgen@v1.3.1
go get github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
go get github.com/jstemmer/go-junit-report
generate-mocks: .GOPATH/.ok
$Q bin/mockgen -source=internal/interface.go -destination=internal/mocks/mocks.go -package=mocks
......
......@@ -43,3 +43,6 @@ bin/golangci-lint: .GOPATH/.ok
@test -x $@ || \
{ echo "Vendored golangci-lint not found, try running 'make setup'..."; exit 1; }
bin/go-junit-report: .GOPATH/.ok
@test -x $@ || \
{ echo "Vendored go-junit-report not found, try running 'make setup'..."; exit 1; }
......@@ -10,7 +10,8 @@ lint: .GOPATH/.ok bin/golangci-lint
$Q ./bin/golangci-lint run ./... --out-format $(OUT_FORMAT) $(LINT_FLAGS) | tee ${REPORT_FILE}
test: .GOPATH/.ok gitlab-pages
go test $(if $V,-v) $(allpackages)
rm tests.out || true
go test $(if $V,-v) $(allpackages) 2>&1 | tee tests.out
race: .GOPATH/.ok gitlab-pages
CGO_ENABLED=1 go test -race $(if $V,-v) $(allpackages)
......@@ -55,3 +56,6 @@ deps-check: .GOPATH/.ok
deps-download: .GOPATH/.ok
go mod download
junit-report: bin/go-junit-report
cat tests.out | ./bin/go-junit-report -set-exit-code > junit-test-report.xml
......@@ -4,6 +4,7 @@ package main
import (
_ "github.com/fzipp/gocyclo"
_ "github.com/jstemmer/go-junit-report"
_ "github.com/wadey/gocovmerge"
_ "golang.org/x/lint/golint"
_ "golang.org/x/tools/cmd/goimports"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment