Skip to content
This repository was archived by the owner on Oct 12, 2023. It is now read-only.

Commit 9762389

Browse files
authored
fix test reporting for integration pipeline (#185)
1 parent 2c849d6 commit 9762389

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ GO = go
1212
GODOC = godoc
1313
GOFMT = gofmt
1414
GOCYCLO = gocyclo
15+
GOJUNITRPT = go-junit-report
1516

1617
V = 0
1718
Q = $(if $(filter 1,$V),,@)
@@ -40,7 +41,7 @@ test-cover: ARGS=-cover -coverprofile=cover.out -v ## Run tests in verbos
4041
$(TEST_TARGETS): NAME=$(MAKECMDGOALS:test-%=%)
4142
$(TEST_TARGETS): test
4243
check test tests: cyclo lint vet terraform.tfstate; $(info $(M) running $(NAME:%=% )tests…) @ ## Run tests
43-
$Q cd $(BASE) && $(GO) test -timeout $(TIMEOUT)s $(ARGS) $(TESTPKGS)
44+
$Q cd $(BASE) && $(GO) test -timeout $(TIMEOUT)s $(ARGS) $(TESTPKGS) 2>&1 | $(GOJUNITRPT) > report.xml
4445

4546
.PHONY: vet
4647
vet: $(GOLINT) ; $(info $(M) running vet…) @ ## Run vet

eng/integration_tests.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ steps:
2626
2727
- script: |
2828
set -e
29-
go get github.com/mattn/goveralls
30-
go get golang.org/x/tools/cmd/cover
29+
go get github.com/jstemmer/go-junit-report
30+
go get github.com/axw/gocov/gocov
31+
go get github.com/AlekSi/gocov-xml
32+
go get -u github.com/matm/gocov-html
3133
go get github.com/fzipp/gocyclo
3234
go get golang.org/x/lint/golint
3335
displayName: 'Install Dependencies'
@@ -45,7 +47,21 @@ steps:
4547
export ARM_TENANT_ID=$(AZURE_TENANT_ID)
4648
export GO111MODULE=on
4749
make test-cover
48-
goveralls -coverprofile=cover.out -service=azure-devops
4950
make destroy-sb
51+
gocov convert cover.out > coverage.json
52+
gocov-xml < coverage.json > coverage.xml
53+
gocov-html < coverage.json > coverage.html
5054
displayName: 'Run Integration Tests'
5155
workingDirectory: '$(sdkPath)'
56+
57+
- task: PublishTestResults@2
58+
inputs:
59+
testRunner: JUnit
60+
testResultsFiles: $(sdkPath)/report.xml
61+
failTaskOnFailedTests: true
62+
63+
- task: PublishCodeCoverageResults@1
64+
inputs:
65+
codeCoverageTool: Cobertura
66+
summaryFileLocation: $(sdkPath)/coverage.xml
67+
additionalCodeCoverageFiles: $(sdkPath)/coverage.html

0 commit comments

Comments
 (0)