@@ -12,9 +12,13 @@ BUILD_ARGS ?=
12
12
# Architectures to build images for
13
13
BUILD_PLATFORMS ?= linux/amd64,linux/arm64,linux/arm/v7
14
14
15
- # Go additional tag arguments, e.g. 'integration'
15
+ # Go additional tag arguments, e.g. 'integration',
16
+ # this is append to the tag arguments required for static builds
16
17
GO_TAGS ?=
17
18
19
+ # Go additional test arguments, can not contain -tags
20
+ GO_TEST_ARGS ?= -race
21
+
18
22
# Produce CRDs that work back to Kubernetes 1.16
19
23
CRD_OPTIONS ?= crd:crdVersions=v1
20
24
@@ -96,15 +100,15 @@ build: check-deps $(LIBGIT2) ## Build manager binary
96
100
KUBEBUILDER_ASSETS? ="$(shell $(ENVTEST ) --arch=$(ENVTEST_ARCH ) use -i $(ENVTEST_KUBERNETES_VERSION ) --bin-dir=$(ENVTEST_ASSETS_DIR ) -p path) "
97
101
test : $(LIBGIT2 ) install-envtest test-api check-deps # # Run tests
98
102
KUBEBUILDER_ASSETS=$(KUBEBUILDER_ASSETS ) \
99
- go test $(GO_STATIC_FLAGS ) ./... -coverprofile cover.out
103
+ go test $(GO_TEST_ARGS ) $( GO_STATIC_FLAGS ) ./... -coverprofile cover.out
100
104
101
105
check-deps :
102
106
ifeq ($(shell uname -s) ,Darwin)
103
107
if ! command -v pkg-config &> /dev/null; then echo "pkg-config is required"; exit 1; fi
104
108
endif
105
109
106
110
test-api : # # Run api tests
107
- cd api; go test ./... -coverprofile cover.out
111
+ cd api; go test $( GO_TEST_ARGS ) ./... -coverprofile cover.out
108
112
109
113
run : $(LIBGIT2 ) generate fmt vet manifests # # Run against the configured Kubernetes cluster in ~/.kube/config
110
114
go run $(GO_STATIC_FLAGS ) ./main.go
0 commit comments