diff --git a/.gitlab/ci/.test.yml b/.gitlab/ci/.test.yml index 9854217042b032763f4bf8788b24fd40e766bcae..f1757418f71e511bcd4826e238f57be3fe174e6a 100644 --- a/.gitlab/ci/.test.yml +++ b/.gitlab/ci/.test.yml @@ -11,6 +11,9 @@ when: always reports: junit: report.xml + coverage_report: + coverage_format: cobertura + path: ./controller/coverage.xml needs: - build-testing-image @@ -21,6 +24,7 @@ unit-test: after_script: - cd controller - go tool cover -func=coverage.out + - gocover-cobertura < coverage.out > coverage.xml <<: *test controller-test: diff --git a/controller/Makefile b/controller/Makefile index f5b2a70e8469bb596779b57adb2c21fd281f9dca..b06c7ba44e2be6735c43710775caf7569845ce1d 100644 --- a/controller/Makefile +++ b/controller/Makefile @@ -20,6 +20,7 @@ install-tools: ci-install-tools: go install gotest.tools/gotestsum@v1.7.0 + go install github.com/boumenot/gocover-cobertura@v1.2.0 build: $(GOBUILD) -o $(BINARY_NAME) ./cmd/gosdn @@ -41,7 +42,7 @@ controller-test: install-tools ENVIRONMENT=testing ./$(TOOLS_DIR)/gotestsum --junitfile report.xml --format testname -- -race -v -run TestRun ci-unit-test: ci-install-tools - ENVIRONMENT=testing gotestsum --junitfile report.xml --format testname -- -short -race $$( go list ./... | grep -v /forks/ | grep -v /mocks ) -v -coverprofile=coverage.out -timeout 30m + ENVIRONMENT=testing gotestsum --junitfile report.xml --format testname -- -short -race $$( go list ./... | grep -v /forks/ | grep -v /mocks ) -v -coverprofile=coverage.out -covermode atomic -timeout 30m ci-controller-test: ci-install-tools ENVIRONMENT=testing gotestsum --junitfile report.xml --format testname -- -race -v -run TestRun -coverprofile=coverage.out