Skip to content

Commit

Permalink
*: upgrade gomock (#46394)
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkingrei authored Aug 25, 2023
1 parent 4c8e6af commit 9b7c1e2
Show file tree
Hide file tree
Showing 29 changed files with 48 additions and 35 deletions.
13 changes: 13 additions & 0 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -10382,6 +10382,19 @@ def go_deps():
"https://storage.googleapis.com/pingcapmirror/gomod/go.uber.org/goleak/org_uber_go_goleak-v1.2.1.zip",
],
)
go_repository(
name = "org_uber_go_mock",
build_file_proto_mode = "disable_global",
importpath = "go.uber.org/mock",
sha256 = "df840a589119d0c1966e3f8888fb6b6a05b4aa793b1074c3fd4c4a508e0b0e3a",
strip_prefix = "go.uber.org/mock@v0.2.0",
urls = [
"http://bazel-cache.pingcap.net:8080/gomod/go.uber.org/mock/org_uber_go_mock-v0.2.0.zip",
"http://ats.apps.svc/gomod/go.uber.org/mock/org_uber_go_mock-v0.2.0.zip",
"https://cache.hawkingrei.com/gomod/go.uber.org/mock/org_uber_go_mock-v0.2.0.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/go.uber.org/mock/org_uber_go_mock-v0.2.0.zip",
],
)
go_repository(
name = "org_uber_go_multierr",
build_file_proto_mode = "disable_global",
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/lightning/backend/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ go_test(
"//br/pkg/mock",
"//parser/mysql",
"@com_github_go_sql_driver_mysql//:mysql",
"@com_github_golang_mock//gomock",
"@com_github_google_uuid//:uuid",
"@com_github_pingcap_errors//:errors",
"@com_github_stretchr_testify//require",
"@com_github_tikv_client_go_v2//oracle",
"@org_uber_go_mock//gomock",
],
)
2 changes: 1 addition & 1 deletion br/pkg/lightning/backend/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"time"

gmysql "github.com/go-sql-driver/mysql"
"github.com/golang/mock/gomock"
"github.com/google/uuid"
"github.com/pingcap/errors"
"github.com/pingcap/tidb/br/pkg/lightning/backend"
Expand All @@ -16,6 +15,7 @@ import (
"github.com/pingcap/tidb/parser/mysql"
"github.com/stretchr/testify/require"
"github.com/tikv/client-go/v2/oracle"
"go.uber.org/mock/gomock"
)

