Skip to content

Commit

Permalink
Add junit formatting for unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mdbooth committed May 20, 2024
1 parent 046d6b7 commit 2e09b16
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ ENVSUBST := $(TOOLS_BIN_DIR)/envsubst
GINKGO := $(TOOLS_BIN_DIR)/ginkgo
GOJQ := $(TOOLS_BIN_DIR)/gojq
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/golangci-lint
GOTESTSUM := $(TOOLS_BIN_DIR)/gotestsum
KUSTOMIZE := $(TOOLS_BIN_DIR)/kustomize
MOCKGEN := $(TOOLS_BIN_DIR)/mockgen
RELEASE_NOTES := $(TOOLS_BIN_DIR)/release-notes
Expand Down Expand Up @@ -140,8 +141,9 @@ kubebuilder_assets: $(SETUP_ENVTEST)

.PHONY: test
TEST_PATHS ?= ./...
test: kubebuilder_assets
KUBEBUILDER_ASSETS="$(KUBEBUILDER_ASSETS)" go test -v $(TEST_PATHS) $(TEST_ARGS)
test: $(ARTIFACTS) $(GOTESTSUM) kubebuilder_assets
KUBEBUILDER_ASSETS="$(KUBEBUILDER_ASSETS)" $(GOTESTSUM) --junitfile $(ARTIFACTS)/junit.test.xml --junitfile-hide-empty-pkg --jsonfile $(ARTIFACTS)/test-output.log -- \
-v $(TEST_PATHS) $(TEST_ARGS)

E2E_TEMPLATES_DIR=test/e2e/data/infrastructure-openstack
E2E_KUSTOMIZE_DIR=test/e2e/data/kustomize
Expand Down
11 changes: 9 additions & 2 deletions hack/tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@
ROOT_DIR_RELATIVE := ../..
include $(ROOT_DIR_RELATIVE)/common.mk

GOLANGCI_LINT_VERSION := v1.57.2
GOLANGCI_LINT_VERSION ?= v1.57.2

UNAME := $(shell uname -s)
# GOTESTSUM version without the leading 'v'
GOTESTSUM_VERSION ?= 1.11.0

# Directories.
BIN_DIR := bin
SHARE_DIR := share

OS := $(shell go env GOOS)
ARCH ?= $(shell go env GOARCH)
RUST_TARGET := unknown-$(OS)-gnu

ifeq ($(OS), darwin)
Expand Down Expand Up @@ -77,6 +79,11 @@ SETUP_ENVTEST := $(BIN_DIR)/setup-envtest
$(SETUP_ENVTEST): go.mod go.sum | $(BIN_DIR)
go build -tags=tools -o $@ sigs.k8s.io/controller-runtime/tools/setup-envtest

GOTESTSUM := $(BIN_DIR)/gotestsum
$(GOTESTSUM): | $(BIN_DIR)
curl -L https://github.com/gotestyourself/gotestsum/releases/download/v$(GOTESTSUM_VERSION)/gotestsum_$(GOTESTSUM_VERSION)_linux_$(ARCH).tar.gz | \
tar -C $(BIN_DIR) -zxvf - gotestsum

GH_SHARE := $(SHARE_DIR)/gh

$(GH_SHARE): $(SHARE_DIR)
Expand Down

0 comments on commit 2e09b16

Please sign in to comment.