Skip to content

Commit 2628893

Browse files
Merge pull request #1217 from hongkailiu/generate-junit-file
NO-JIRA: Generate junitfile for unit tests
2 parents 827d841 + 7cb067e commit 2628893

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,20 @@ build:
77
hack/build-go.sh
88
.PHONY: build
99

10-
test:
11-
go test ./...
10+
gotestsum:
11+
which gotestsum || go install gotest.tools/gotestsum@latest
12+
.PHONY: gotestsum
13+
14+
JUNIT_DIR := "_output"
15+
PACKAGES := "./..."
16+
ifeq ($(CI),true)
17+
JUNIT_DIR := "$(ARTIFACT_DIR)"
18+
# tests in github.com/openshift/cluster-version-operator/test/ will be executed separately in CI
19+
PACKAGES := $(shell go list ./... | grep -v "github.com/openshift/cluster-version-operator/test/" | xargs)
20+
endif
21+
22+
test: gotestsum
23+
gotestsum --junitfile="$(JUNIT_DIR)/junit.xml" --packages="$(PACKAGES)"
1224
.PHONY: test
1325

1426
integration-test:

0 commit comments

Comments
 (0)