Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
mock: enable the mock package only in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kennytm committed Mar 10, 2021
1 parent 6e1a8ca commit 047ea6a
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ build_for_integration_test:
test:
$(PREPARE_MOD)
@make failpoint-enable
$(GOTEST) $(RACEFLAG) -tags leak $$($(PACKAGES)) || ( make failpoint-disable && exit 1 )
$(GOTEST) $(RACEFLAG) -tags br_test,leak $$($(PACKAGES)) || ( make failpoint-disable && exit 1 )
@make failpoint-disable

testcover: tools
Expand Down Expand Up @@ -188,7 +188,7 @@ static: prepare tools
@# exhaustivestruct - Protobuf structs have hidden fields, like "XXX_NoUnkeyedLiteral"
@# exhaustive - no need to check exhaustiveness of enum switch statements
@# gosec - too many false positive
CGO_ENABLED=0 tools/bin/golangci-lint run --enable-all --deadline 120s \
CGO_ENABLED=0 tools/bin/golangci-lint run --enable-all --build-tags br_test --deadline 120s \
--disable gochecknoglobals \
--disable goimports \
--disable gofmt \
Expand Down
2 changes: 2 additions & 0 deletions pkg/mock/backend.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkg/mock/dummy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Copyright 2021 PingCAP, Inc. Licensed under Apache-2.0.

// This file avoids mock being an empty package when `-tags br_test` is not provided.

package mock
6 changes: 4 additions & 2 deletions pkg/mock/glue.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/mock/glue_checkpoint.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/mock/importer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/mock/mock_cluster.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0.

//+build br_test

package mock

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/mock/mock_cluster_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0.

//+build br_test

package mock_test

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/mock/s3iface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/mock/storage.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 047ea6a

Please sign in to comment.