From 860d570053e96b478c3c81ae00e3498d311cf364 Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Wed, 2 Aug 2023 13:40:02 +0200 Subject: [PATCH] test: generate junit result for test-integration and add test-junit target --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 58a796a747..bf10865c52 100644 --- a/Makefile +++ b/Makefile @@ -424,6 +424,12 @@ test: $(SETUP_ENVTEST) $(GOVC) ## Run unit tests test-verbose: ## Run unit tests with verbose flag $(MAKE) test TEST_ARGS="$(TEST_ARGS) -v" +.PHONY: test-junit +test-junit: $(SETUP_ENVTEST) $(GOTESTSUM) $(GOVC) ## Run unit tests + set +o errexit; (KUBEBUILDER_ASSETS="$(KUBEBUILDER_ASSETS)" GOVC_BIN_PATH=$(GOVC) go test -json ./apis/... ./controllers/... ./pkg/... $(TEST_ARGS); echo $$? > $(ARTIFACTS)/junit.exitcode) | tee $(ARTIFACTS)/junit.stdout + $(GOTESTSUM) --junitfile $(ARTIFACTS)/junit.xml --raw-command cat $(ARTIFACTS)/junit.stdout + exit $$(cat $(ARTIFACTS)/junit.exitcode) + .PHONY: test-cover test-cover: ## Run unit tests and generate a coverage report $(MAKE) test TEST_ARGS="$(TEST_ARGS) -coverprofile=coverage.out" @@ -433,7 +439,7 @@ test-cover: ## Run unit tests and generate a coverage report .PHONY: test-integration test-integration: e2e-image ## Run integration tests test-integration: $(GINKGO) $(KUSTOMIZE) $(KIND) - time $(GINKGO) -v ./test/integration -- --config="$(INTEGRATION_CONF_FILE)" --artifacts-folder="$(ARTIFACTS)" + time $(GINKGO) --output-dir="$(ARTIFACTS)" --junit-report="junit.integration_suite.1.xml" -v ./test/integration -- --config=$(INTEGRATION_CONF_FILE) --artifacts-folder="$(ARTIFACTS)" .PHONY: e2e-image e2e-image: ## Build the e2e manager image