Skip to content

Commit 2a05236

Browse files
committed
build: enable -race for go test
Signed-off-by: Hidde Beydals <[email protected]>
1 parent a4d6bbc commit 2a05236

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ BUILD_ARGS ?=
1212
# Architectures to build images for
1313
BUILD_PLATFORMS ?= linux/amd64,linux/arm64,linux/arm/v7
1414

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
1617
GO_TAGS ?=
1718

19+
# Go additional test arguments, can not contain -tags
20+
GO_TEST_ARGS ?= -race
21+
1822
# Produce CRDs that work back to Kubernetes 1.16
1923
CRD_OPTIONS ?= crd:crdVersions=v1
2024

@@ -96,15 +100,15 @@ build: check-deps $(LIBGIT2) ## Build manager binary
96100
KUBEBUILDER_ASSETS?="$(shell $(ENVTEST) --arch=$(ENVTEST_ARCH) use -i $(ENVTEST_KUBERNETES_VERSION) --bin-dir=$(ENVTEST_ASSETS_DIR) -p path)"
97101
test: $(LIBGIT2) install-envtest test-api check-deps ## Run tests
98102
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
100104

101105
check-deps:
102106
ifeq ($(shell uname -s),Darwin)
103107
if ! command -v pkg-config &> /dev/null; then echo "pkg-config is required"; exit 1; fi
104108
endif
105109

106110
test-api: ## Run api tests
107-
cd api; go test ./... -coverprofile cover.out
111+
cd api; go test $(GO_TEST_ARGS) ./... -coverprofile cover.out
108112

109113
run: $(LIBGIT2) generate fmt vet manifests ## Run against the configured Kubernetes cluster in ~/.kube/config
110114
go run $(GO_STATIC_FLAGS) ./main.go

0 commit comments

Comments
 (0)