diff --git a/Makefile b/Makefile index 460333b5898..cf3020bda93 100644 --- a/Makefile +++ b/Makefile @@ -69,7 +69,7 @@ lint: ## Run code lint checks .PHONY: go-test go-test: ## Run the go tests ($ go test -v ./cmd/... ./pkg/...) - go test -v ./cmd/... ./pkg/... + go test -race -v ./cmd/... ./pkg/... .PHONY: test test: ## Run the unit tests (used in the CI) @@ -80,7 +80,7 @@ test-coverage: ## Run coveralls # remove all coverage files if exists - rm -rf *.out # run the go tests and gen the file coverage-all used to do the integration with coverrals.io - go test -failfast -tags=integration -coverprofile=coverage-all.out -covermode=count ./pkg/... ./cmd/... + go test -race -failfast -tags=integration -coverprofile=coverage-all.out ./pkg/... ./cmd/... .PHONY: test-e2e-local test-e2e-local: ## It will run the script to install kind and run e2e tests diff --git a/build/test.sh b/build/test.sh index 5e2767d3fd7..34eceb25d2d 100755 --- a/build/test.sh +++ b/build/test.sh @@ -37,7 +37,7 @@ kubebuilder create controller --group apps --version v1beta2 --kind Deployment - # Verify the controller-manager builds and the tests pass go build ./cmd/... go build ./pkg/... -go test ./cmd/... -go test ./pkg/... +go test -race ./cmd/... +go test -race ./pkg/... fi diff --git a/test.sh b/test.sh index aa4a0f9997c..9f769bd8168 100755 --- a/test.sh +++ b/test.sh @@ -140,7 +140,7 @@ header_text "running kubebuilder unit tests" cd ${go_workspace}/src/sigs.k8s.io/kubebuilder export GO111MODULE=on -go test ./cmd/... ./pkg/... +go test -race ./cmd/... ./pkg/... # test project v2 GO111MODULE=on test_project project-v2 2