Skip to content

Commit 38e174d

Browse files
feat: add go test with -race conditional
1 parent 2ce4740 commit 38e174d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ lint: ## Run code lint checks
6969

7070
.PHONY: go-test
7171
go-test: ## Run the go tests ($ go test -v ./cmd/... ./pkg/...)
72-
go test -v ./cmd/... ./pkg/...
72+
go test -race -v ./cmd/... ./pkg/...
7373

7474
.PHONY: test
7575
test: ## Run the unit tests (used in the CI)
@@ -80,7 +80,7 @@ test-coverage: ## Run coveralls
8080
# remove all coverage files if exists
8181
- rm -rf *.out
8282
# run the go tests and gen the file coverage-all used to do the integration with coverrals.io
83-
go test -failfast -tags=integration -coverprofile=coverage-all.out -covermode=count ./pkg/... ./cmd/...
83+
go test -race -failfast -tags=integration -coverprofile=coverage-all.out -covermode=atomic ./pkg/... ./cmd/...
8484

8585
.PHONY: test-e2e-local
8686
test-e2e-local: ## It will run the script to install kind and run e2e tests

build/test.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ kubebuilder create controller --group apps --version v1beta2 --kind Deployment -
3737
# Verify the controller-manager builds and the tests pass
3838
go build ./cmd/...
3939
go build ./pkg/...
40-
go test ./cmd/...
41-
go test ./pkg/...
40+
go test -race ./cmd/...
41+
go test -race ./pkg/...
4242

4343
fi

test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ header_text "running kubebuilder unit tests"
140140
cd ${go_workspace}/src/sigs.k8s.io/kubebuilder
141141

142142
export GO111MODULE=on
143-
go test ./cmd/... ./pkg/...
143+
go test -race ./cmd/... ./pkg/...
144144

145145
# test project v2
146146
GO111MODULE=on test_project project-v2 2

0 commit comments

Comments
 (0)