Skip to content

Commit 20f4933

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

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ BUILD_PLATFORMS ?= linux/amd64,linux/arm64,linux/arm/v7
1515
# Go additional tag arguments, e.g. 'integration'
1616
GO_TAGS ?=
1717

18+
# Go additional test arguments
19+
GO_TEST_ARGS ?= -race
20+
1821
# Produce CRDs that work back to Kubernetes 1.16
1922
CRD_OPTIONS ?= crd:crdVersions=v1
2023

@@ -96,15 +99,15 @@ build: check-deps $(LIBGIT2) ## Build manager binary
9699
KUBEBUILDER_ASSETS?="$(shell $(ENVTEST) --arch=$(ENVTEST_ARCH) use -i $(ENVTEST_KUBERNETES_VERSION) --bin-dir=$(ENVTEST_ASSETS_DIR) -p path)"
97100
test: $(LIBGIT2) install-envtest test-api check-deps ## Run tests
98101
KUBEBUILDER_ASSETS=$(KUBEBUILDER_ASSETS) \
99-
go test $(GO_STATIC_FLAGS) ./... -coverprofile cover.out
102+
go test $(GO_TEST_ARGS) $(GO_STATIC_FLAGS) ./... -coverprofile cover.out
100103

101104
check-deps:
102105
ifeq ($(shell uname -s),Darwin)
103106
if ! command -v pkg-config &> /dev/null; then echo "pkg-config is required"; exit 1; fi
104107
endif
105108

106109
test-api: ## Run api tests
107-
cd api; go test ./... -coverprofile cover.out
110+
cd api; go test $(GO_TEST_ARGS) ./... -coverprofile cover.out
108111

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

0 commit comments

Comments
 (0)