type backendSuite struct {
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/lightning/backend/local/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ go_test(
"@com_github_data_dog_go_sqlmock//:go-sqlmock",
"@com_github_docker_go_units//:go-units",
"@com_github_go_sql_driver_mysql//:mysql",
"@com_github_golang_mock//gomock",
"@com_github_google_uuid//:uuid",
"@com_github_pingcap_errors//:errors",
"@com_github_pingcap_failpoint//:failpoint",
Expand All @@ -170,5 +169,6 @@ go_test(
"@org_golang_google_grpc//encoding",
"@org_golang_google_grpc//status",
"@org_uber_go_atomic//:atomic",
"@org_uber_go_mock//gomock",
],
)
2 changes: 1 addition & 1 deletion br/pkg/lightning/backend/local/disk_quota_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ package local
import (
"testing"

"github.com/golang/mock/gomock"
"github.com/google/uuid"
"github.com/pingcap/tidb/br/pkg/lightning/backend"
"github.com/pingcap/tidb/br/pkg/mock/mocklocal"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
)

func TestCheckDiskQuota(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/lightning/importer/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ go_test(
"@com_github_data_dog_go_sqlmock//:go-sqlmock",
"@com_github_docker_go_units//:go-units",
"@com_github_go_sql_driver_mysql//:mysql",
"@com_github_golang_mock//gomock",
"@com_github_google_uuid//:uuid",
"@com_github_pingcap_errors//:errors",
"@com_github_pingcap_failpoint//:failpoint",
Expand All @@ -182,6 +181,7 @@ go_test(
"@com_github_xitongsys_parquet_go_source//buffer",
"@io_etcd_go_etcd_client_v3//:client",
"@io_etcd_go_etcd_tests_v3//integration",
"@org_uber_go_mock//gomock",
"@org_uber_go_zap//:zap",
],
)
2 changes: 1 addition & 1 deletion br/pkg/lightning/importer/chunk_process_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"sync"
"testing"

"github.com/golang/mock/gomock"
"github.com/pingcap/errors"
"github.com/pingcap/failpoint"
"github.com/pingcap/tidb/br/pkg/lightning/backend"
Expand All @@ -51,6 +50,7 @@ import (
filter "github.com/pingcap/tidb/util/table-filter"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"go.uber.org/mock/gomock"
)

type chunkRestoreSuite struct {
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/lightning/importer/restore_schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"testing"

"github.com/DATA-DOG/go-sqlmock"
"github.com/golang/mock/gomock"
"github.com/pingcap/errors"
"github.com/pingcap/tidb/br/pkg/lightning/backend"
"github.com/pingcap/tidb/br/pkg/lightning/checkpoints"
Expand All @@ -38,6 +37,7 @@ import (
filter "github.com/pingcap/tidb/util/table-filter"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"go.uber.org/mock/gomock"
)

type restoreSchemaSuite struct {
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/lightning/importer/table_import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (

"github.com/DATA-DOG/go-sqlmock"
"github.com/docker/go-units"
"github.com/golang/mock/gomock"
"github.com/google/uuid"
"github.com/pingcap/errors"
"github.com/pingcap/failpoint"
Expand Down Expand Up @@ -71,6 +70,7 @@ import (
"github.com/stretchr/testify/suite"
"github.com/tikv/client-go/v2/testutils"
pd "github.com/tikv/pd/client"
"go.uber.org/mock/gomock"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/lightning/mydump/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ go_test(
"//util/filter",
"//util/table-filter",
"//util/table-router",
"@com_github_golang_mock//gomock",
"@com_github_pingcap_errors//:errors",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
"@com_github_xitongsys_parquet_go//writer",
"@com_github_xitongsys_parquet_go_source//local",
"@org_uber_go_goleak//:goleak",
"@org_uber_go_mock//gomock",
"@org_uber_go_zap//:zap",
],
)
2 changes: 1 addition & 1 deletion br/pkg/lightning/mydump/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import (
"path/filepath"
"testing"

"github.com/golang/mock/gomock"
. "github.com/pingcap/tidb/br/pkg/lightning/mydump"
mockstorage "github.com/pingcap/tidb/br/pkg/mock/storage"
"github.com/pingcap/tidb/br/pkg/storage"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
)

func TestExportStatementNoTrailingNewLine(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/metautil/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ go_test(
deps = [
"//br/pkg/mock/storage",
"//testkit/testsetup",
"@com_github_golang_mock//gomock",
"@com_github_pingcap_kvproto//pkg/brpb",
"@com_github_pingcap_kvproto//pkg/encryptionpb",
"@com_github_stretchr_testify//require",
"@org_uber_go_goleak//:goleak",
"@org_uber_go_mock//gomock",
],
)
2 changes: 1 addition & 1 deletion br/pkg/metautil/metafile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"crypto/sha256"
"testing"

"github.com/golang/mock/gomock"
backuppb "github.com/pingcap/kvproto/pkg/brpb"
"github.com/pingcap/kvproto/pkg/encryptionpb"
mockstorage "github.com/pingcap/tidb/br/pkg/mock/storage"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
)

func checksum(m *backuppb.MetaFile) []byte {
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/mock/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ go_library(
"@com_github_aws_aws_sdk_go//aws/request",
"@com_github_aws_aws_sdk_go//service/s3",
"@com_github_go_sql_driver_mysql//:mysql",
"@com_github_golang_mock//gomock",
"@com_github_google_uuid//:uuid",
"@com_github_pingcap_errors//:errors",
"@com_github_pingcap_kvproto//pkg/import_kvpb",
Expand All @@ -38,6 +37,7 @@ go_library(
"@io_opencensus_go//stats/view",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//metadata",
"@org_uber_go_mock//gomock",
"@org_uber_go_zap//:zap",
],
)
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/mock/backend.go

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

2 changes: 1 addition & 1 deletion br/pkg/mock/encode.go

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

2 changes: 1 addition & 1 deletion br/pkg/mock/importer.go

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

2 changes: 1 addition & 1 deletion br/pkg/mock/mocklocal/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//br/pkg/lightning/backend",
"@com_github_golang_mock//gomock",
"@com_github_pingcap_kvproto//pkg/import_sstpb",
"@org_uber_go_mock//gomock",
],
)
2 changes: 1 addition & 1 deletion br/pkg/mock/mocklocal/local.go

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

2 changes: 1 addition & 1 deletion br/pkg/mock/s3iface.go

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

2 changes: 1 addition & 1 deletion br/pkg/mock/storage/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//br/pkg/storage",
"@com_github_golang_mock//gomock",
"@org_uber_go_mock//gomock",
],
)
2 changes: 1 addition & 1 deletion br/pkg/mock/storage/storage.go

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

2 changes: 1 addition & 1 deletion br/pkg/mock/task_register.go

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

2 changes: 1 addition & 1 deletion br/pkg/storage/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ go_test(
"@com_github_azure_azure_sdk_for_go_sdk_storage_azblob//:azblob",
"@com_github_azure_azure_sdk_for_go_sdk_storage_azblob//bloberror",
"@com_github_fsouza_fake_gcs_server//fakestorage",
"@com_github_golang_mock//gomock",
"@com_github_pingcap_errors//:errors",
"@com_github_pingcap_failpoint//:failpoint",
"@com_github_pingcap_kvproto//pkg/brpb",
"@com_github_stretchr_testify//require",
"@org_uber_go_mock//gomock",
],
)
2 changes: 1 addition & 1 deletion br/pkg/storage/s3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import (
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/golang/mock/gomock"
"github.com/pingcap/errors"
"github.com/pingcap/failpoint"
backuppb "github.com/pingcap/kvproto/pkg/brpb"
"github.com/pingcap/tidb/br/pkg/mock"
. "github.com/pingcap/tidb/br/pkg/storage"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
)

const bucketRegionHeader = "X-Amz-Bucket-Region"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ require (
github.com/go-ldap/ldap/v3 v3.4.4
github.com/go-sql-driver/mysql v1.7.1
github.com/gogo/protobuf v1.3.2
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.3
github.com/golang/snappy v0.0.4
github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2
Expand Down Expand Up @@ -117,6 +116,7 @@ require (
go.uber.org/atomic v1.11.0
go.uber.org/automaxprocs v1.5.3
go.uber.org/goleak v1.2.1
go.uber.org/mock v0.2.0
go.uber.org/multierr v1.11.0
go.uber.org/zap v1.25.0
golang.org/x/exp v0.0.0-20230711005742-c3f37128e5a4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,6 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/golang/protobuf v0.0.0-20180814211427-aa810b61a9c7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
Expand Down Expand Up @@ -1130,6 +1128,8 @@ go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A=
go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4=
go.uber.org/mock v0.2.0 h1:TaP3xedm7JaAgScZO7tlvlKrqT0p7I6OsdGB5YNSMDU=
go.uber.org/mock v0.2.0/go.mod h1:J0y0rp9L3xiff1+ZBfKxlC1fz2+aO16tw0tsDOixfuM=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
Expand Down
2 changes: 1 addition & 1 deletion tests/realtikvtest/importintotest/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ go_test(
"//util/sem",
"@com_github_docker_go_units//:go-units",
"@com_github_fsouza_fake_gcs_server//fakestorage",
"@com_github_golang_mock//gomock",
"@com_github_ngaut_pools//:pools",
"@com_github_pingcap_errors//:errors",
"@com_github_pingcap_failpoint//:failpoint",
Expand All @@ -58,6 +57,7 @@ go_test(
"@com_github_tikv_pd_client//:client",
"@io_etcd_go_etcd_client_v3//:client",
"@org_uber_go_atomic//:atomic",
"@org_uber_go_mock//gomock",
"@org_uber_go_zap//:zap",
],
)
Loading

0 comments on commit 9b7c1e2

Please sign in to comment.