Skip to content

Commit

Permalink
build: enable -race for go test
Browse files Browse the repository at this point in the history
Signed-off-by: Hidde Beydals <[email protected]>
  • Loading branch information
hiddeco committed Mar 15, 2022
1 parent a4d6bbc commit 2a05236
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ BUILD_ARGS ?=
# Architectures to build images for
BUILD_PLATFORMS ?= linux/amd64,linux/arm64,linux/arm/v7

# Go additional tag arguments, e.g. 'integration'
# Go additional tag arguments, e.g. 'integration',
# this is append to the tag arguments required for static builds
GO_TAGS ?=

# Go additional test arguments, can not contain -tags
GO_TEST_ARGS ?= -race

# Produce CRDs that work back to Kubernetes 1.16
CRD_OPTIONS ?= crd:crdVersions=v1

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

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

test-api: ## Run api tests
cd api; go test ./... -coverprofile cover.out
cd api; go test $(GO_TEST_ARGS) ./... -coverprofile cover.out

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

0 comments on commit 2a05236

Please sign in to comment.