Skip to content

Commit 044cf55

Browse files
committed
Add Make variable to change the Go test command
This provides a way to change the formatting of test results. For example, the `gotest.tools/gotestsum` module highlights skipped tests and stores results as JUnit XML files. make check GO_TEST='gotestsum --'
1 parent 864411c commit 044cf55

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ DEBUG_BUILD ?= false
6363
GO ?= go
6464
GO_BUILD = $(GO_CMD) build -trimpath
6565
GO_CMD = $(GO_ENV) $(GO)
66+
GO_TEST ?= $(GO) test
6667

6768
# Disable optimizations if creating a debug build
6869
ifeq ("$(DEBUG_BUILD)", "true")
@@ -189,17 +190,17 @@ pgo-base-docker: pgo-base-build
189190
#======== Utility =======
190191
.PHONY: check
191192
check:
192-
$(GO) test -cover ./...
193+
$(GO_TEST) -cover ./...
193194

194195
# - KUBEBUILDER_ATTACH_CONTROL_PLANE_OUTPUT=true
195196
.PHONY: check-envtest
196197
check-envtest: hack/tools/envtest
197-
KUBEBUILDER_ASSETS="$(CURDIR)/$^/bin" $(GO) test -count=1 -cover -tags=envtest ./...
198+
KUBEBUILDER_ASSETS="$(CURDIR)/$^/bin" $(GO_TEST) -count=1 -cover -tags=envtest ./...
198199

199200
.PHONY: check-envtest-existing
200201
check-envtest-existing:
201202
${PGO_KUBE_CLIENT} apply -k ./config/dev
202-
USE_EXISTING_CLUSTER=true $(GO) test -count=1 -cover -tags=envtest ./...
203+
USE_EXISTING_CLUSTER=true $(GO_TEST) -count=1 -cover -tags=envtest ./...
203204
${PGO_KUBE_CLIENT} delete -k ./config/dev
204205

205206

0 commit comments

Comments
 (0)