From 09b144cf20bcded86c471b422e21a574258f2140 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 18 Oct 2024 04:07:42 +0000 Subject: [PATCH 1/5] build(deps): bump go.uber.org/mock from 0.4.0 to 0.5.0 Bumps [go.uber.org/mock](https://github.com/uber/mock) from 0.4.0 to 0.5.0. - [Release notes](https://github.com/uber/mock/releases) - [Changelog](https://github.com/uber-go/mock/blob/main/CHANGELOG.md) - [Commits](https://github.com/uber/mock/compare/v0.4.0...v0.5.0) --- updated-dependencies: - dependency-name: go.uber.org/mock dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 3a1d2e502b2b4..21719094b228b 100644 --- a/go.mod +++ b/go.mod @@ -126,7 +126,7 @@ require ( go.uber.org/atomic v1.11.0 go.uber.org/automaxprocs v1.6.0 go.uber.org/goleak v1.3.0 - go.uber.org/mock v0.4.0 + go.uber.org/mock v0.5.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 diff --git a/go.sum b/go.sum index 58af487205238..0777fae3c64c6 100644 --- a/go.sum +++ b/go.sum @@ -931,8 +931,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.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= 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= From e9dc1a54ede1a093cf23ddf18b956518c4af2e93 Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Mon, 21 Oct 2024 11:24:48 +0800 Subject: [PATCH 2/5] update Signed-off-by: Weizhen Wang --- DEPS.bzl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/DEPS.bzl b/DEPS.bzl index 32bd87ac3fbed..13318e9fb9da5 100644 --- a/DEPS.bzl +++ b/DEPS.bzl @@ -10547,13 +10547,13 @@ def go_deps(): name = "org_uber_go_mock", build_file_proto_mode = "disable_global", importpath = "go.uber.org/mock", - sha256 = "29c088ba1621e04fba8670e388e962f92c15f47cd45a63bf0e5decd6d5d63cd1", - strip_prefix = "go.uber.org/mock@v0.4.0", + sha256 = "2ac483710c9e6641baf6c9a4d692912d36967a5ebf1e38d47340507d4b882345", + strip_prefix = "go.uber.org/mock@v0.5.0", urls = [ - "http://bazel-cache.pingcap.net:8080/gomod/go.uber.org/mock/org_uber_go_mock-v0.4.0.zip", - "http://ats.apps.svc/gomod/go.uber.org/mock/org_uber_go_mock-v0.4.0.zip", - "https://cache.hawkingrei.com/gomod/go.uber.org/mock/org_uber_go_mock-v0.4.0.zip", - "https://storage.googleapis.com/pingcapmirror/gomod/go.uber.org/mock/org_uber_go_mock-v0.4.0.zip", + "http://bazel-cache.pingcap.net:8080/gomod/go.uber.org/mock/org_uber_go_mock-v0.5.0.zip", + "http://ats.apps.svc/gomod/go.uber.org/mock/org_uber_go_mock-v0.5.0.zip", + "https://cache.hawkingrei.com/gomod/go.uber.org/mock/org_uber_go_mock-v0.5.0.zip", + "https://storage.googleapis.com/pingcapmirror/gomod/go.uber.org/mock/org_uber_go_mock-v0.5.0.zip", ], ) go_repository( From 1dd35094b0fd54861ad2736e0b3fc06f79a20b93 Mon Sep 17 00:00:00 2001 From: lance6716 Date: Mon, 21 Oct 2024 13:22:24 +0800 Subject: [PATCH 3/5] update my patch Signed-off-by: lance6716 --- Makefile | 2 +- br/pkg/mock/backend.go | 109 +++++++++++++++++---------------- br/pkg/mock/encode.go | 29 +++++---- br/pkg/mock/mocklocal/local.go | 38 +++++++----- br/pkg/mock/task_register.go | 26 ++++---- 5 files changed, 110 insertions(+), 94 deletions(-) diff --git a/Makefile b/Makefile index da2af3f21628f..44d11495e9318 100644 --- a/Makefile +++ b/Makefile @@ -334,7 +334,7 @@ tools/bin/gotestsum: # mockgen@v0.2.0 is imcompatible with v0.3.0, so install it always. .PHONY: mockgen mockgen: - GOBIN=$(shell pwd)/tools/bin $(GO) install github.com/lance6716/mock/mockgen@v0.4.0-patch + GOBIN=$(shell pwd)/tools/bin $(GO) install github.com/lance6716/mock/mockgen@v0.5.0-patch-3 # Usage: # diff --git a/br/pkg/mock/backend.go b/br/pkg/mock/backend.go index 0da3733bb8558..d50ff269d1cae 100644 --- a/br/pkg/mock/backend.go +++ b/br/pkg/mock/backend.go @@ -5,6 +5,7 @@ // // mockgen -package mock github.com/pingcap/tidb/pkg/lightning/backend Backend,EngineWriter,TargetInfoGetter,ChunkFlushStatus // + // Package mock is a generated GoMock package. package mock @@ -24,6 +25,7 @@ import ( type MockBackend struct { ctrl *gomock.Controller recorder *MockBackendMockRecorder + isgomock struct{} } // MockBackendMockRecorder is the mock recorder for MockBackend. @@ -44,17 +46,17 @@ func (m *MockBackend) EXPECT() *MockBackendMockRecorder { } // CleanupEngine mocks base method. -func (m *MockBackend) CleanupEngine(arg0 context.Context, arg1 uuid.UUID) error { +func (m *MockBackend) CleanupEngine(ctx context.Context, engineUUID uuid.UUID) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CleanupEngine", arg0, arg1) + ret := m.ctrl.Call(m, "CleanupEngine", ctx, engineUUID) ret0, _ := ret[0].(error) return ret0 } // CleanupEngine indicates an expected call of CleanupEngine. -func (mr *MockBackendMockRecorder) CleanupEngine(arg0, arg1 any) *gomock.Call { +func (mr *MockBackendMockRecorder) CleanupEngine(ctx, engineUUID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CleanupEngine", reflect.TypeOf((*MockBackend)(nil).CleanupEngine), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CleanupEngine", reflect.TypeOf((*MockBackend)(nil).CleanupEngine), ctx, engineUUID) } // Close mocks base method. @@ -70,102 +72,102 @@ func (mr *MockBackendMockRecorder) Close() *gomock.Call { } // CloseEngine mocks base method. -func (m *MockBackend) CloseEngine(arg0 context.Context, arg1 *backend.EngineConfig, arg2 uuid.UUID) error { +func (m *MockBackend) CloseEngine(ctx context.Context, config *backend.EngineConfig, engineUUID uuid.UUID) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CloseEngine", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "CloseEngine", ctx, config, engineUUID) ret0, _ := ret[0].(error) return ret0 } // CloseEngine indicates an expected call of CloseEngine. -func (mr *MockBackendMockRecorder) CloseEngine(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockBackendMockRecorder) CloseEngine(ctx, config, engineUUID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseEngine", reflect.TypeOf((*MockBackend)(nil).CloseEngine), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseEngine", reflect.TypeOf((*MockBackend)(nil).CloseEngine), ctx, config, engineUUID) } // FlushAllEngines mocks base method. -func (m *MockBackend) FlushAllEngines(arg0 context.Context) error { +func (m *MockBackend) FlushAllEngines(ctx context.Context) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FlushAllEngines", arg0) + ret := m.ctrl.Call(m, "FlushAllEngines", ctx) ret0, _ := ret[0].(error) return ret0 } // FlushAllEngines indicates an expected call of FlushAllEngines. -func (mr *MockBackendMockRecorder) FlushAllEngines(arg0 any) *gomock.Call { +func (mr *MockBackendMockRecorder) FlushAllEngines(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FlushAllEngines", reflect.TypeOf((*MockBackend)(nil).FlushAllEngines), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FlushAllEngines", reflect.TypeOf((*MockBackend)(nil).FlushAllEngines), ctx) } // FlushEngine mocks base method. -func (m *MockBackend) FlushEngine(arg0 context.Context, arg1 uuid.UUID) error { +func (m *MockBackend) FlushEngine(ctx context.Context, engineUUID uuid.UUID) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FlushEngine", arg0, arg1) + ret := m.ctrl.Call(m, "FlushEngine", ctx, engineUUID) ret0, _ := ret[0].(error) return ret0 } // FlushEngine indicates an expected call of FlushEngine. -func (mr *MockBackendMockRecorder) FlushEngine(arg0, arg1 any) *gomock.Call { +func (mr *MockBackendMockRecorder) FlushEngine(ctx, engineUUID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FlushEngine", reflect.TypeOf((*MockBackend)(nil).FlushEngine), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FlushEngine", reflect.TypeOf((*MockBackend)(nil).FlushEngine), ctx, engineUUID) } // ImportEngine mocks base method. -func (m *MockBackend) ImportEngine(arg0 context.Context, arg1 uuid.UUID, arg2, arg3 int64) error { +func (m *MockBackend) ImportEngine(ctx context.Context, engineUUID uuid.UUID, regionSplitSize, regionSplitKeys int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ImportEngine", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "ImportEngine", ctx, engineUUID, regionSplitSize, regionSplitKeys) ret0, _ := ret[0].(error) return ret0 } // ImportEngine indicates an expected call of ImportEngine. -func (mr *MockBackendMockRecorder) ImportEngine(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *MockBackendMockRecorder) ImportEngine(ctx, engineUUID, regionSplitSize, regionSplitKeys any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImportEngine", reflect.TypeOf((*MockBackend)(nil).ImportEngine), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImportEngine", reflect.TypeOf((*MockBackend)(nil).ImportEngine), ctx, engineUUID, regionSplitSize, regionSplitKeys) } // LocalWriter mocks base method. -func (m *MockBackend) LocalWriter(arg0 context.Context, arg1 *backend.LocalWriterConfig, arg2 uuid.UUID) (backend.EngineWriter, error) { +func (m *MockBackend) LocalWriter(ctx context.Context, cfg *backend.LocalWriterConfig, engineUUID uuid.UUID) (backend.EngineWriter, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LocalWriter", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "LocalWriter", ctx, cfg, engineUUID) ret0, _ := ret[0].(backend.EngineWriter) ret1, _ := ret[1].(error) return ret0, ret1 } // LocalWriter indicates an expected call of LocalWriter. -func (mr *MockBackendMockRecorder) LocalWriter(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockBackendMockRecorder) LocalWriter(ctx, cfg, engineUUID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LocalWriter", reflect.TypeOf((*MockBackend)(nil).LocalWriter), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LocalWriter", reflect.TypeOf((*MockBackend)(nil).LocalWriter), ctx, cfg, engineUUID) } // OpenEngine mocks base method. -func (m *MockBackend) OpenEngine(arg0 context.Context, arg1 *backend.EngineConfig, arg2 uuid.UUID) error { +func (m *MockBackend) OpenEngine(ctx context.Context, config *backend.EngineConfig, engineUUID uuid.UUID) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "OpenEngine", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "OpenEngine", ctx, config, engineUUID) ret0, _ := ret[0].(error) return ret0 } // OpenEngine indicates an expected call of OpenEngine. -func (mr *MockBackendMockRecorder) OpenEngine(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockBackendMockRecorder) OpenEngine(ctx, config, engineUUID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OpenEngine", reflect.TypeOf((*MockBackend)(nil).OpenEngine), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OpenEngine", reflect.TypeOf((*MockBackend)(nil).OpenEngine), ctx, config, engineUUID) } // ResetEngine mocks base method. -func (m *MockBackend) ResetEngine(arg0 context.Context, arg1 uuid.UUID) error { +func (m *MockBackend) ResetEngine(ctx context.Context, engineUUID uuid.UUID) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ResetEngine", arg0, arg1) + ret := m.ctrl.Call(m, "ResetEngine", ctx, engineUUID) ret0, _ := ret[0].(error) return ret0 } // ResetEngine indicates an expected call of ResetEngine. -func (mr *MockBackendMockRecorder) ResetEngine(arg0, arg1 any) *gomock.Call { +func (mr *MockBackendMockRecorder) ResetEngine(ctx, engineUUID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetEngine", reflect.TypeOf((*MockBackend)(nil).ResetEngine), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetEngine", reflect.TypeOf((*MockBackend)(nil).ResetEngine), ctx, engineUUID) } // RetryImportDelay mocks base method. @@ -200,6 +202,7 @@ func (mr *MockBackendMockRecorder) ShouldPostProcess() *gomock.Call { type MockEngineWriter struct { ctrl *gomock.Controller recorder *MockEngineWriterMockRecorder + isgomock struct{} } // MockEngineWriterMockRecorder is the mock recorder for MockEngineWriter. @@ -220,32 +223,32 @@ func (m *MockEngineWriter) EXPECT() *MockEngineWriterMockRecorder { } // AppendRows mocks base method. -func (m *MockEngineWriter) AppendRows(arg0 context.Context, arg1 []string, arg2 encode.Rows) error { +func (m *MockEngineWriter) AppendRows(ctx context.Context, columnNames []string, rows encode.Rows) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AppendRows", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "AppendRows", ctx, columnNames, rows) ret0, _ := ret[0].(error) return ret0 } // AppendRows indicates an expected call of AppendRows. -func (mr *MockEngineWriterMockRecorder) AppendRows(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockEngineWriterMockRecorder) AppendRows(ctx, columnNames, rows any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppendRows", reflect.TypeOf((*MockEngineWriter)(nil).AppendRows), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppendRows", reflect.TypeOf((*MockEngineWriter)(nil).AppendRows), ctx, columnNames, rows) } // Close mocks base method. -func (m *MockEngineWriter) Close(arg0 context.Context) (backend.ChunkFlushStatus, error) { +func (m *MockEngineWriter) Close(ctx context.Context) (backend.ChunkFlushStatus, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Close", arg0) + ret := m.ctrl.Call(m, "Close", ctx) ret0, _ := ret[0].(backend.ChunkFlushStatus) ret1, _ := ret[1].(error) return ret0, ret1 } // Close indicates an expected call of Close. -func (mr *MockEngineWriterMockRecorder) Close(arg0 any) *gomock.Call { +func (mr *MockEngineWriterMockRecorder) Close(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockEngineWriter)(nil).Close), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockEngineWriter)(nil).Close), ctx) } // IsSynced mocks base method. @@ -266,6 +269,7 @@ func (mr *MockEngineWriterMockRecorder) IsSynced() *gomock.Call { type MockTargetInfoGetter struct { ctrl *gomock.Controller recorder *MockTargetInfoGetterMockRecorder + isgomock struct{} } // MockTargetInfoGetterMockRecorder is the mock recorder for MockTargetInfoGetter. @@ -286,53 +290,54 @@ func (m *MockTargetInfoGetter) EXPECT() *MockTargetInfoGetterMockRecorder { } // CheckRequirements mocks base method. -func (m *MockTargetInfoGetter) CheckRequirements(arg0 context.Context, arg1 *backend.CheckCtx) error { +func (m *MockTargetInfoGetter) CheckRequirements(ctx context.Context, checkCtx *backend.CheckCtx) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CheckRequirements", arg0, arg1) + ret := m.ctrl.Call(m, "CheckRequirements", ctx, checkCtx) ret0, _ := ret[0].(error) return ret0 } // CheckRequirements indicates an expected call of CheckRequirements. -func (mr *MockTargetInfoGetterMockRecorder) CheckRequirements(arg0, arg1 any) *gomock.Call { +func (mr *MockTargetInfoGetterMockRecorder) CheckRequirements(ctx, checkCtx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckRequirements", reflect.TypeOf((*MockTargetInfoGetter)(nil).CheckRequirements), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckRequirements", reflect.TypeOf((*MockTargetInfoGetter)(nil).CheckRequirements), ctx, checkCtx) } // FetchRemoteDBModels mocks base method. -func (m *MockTargetInfoGetter) FetchRemoteDBModels(arg0 context.Context) ([]*model.DBInfo, error) { +func (m *MockTargetInfoGetter) FetchRemoteDBModels(ctx context.Context) ([]*model.DBInfo, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FetchRemoteDBModels", arg0) + ret := m.ctrl.Call(m, "FetchRemoteDBModels", ctx) ret0, _ := ret[0].([]*model.DBInfo) ret1, _ := ret[1].(error) return ret0, ret1 } // FetchRemoteDBModels indicates an expected call of FetchRemoteDBModels. -func (mr *MockTargetInfoGetterMockRecorder) FetchRemoteDBModels(arg0 any) *gomock.Call { +func (mr *MockTargetInfoGetterMockRecorder) FetchRemoteDBModels(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchRemoteDBModels", reflect.TypeOf((*MockTargetInfoGetter)(nil).FetchRemoteDBModels), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchRemoteDBModels", reflect.TypeOf((*MockTargetInfoGetter)(nil).FetchRemoteDBModels), ctx) } // FetchRemoteTableModels mocks base method. -func (m *MockTargetInfoGetter) FetchRemoteTableModels(arg0 context.Context, arg1 string) ([]*model.TableInfo, error) { +func (m *MockTargetInfoGetter) FetchRemoteTableModels(ctx context.Context, schemaName string) ([]*model.TableInfo, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FetchRemoteTableModels", arg0, arg1) + ret := m.ctrl.Call(m, "FetchRemoteTableModels", ctx, schemaName) ret0, _ := ret[0].([]*model.TableInfo) ret1, _ := ret[1].(error) return ret0, ret1 } // FetchRemoteTableModels indicates an expected call of FetchRemoteTableModels. -func (mr *MockTargetInfoGetterMockRecorder) FetchRemoteTableModels(arg0, arg1 any) *gomock.Call { +func (mr *MockTargetInfoGetterMockRecorder) FetchRemoteTableModels(ctx, schemaName any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchRemoteTableModels", reflect.TypeOf((*MockTargetInfoGetter)(nil).FetchRemoteTableModels), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchRemoteTableModels", reflect.TypeOf((*MockTargetInfoGetter)(nil).FetchRemoteTableModels), ctx, schemaName) } // MockChunkFlushStatus is a mock of ChunkFlushStatus interface. type MockChunkFlushStatus struct { ctrl *gomock.Controller recorder *MockChunkFlushStatusMockRecorder + isgomock struct{} } // MockChunkFlushStatusMockRecorder is the mock recorder for MockChunkFlushStatus. diff --git a/br/pkg/mock/encode.go b/br/pkg/mock/encode.go index 200730bfd0d15..eb7cfcbed3592 100644 --- a/br/pkg/mock/encode.go +++ b/br/pkg/mock/encode.go @@ -5,6 +5,7 @@ // // mockgen -package mock github.com/pingcap/tidb/pkg/lightning/backend/encode Encoder,EncodingBuilder,Rows,Row // + // Package mock is a generated GoMock package. package mock @@ -22,6 +23,7 @@ import ( type MockEncoder struct { ctrl *gomock.Controller recorder *MockEncoderMockRecorder + isgomock struct{} } // MockEncoderMockRecorder is the mock recorder for MockEncoder. @@ -54,24 +56,25 @@ func (mr *MockEncoderMockRecorder) Close() *gomock.Call { } // Encode mocks base method. -func (m *MockEncoder) Encode(arg0 []types.Datum, arg1 int64, arg2 []int, arg3 int64) (encode.Row, error) { +func (m *MockEncoder) Encode(row []types.Datum, rowID int64, columnPermutation []int, offset int64) (encode.Row, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Encode", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "Encode", row, rowID, columnPermutation, offset) ret0, _ := ret[0].(encode.Row) ret1, _ := ret[1].(error) return ret0, ret1 } // Encode indicates an expected call of Encode. -func (mr *MockEncoderMockRecorder) Encode(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *MockEncoderMockRecorder) Encode(row, rowID, columnPermutation, offset any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Encode", reflect.TypeOf((*MockEncoder)(nil).Encode), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Encode", reflect.TypeOf((*MockEncoder)(nil).Encode), row, rowID, columnPermutation, offset) } // MockEncodingBuilder is a mock of EncodingBuilder interface. type MockEncodingBuilder struct { ctrl *gomock.Controller recorder *MockEncodingBuilderMockRecorder + isgomock struct{} } // MockEncodingBuilderMockRecorder is the mock recorder for MockEncodingBuilder. @@ -106,24 +109,25 @@ func (mr *MockEncodingBuilderMockRecorder) MakeEmptyRows() *gomock.Call { } // NewEncoder mocks base method. -func (m *MockEncodingBuilder) NewEncoder(arg0 context.Context, arg1 *encode.EncodingConfig) (encode.Encoder, error) { +func (m *MockEncodingBuilder) NewEncoder(ctx context.Context, config *encode.EncodingConfig) (encode.Encoder, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "NewEncoder", arg0, arg1) + ret := m.ctrl.Call(m, "NewEncoder", ctx, config) ret0, _ := ret[0].(encode.Encoder) ret1, _ := ret[1].(error) return ret0, ret1 } // NewEncoder indicates an expected call of NewEncoder. -func (mr *MockEncodingBuilderMockRecorder) NewEncoder(arg0, arg1 any) *gomock.Call { +func (mr *MockEncodingBuilderMockRecorder) NewEncoder(ctx, config any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewEncoder", reflect.TypeOf((*MockEncodingBuilder)(nil).NewEncoder), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewEncoder", reflect.TypeOf((*MockEncodingBuilder)(nil).NewEncoder), ctx, config) } // MockRows is a mock of Rows interface. type MockRows struct { ctrl *gomock.Controller recorder *MockRowsMockRecorder + isgomock struct{} } // MockRowsMockRecorder is the mock recorder for MockRows. @@ -161,6 +165,7 @@ func (mr *MockRowsMockRecorder) Clear() *gomock.Call { type MockRow struct { ctrl *gomock.Controller recorder *MockRowMockRecorder + isgomock struct{} } // MockRowMockRecorder is the mock recorder for MockRow. @@ -181,15 +186,15 @@ func (m *MockRow) EXPECT() *MockRowMockRecorder { } // ClassifyAndAppend mocks base method. -func (m *MockRow) ClassifyAndAppend(arg0 *encode.Rows, arg1 *verification.KVChecksum, arg2 *encode.Rows, arg3 *verification.KVChecksum) { +func (m *MockRow) ClassifyAndAppend(data *encode.Rows, dataChecksum *verification.KVChecksum, indices *encode.Rows, indexChecksum *verification.KVChecksum) { m.ctrl.T.Helper() - m.ctrl.Call(m, "ClassifyAndAppend", arg0, arg1, arg2, arg3) + m.ctrl.Call(m, "ClassifyAndAppend", data, dataChecksum, indices, indexChecksum) } // ClassifyAndAppend indicates an expected call of ClassifyAndAppend. -func (mr *MockRowMockRecorder) ClassifyAndAppend(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *MockRowMockRecorder) ClassifyAndAppend(data, dataChecksum, indices, indexChecksum any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ClassifyAndAppend", reflect.TypeOf((*MockRow)(nil).ClassifyAndAppend), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ClassifyAndAppend", reflect.TypeOf((*MockRow)(nil).ClassifyAndAppend), data, dataChecksum, indices, indexChecksum) } // Size mocks base method. diff --git a/br/pkg/mock/mocklocal/local.go b/br/pkg/mock/mocklocal/local.go index b6c70a530b912..e7e9ea9fdd990 100644 --- a/br/pkg/mock/mocklocal/local.go +++ b/br/pkg/mock/mocklocal/local.go @@ -5,6 +5,7 @@ // // mockgen -package mocklocal github.com/pingcap/tidb/pkg/lightning/backend/local DiskUsage,TiKVModeSwitcher,StoreHelper // + // Package mocklocal is a generated GoMock package. package mocklocal @@ -14,7 +15,7 @@ import ( import_sstpb "github.com/pingcap/kvproto/pkg/import_sstpb" backend "github.com/pingcap/tidb/pkg/lightning/backend" - "github.com/tikv/client-go/v2/tikv" + apicodec "github.com/tikv/client-go/v2/internal/apicodec" gomock "go.uber.org/mock/gomock" ) @@ -22,6 +23,7 @@ import ( type MockDiskUsage struct { ctrl *gomock.Controller recorder *MockDiskUsageMockRecorder + isgomock struct{} } // MockDiskUsageMockRecorder is the mock recorder for MockDiskUsage. @@ -59,6 +61,7 @@ func (mr *MockDiskUsageMockRecorder) EngineFileSizes() *gomock.Call { type MockTiKVModeSwitcher struct { ctrl *gomock.Controller recorder *MockTiKVModeSwitcherMockRecorder + isgomock struct{} } // MockTiKVModeSwitcherMockRecorder is the mock recorder for MockTiKVModeSwitcher. @@ -79,36 +82,36 @@ func (m *MockTiKVModeSwitcher) EXPECT() *MockTiKVModeSwitcherMockRecorder { } // ToImportMode mocks base method. -func (m *MockTiKVModeSwitcher) ToImportMode(arg0 context.Context, arg1 ...*import_sstpb.Range) { +func (m *MockTiKVModeSwitcher) ToImportMode(ctx context.Context, ranges ...*import_sstpb.Range) { m.ctrl.T.Helper() - varargs := []any{arg0} - for _, a := range arg1 { + varargs := []any{ctx} + for _, a := range ranges { varargs = append(varargs, a) } m.ctrl.Call(m, "ToImportMode", varargs...) } // ToImportMode indicates an expected call of ToImportMode. -func (mr *MockTiKVModeSwitcherMockRecorder) ToImportMode(arg0 any, arg1 ...any) *gomock.Call { +func (mr *MockTiKVModeSwitcherMockRecorder) ToImportMode(ctx any, ranges ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]any{arg0}, arg1...) + varargs := append([]any{ctx}, ranges...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ToImportMode", reflect.TypeOf((*MockTiKVModeSwitcher)(nil).ToImportMode), varargs...) } // ToNormalMode mocks base method. -func (m *MockTiKVModeSwitcher) ToNormalMode(arg0 context.Context, arg1 ...*import_sstpb.Range) { +func (m *MockTiKVModeSwitcher) ToNormalMode(ctx context.Context, ranges ...*import_sstpb.Range) { m.ctrl.T.Helper() - varargs := []any{arg0} - for _, a := range arg1 { + varargs := []any{ctx} + for _, a := range ranges { varargs = append(varargs, a) } m.ctrl.Call(m, "ToNormalMode", varargs...) } // ToNormalMode indicates an expected call of ToNormalMode. -func (mr *MockTiKVModeSwitcherMockRecorder) ToNormalMode(arg0 any, arg1 ...any) *gomock.Call { +func (mr *MockTiKVModeSwitcherMockRecorder) ToNormalMode(ctx any, ranges ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]any{arg0}, arg1...) + varargs := append([]any{ctx}, ranges...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ToNormalMode", reflect.TypeOf((*MockTiKVModeSwitcher)(nil).ToNormalMode), varargs...) } @@ -116,6 +119,7 @@ func (mr *MockTiKVModeSwitcherMockRecorder) ToNormalMode(arg0 any, arg1 ...any) type MockStoreHelper struct { ctrl *gomock.Controller recorder *MockStoreHelperMockRecorder + isgomock struct{} } // MockStoreHelperMockRecorder is the mock recorder for MockStoreHelper. @@ -136,9 +140,9 @@ func (m *MockStoreHelper) EXPECT() *MockStoreHelperMockRecorder { } // GetTS mocks base method. -func (m *MockStoreHelper) GetTS(arg0 context.Context) (int64, int64, error) { +func (m *MockStoreHelper) GetTS(ctx context.Context) (int64, int64, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTS", arg0) + ret := m.ctrl.Call(m, "GetTS", ctx) ret0, _ := ret[0].(int64) ret1, _ := ret[1].(int64) ret2, _ := ret[2].(error) @@ -146,16 +150,16 @@ func (m *MockStoreHelper) GetTS(arg0 context.Context) (int64, int64, error) { } // GetTS indicates an expected call of GetTS. -func (mr *MockStoreHelperMockRecorder) GetTS(arg0 any) *gomock.Call { +func (mr *MockStoreHelperMockRecorder) GetTS(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTS", reflect.TypeOf((*MockStoreHelper)(nil).GetTS), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTS", reflect.TypeOf((*MockStoreHelper)(nil).GetTS), ctx) } // GetTiKVCodec mocks base method. -func (m *MockStoreHelper) GetTiKVCodec() tikv.Codec { +func (m *MockStoreHelper) GetTiKVCodec() apicodec.Codec { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetTiKVCodec") - ret0, _ := ret[0].(tikv.Codec) + ret0, _ := ret[0].(apicodec.Codec) return ret0 } diff --git a/br/pkg/mock/task_register.go b/br/pkg/mock/task_register.go index 3585b54962b5e..49b83a9adb089 100644 --- a/br/pkg/mock/task_register.go +++ b/br/pkg/mock/task_register.go @@ -5,6 +5,7 @@ // // mockgen -package mock github.com/pingcap/tidb/br/pkg/utils TaskRegister // + // Package mock is a generated GoMock package. package mock @@ -19,6 +20,7 @@ import ( type MockTaskRegister struct { ctrl *gomock.Controller recorder *MockTaskRegisterMockRecorder + isgomock struct{} } // MockTaskRegisterMockRecorder is the mock recorder for MockTaskRegister. @@ -39,43 +41,43 @@ func (m *MockTaskRegister) EXPECT() *MockTaskRegisterMockRecorder { } // Close mocks base method. -func (m *MockTaskRegister) Close(arg0 context.Context) error { +func (m *MockTaskRegister) Close(ctx context.Context) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Close", arg0) + ret := m.ctrl.Call(m, "Close", ctx) ret0, _ := ret[0].(error) return ret0 } // Close indicates an expected call of Close. -func (mr *MockTaskRegisterMockRecorder) Close(arg0 any) *gomock.Call { +func (mr *MockTaskRegisterMockRecorder) Close(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockTaskRegister)(nil).Close), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockTaskRegister)(nil).Close), ctx) } // RegisterTask mocks base method. -func (m *MockTaskRegister) RegisterTask(arg0 context.Context) error { +func (m *MockTaskRegister) RegisterTask(c context.Context) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RegisterTask", arg0) + ret := m.ctrl.Call(m, "RegisterTask", c) ret0, _ := ret[0].(error) return ret0 } // RegisterTask indicates an expected call of RegisterTask. -func (mr *MockTaskRegisterMockRecorder) RegisterTask(arg0 any) *gomock.Call { +func (mr *MockTaskRegisterMockRecorder) RegisterTask(c any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterTask", reflect.TypeOf((*MockTaskRegister)(nil).RegisterTask), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterTask", reflect.TypeOf((*MockTaskRegister)(nil).RegisterTask), c) } // RegisterTaskOnce mocks base method. -func (m *MockTaskRegister) RegisterTaskOnce(arg0 context.Context) error { +func (m *MockTaskRegister) RegisterTaskOnce(ctx context.Context) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RegisterTaskOnce", arg0) + ret := m.ctrl.Call(m, "RegisterTaskOnce", ctx) ret0, _ := ret[0].(error) return ret0 } // RegisterTaskOnce indicates an expected call of RegisterTaskOnce. -func (mr *MockTaskRegisterMockRecorder) RegisterTaskOnce(arg0 any) *gomock.Call { +func (mr *MockTaskRegisterMockRecorder) RegisterTaskOnce(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterTaskOnce", reflect.TypeOf((*MockTaskRegister)(nil).RegisterTaskOnce), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterTaskOnce", reflect.TypeOf((*MockTaskRegister)(nil).RegisterTaskOnce), ctx) } From c4ff608fdc2fd79e3e6b1450bd192f6b400a0478 Mon Sep 17 00:00:00 2001 From: lance6716 Date: Mon, 21 Oct 2024 13:24:33 +0800 Subject: [PATCH 4/5] update mock Signed-off-by: lance6716 --- br/pkg/mock/s3iface.go | 2 + br/pkg/mock/storage/storage.go | 78 +++-- pkg/ddl/mock/schema_loader_mock.go | 6 +- pkg/ddl/mock/systable_manager_mock.go | 38 +-- .../framework/mock/execute/execute_mock.go | 22 +- pkg/disttask/framework/mock/plan_mock.go | 12 +- pkg/disttask/framework/mock/scheduler_mock.go | 300 +++++++++--------- .../framework/mock/task_executor_mock.go | 200 ++++++------ .../scheduler/mock/scheduler_mock.go | 54 ++-- pkg/disttask/importinto/mock/import_mock.go | 16 +- .../mock/restricted_sql_executor_mock.go | 38 +-- 11 files changed, 352 insertions(+), 414 deletions(-) diff --git a/br/pkg/mock/s3iface.go b/br/pkg/mock/s3iface.go index ac77d7fcdb771..cbff9d6806f3a 100644 --- a/br/pkg/mock/s3iface.go +++ b/br/pkg/mock/s3iface.go @@ -5,6 +5,7 @@ // // mockgen -package mock github.com/aws/aws-sdk-go/service/s3/s3iface S3API // + // Package mock is a generated GoMock package. package mock @@ -21,6 +22,7 @@ import ( type MockS3API struct { ctrl *gomock.Controller recorder *MockS3APIMockRecorder + isgomock struct{} } // MockS3APIMockRecorder is the mock recorder for MockS3API. diff --git a/br/pkg/mock/storage/storage.go b/br/pkg/mock/storage/storage.go index 5e547f4c18436..130142dab1360 100644 --- a/br/pkg/mock/storage/storage.go +++ b/br/pkg/mock/storage/storage.go @@ -21,6 +21,7 @@ import ( type MockExternalStorage struct { ctrl *gomock.Controller recorder *MockExternalStorageMockRecorder + isgomock struct{} } // MockExternalStorageMockRecorder is the mock recorder for MockExternalStorage. @@ -40,11 +41,6 @@ func (m *MockExternalStorage) EXPECT() *MockExternalStorageMockRecorder { return m.recorder } -// ISGOMOCK indicates that this struct is a gomock mock. -func (m *MockExternalStorage) ISGOMOCK() struct{} { - return struct{}{} -} - // Close mocks base method. func (m *MockExternalStorage) Close() { m.ctrl.T.Helper() @@ -58,105 +54,105 @@ func (mr *MockExternalStorageMockRecorder) Close() *gomock.Call { } // Create mocks base method. -func (m *MockExternalStorage) Create(arg0 context.Context, arg1 string, arg2 *storage.WriterOption) (storage.ExternalFileWriter, error) { +func (m *MockExternalStorage) Create(ctx context.Context, path string, option *storage.WriterOption) (storage.ExternalFileWriter, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Create", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "Create", ctx, path, option) ret0, _ := ret[0].(storage.ExternalFileWriter) ret1, _ := ret[1].(error) return ret0, ret1 } // Create indicates an expected call of Create. -func (mr *MockExternalStorageMockRecorder) Create(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockExternalStorageMockRecorder) Create(ctx, path, option any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockExternalStorage)(nil).Create), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockExternalStorage)(nil).Create), ctx, path, option) } // DeleteFile mocks base method. -func (m *MockExternalStorage) DeleteFile(arg0 context.Context, arg1 string) error { +func (m *MockExternalStorage) DeleteFile(ctx context.Context, name string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteFile", arg0, arg1) + ret := m.ctrl.Call(m, "DeleteFile", ctx, name) ret0, _ := ret[0].(error) return ret0 } // DeleteFile indicates an expected call of DeleteFile. -func (mr *MockExternalStorageMockRecorder) DeleteFile(arg0, arg1 any) *gomock.Call { +func (mr *MockExternalStorageMockRecorder) DeleteFile(ctx, name any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteFile", reflect.TypeOf((*MockExternalStorage)(nil).DeleteFile), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteFile", reflect.TypeOf((*MockExternalStorage)(nil).DeleteFile), ctx, name) } // DeleteFiles mocks base method. -func (m *MockExternalStorage) DeleteFiles(arg0 context.Context, arg1 []string) error { +func (m *MockExternalStorage) DeleteFiles(ctx context.Context, names []string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteFiles", arg0, arg1) + ret := m.ctrl.Call(m, "DeleteFiles", ctx, names) ret0, _ := ret[0].(error) return ret0 } // DeleteFiles indicates an expected call of DeleteFiles. -func (mr *MockExternalStorageMockRecorder) DeleteFiles(arg0, arg1 any) *gomock.Call { +func (mr *MockExternalStorageMockRecorder) DeleteFiles(ctx, names any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteFiles", reflect.TypeOf((*MockExternalStorage)(nil).DeleteFiles), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteFiles", reflect.TypeOf((*MockExternalStorage)(nil).DeleteFiles), ctx, names) } // FileExists mocks base method. -func (m *MockExternalStorage) FileExists(arg0 context.Context, arg1 string) (bool, error) { +func (m *MockExternalStorage) FileExists(ctx context.Context, name string) (bool, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FileExists", arg0, arg1) + ret := m.ctrl.Call(m, "FileExists", ctx, name) ret0, _ := ret[0].(bool) ret1, _ := ret[1].(error) return ret0, ret1 } // FileExists indicates an expected call of FileExists. -func (mr *MockExternalStorageMockRecorder) FileExists(arg0, arg1 any) *gomock.Call { +func (mr *MockExternalStorageMockRecorder) FileExists(ctx, name any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FileExists", reflect.TypeOf((*MockExternalStorage)(nil).FileExists), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FileExists", reflect.TypeOf((*MockExternalStorage)(nil).FileExists), ctx, name) } // Open mocks base method. -func (m *MockExternalStorage) Open(arg0 context.Context, arg1 string, arg2 *storage.ReaderOption) (storage.ExternalFileReader, error) { +func (m *MockExternalStorage) Open(ctx context.Context, path string, option *storage.ReaderOption) (storage.ExternalFileReader, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Open", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "Open", ctx, path, option) ret0, _ := ret[0].(storage.ExternalFileReader) ret1, _ := ret[1].(error) return ret0, ret1 } // Open indicates an expected call of Open. -func (mr *MockExternalStorageMockRecorder) Open(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockExternalStorageMockRecorder) Open(ctx, path, option any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Open", reflect.TypeOf((*MockExternalStorage)(nil).Open), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Open", reflect.TypeOf((*MockExternalStorage)(nil).Open), ctx, path, option) } // ReadFile mocks base method. -func (m *MockExternalStorage) ReadFile(arg0 context.Context, arg1 string) ([]byte, error) { +func (m *MockExternalStorage) ReadFile(ctx context.Context, name string) ([]byte, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ReadFile", arg0, arg1) + ret := m.ctrl.Call(m, "ReadFile", ctx, name) ret0, _ := ret[0].([]byte) ret1, _ := ret[1].(error) return ret0, ret1 } // ReadFile indicates an expected call of ReadFile. -func (mr *MockExternalStorageMockRecorder) ReadFile(arg0, arg1 any) *gomock.Call { +func (mr *MockExternalStorageMockRecorder) ReadFile(ctx, name any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadFile", reflect.TypeOf((*MockExternalStorage)(nil).ReadFile), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadFile", reflect.TypeOf((*MockExternalStorage)(nil).ReadFile), ctx, name) } // Rename mocks base method. -func (m *MockExternalStorage) Rename(arg0 context.Context, arg1, arg2 string) error { +func (m *MockExternalStorage) Rename(ctx context.Context, oldFileName, newFileName string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Rename", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "Rename", ctx, oldFileName, newFileName) ret0, _ := ret[0].(error) return ret0 } // Rename indicates an expected call of Rename. -func (mr *MockExternalStorageMockRecorder) Rename(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockExternalStorageMockRecorder) Rename(ctx, oldFileName, newFileName any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Rename", reflect.TypeOf((*MockExternalStorage)(nil).Rename), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Rename", reflect.TypeOf((*MockExternalStorage)(nil).Rename), ctx, oldFileName, newFileName) } // URI mocks base method. @@ -174,29 +170,29 @@ func (mr *MockExternalStorageMockRecorder) URI() *gomock.Call { } // WalkDir mocks base method. -func (m *MockExternalStorage) WalkDir(arg0 context.Context, arg1 *storage.WalkOption, arg2 func(string, int64) error) error { +func (m *MockExternalStorage) WalkDir(ctx context.Context, opt *storage.WalkOption, fn func(string, int64) error) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "WalkDir", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "WalkDir", ctx, opt, fn) ret0, _ := ret[0].(error) return ret0 } // WalkDir indicates an expected call of WalkDir. -func (mr *MockExternalStorageMockRecorder) WalkDir(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockExternalStorageMockRecorder) WalkDir(ctx, opt, fn any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WalkDir", reflect.TypeOf((*MockExternalStorage)(nil).WalkDir), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WalkDir", reflect.TypeOf((*MockExternalStorage)(nil).WalkDir), ctx, opt, fn) } // WriteFile mocks base method. -func (m *MockExternalStorage) WriteFile(arg0 context.Context, arg1 string, arg2 []byte) error { +func (m *MockExternalStorage) WriteFile(ctx context.Context, name string, data []byte) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "WriteFile", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "WriteFile", ctx, name, data) ret0, _ := ret[0].(error) return ret0 } // WriteFile indicates an expected call of WriteFile. -func (mr *MockExternalStorageMockRecorder) WriteFile(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockExternalStorageMockRecorder) WriteFile(ctx, name, data any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteFile", reflect.TypeOf((*MockExternalStorage)(nil).WriteFile), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteFile", reflect.TypeOf((*MockExternalStorage)(nil).WriteFile), ctx, name, data) } diff --git a/pkg/ddl/mock/schema_loader_mock.go b/pkg/ddl/mock/schema_loader_mock.go index faa595e7e337f..ac78ad77e61a4 100644 --- a/pkg/ddl/mock/schema_loader_mock.go +++ b/pkg/ddl/mock/schema_loader_mock.go @@ -19,6 +19,7 @@ import ( type MockSchemaLoader struct { ctrl *gomock.Controller recorder *MockSchemaLoaderMockRecorder + isgomock struct{} } // MockSchemaLoaderMockRecorder is the mock recorder for MockSchemaLoader. @@ -38,11 +39,6 @@ func (m *MockSchemaLoader) EXPECT() *MockSchemaLoaderMockRecorder { return m.recorder } -// ISGOMOCK indicates that this struct is a gomock mock. -func (m *MockSchemaLoader) ISGOMOCK() struct{} { - return struct{}{} -} - // Reload mocks base method. func (m *MockSchemaLoader) Reload() error { m.ctrl.T.Helper() diff --git a/pkg/ddl/mock/systable_manager_mock.go b/pkg/ddl/mock/systable_manager_mock.go index 175e4cf1e1e4c..0566a33e6deac 100644 --- a/pkg/ddl/mock/systable_manager_mock.go +++ b/pkg/ddl/mock/systable_manager_mock.go @@ -21,6 +21,7 @@ import ( type MockManager struct { ctrl *gomock.Controller recorder *MockManagerMockRecorder + isgomock struct{} } // MockManagerMockRecorder is the mock recorder for MockManager. @@ -40,67 +41,62 @@ func (m *MockManager) EXPECT() *MockManagerMockRecorder { return m.recorder } -// ISGOMOCK indicates that this struct is a gomock mock. -func (m *MockManager) ISGOMOCK() struct{} { - return struct{}{} -} - // GetJobByID mocks base method. -func (m *MockManager) GetJobByID(arg0 context.Context, arg1 int64) (*model.Job, error) { +func (m *MockManager) GetJobByID(ctx context.Context, jobID int64) (*model.Job, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetJobByID", arg0, arg1) + ret := m.ctrl.Call(m, "GetJobByID", ctx, jobID) ret0, _ := ret[0].(*model.Job) ret1, _ := ret[1].(error) return ret0, ret1 } // GetJobByID indicates an expected call of GetJobByID. -func (mr *MockManagerMockRecorder) GetJobByID(arg0, arg1 any) *gomock.Call { +func (mr *MockManagerMockRecorder) GetJobByID(ctx, jobID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetJobByID", reflect.TypeOf((*MockManager)(nil).GetJobByID), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetJobByID", reflect.TypeOf((*MockManager)(nil).GetJobByID), ctx, jobID) } // GetMDLVer mocks base method. -func (m *MockManager) GetMDLVer(arg0 context.Context, arg1 int64) (int64, error) { +func (m *MockManager) GetMDLVer(ctx context.Context, jobID int64) (int64, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetMDLVer", arg0, arg1) + ret := m.ctrl.Call(m, "GetMDLVer", ctx, jobID) ret0, _ := ret[0].(int64) ret1, _ := ret[1].(error) return ret0, ret1 } // GetMDLVer indicates an expected call of GetMDLVer. -func (mr *MockManagerMockRecorder) GetMDLVer(arg0, arg1 any) *gomock.Call { +func (mr *MockManagerMockRecorder) GetMDLVer(ctx, jobID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMDLVer", reflect.TypeOf((*MockManager)(nil).GetMDLVer), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMDLVer", reflect.TypeOf((*MockManager)(nil).GetMDLVer), ctx, jobID) } // GetMinJobID mocks base method. -func (m *MockManager) GetMinJobID(arg0 context.Context, arg1 int64) (int64, error) { +func (m *MockManager) GetMinJobID(ctx context.Context, prevMinJobID int64) (int64, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetMinJobID", arg0, arg1) + ret := m.ctrl.Call(m, "GetMinJobID", ctx, prevMinJobID) ret0, _ := ret[0].(int64) ret1, _ := ret[1].(error) return ret0, ret1 } // GetMinJobID indicates an expected call of GetMinJobID. -func (mr *MockManagerMockRecorder) GetMinJobID(arg0, arg1 any) *gomock.Call { +func (mr *MockManagerMockRecorder) GetMinJobID(ctx, prevMinJobID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMinJobID", reflect.TypeOf((*MockManager)(nil).GetMinJobID), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMinJobID", reflect.TypeOf((*MockManager)(nil).GetMinJobID), ctx, prevMinJobID) } // HasFlashbackClusterJob mocks base method. -func (m *MockManager) HasFlashbackClusterJob(arg0 context.Context, arg1 int64) (bool, error) { +func (m *MockManager) HasFlashbackClusterJob(ctx context.Context, minJobID int64) (bool, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "HasFlashbackClusterJob", arg0, arg1) + ret := m.ctrl.Call(m, "HasFlashbackClusterJob", ctx, minJobID) ret0, _ := ret[0].(bool) ret1, _ := ret[1].(error) return ret0, ret1 } // HasFlashbackClusterJob indicates an expected call of HasFlashbackClusterJob. -func (mr *MockManagerMockRecorder) HasFlashbackClusterJob(arg0, arg1 any) *gomock.Call { +func (mr *MockManagerMockRecorder) HasFlashbackClusterJob(ctx, minJobID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasFlashbackClusterJob", reflect.TypeOf((*MockManager)(nil).HasFlashbackClusterJob), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasFlashbackClusterJob", reflect.TypeOf((*MockManager)(nil).HasFlashbackClusterJob), ctx, minJobID) } diff --git a/pkg/disttask/framework/mock/execute/execute_mock.go b/pkg/disttask/framework/mock/execute/execute_mock.go index edd5af519dad1..b4373a2b42369 100644 --- a/pkg/disttask/framework/mock/execute/execute_mock.go +++ b/pkg/disttask/framework/mock/execute/execute_mock.go @@ -23,6 +23,7 @@ type MockStepExecutor struct { execute.StepExecutor ctrl *gomock.Controller recorder *MockStepExecutorMockRecorder + isgomock struct{} } // MockStepExecutorMockRecorder is the mock recorder for MockStepExecutor. @@ -42,11 +43,6 @@ func (m *MockStepExecutor) EXPECT() *MockStepExecutorMockRecorder { return m.recorder } -// ISGOMOCK indicates that this struct is a gomock mock. -func (m *MockStepExecutor) ISGOMOCK() struct{} { - return struct{}{} -} - // Cleanup mocks base method. func (m *MockStepExecutor) Cleanup(arg0 context.Context) error { m.ctrl.T.Helper() @@ -90,17 +86,17 @@ func (mr *MockStepExecutorMockRecorder) Init(arg0 any) *gomock.Call { } // OnFinished mocks base method. -func (m *MockStepExecutor) OnFinished(arg0 context.Context, arg1 *proto.Subtask) error { +func (m *MockStepExecutor) OnFinished(ctx context.Context, subtask *proto.Subtask) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "OnFinished", arg0, arg1) + ret := m.ctrl.Call(m, "OnFinished", ctx, subtask) ret0, _ := ret[0].(error) return ret0 } // OnFinished indicates an expected call of OnFinished. -func (mr *MockStepExecutorMockRecorder) OnFinished(arg0, arg1 any) *gomock.Call { +func (mr *MockStepExecutorMockRecorder) OnFinished(ctx, subtask any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnFinished", reflect.TypeOf((*MockStepExecutor)(nil).OnFinished), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnFinished", reflect.TypeOf((*MockStepExecutor)(nil).OnFinished), ctx, subtask) } // RealtimeSummary mocks base method. @@ -118,17 +114,17 @@ func (mr *MockStepExecutorMockRecorder) RealtimeSummary() *gomock.Call { } // RunSubtask mocks base method. -func (m *MockStepExecutor) RunSubtask(arg0 context.Context, arg1 *proto.Subtask) error { +func (m *MockStepExecutor) RunSubtask(ctx context.Context, subtask *proto.Subtask) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RunSubtask", arg0, arg1) + ret := m.ctrl.Call(m, "RunSubtask", ctx, subtask) ret0, _ := ret[0].(error) return ret0 } // RunSubtask indicates an expected call of RunSubtask. -func (mr *MockStepExecutorMockRecorder) RunSubtask(arg0, arg1 any) *gomock.Call { +func (mr *MockStepExecutorMockRecorder) RunSubtask(ctx, subtask any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunSubtask", reflect.TypeOf((*MockStepExecutor)(nil).RunSubtask), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunSubtask", reflect.TypeOf((*MockStepExecutor)(nil).RunSubtask), ctx, subtask) } // restricted mocks base method. diff --git a/pkg/disttask/framework/mock/plan_mock.go b/pkg/disttask/framework/mock/plan_mock.go index b0db8b51dc48d..51f429d0c66bb 100644 --- a/pkg/disttask/framework/mock/plan_mock.go +++ b/pkg/disttask/framework/mock/plan_mock.go @@ -20,6 +20,7 @@ import ( type MockLogicalPlan struct { ctrl *gomock.Controller recorder *MockLogicalPlanMockRecorder + isgomock struct{} } // MockLogicalPlanMockRecorder is the mock recorder for MockLogicalPlan. @@ -39,11 +40,6 @@ func (m *MockLogicalPlan) EXPECT() *MockLogicalPlanMockRecorder { return m.recorder } -// ISGOMOCK indicates that this struct is a gomock mock. -func (m *MockLogicalPlan) ISGOMOCK() struct{} { - return struct{}{} -} - // FromTaskMeta mocks base method. func (m *MockLogicalPlan) FromTaskMeta(arg0 []byte) error { m.ctrl.T.Helper() @@ -92,6 +88,7 @@ func (mr *MockLogicalPlanMockRecorder) ToTaskMeta() *gomock.Call { type MockPipelineSpec struct { ctrl *gomock.Controller recorder *MockPipelineSpecMockRecorder + isgomock struct{} } // MockPipelineSpecMockRecorder is the mock recorder for MockPipelineSpec. @@ -111,11 +108,6 @@ func (m *MockPipelineSpec) EXPECT() *MockPipelineSpecMockRecorder { return m.recorder } -// ISGOMOCK indicates that this struct is a gomock mock. -func (m *MockPipelineSpec) ISGOMOCK() struct{} { - return struct{}{} -} - // ToSubtaskMeta mocks base method. func (m *MockPipelineSpec) ToSubtaskMeta(arg0 planner.PlanCtx) ([]byte, error) { m.ctrl.T.Helper() diff --git a/pkg/disttask/framework/mock/scheduler_mock.go b/pkg/disttask/framework/mock/scheduler_mock.go index 313a87ff121b7..5b9a2706c495b 100644 --- a/pkg/disttask/framework/mock/scheduler_mock.go +++ b/pkg/disttask/framework/mock/scheduler_mock.go @@ -23,6 +23,7 @@ import ( type MockScheduler struct { ctrl *gomock.Controller recorder *MockSchedulerMockRecorder + isgomock struct{} } // MockSchedulerMockRecorder is the mock recorder for MockScheduler. @@ -42,11 +43,6 @@ func (m *MockScheduler) EXPECT() *MockSchedulerMockRecorder { return m.recorder } -// ISGOMOCK indicates that this struct is a gomock mock. -func (m *MockScheduler) ISGOMOCK() struct{} { - return struct{}{} -} - // Close mocks base method. func (m *MockScheduler) Close() { m.ctrl.T.Helper() @@ -60,32 +56,32 @@ func (mr *MockSchedulerMockRecorder) Close() *gomock.Call { } // GetEligibleInstances mocks base method. -func (m *MockScheduler) GetEligibleInstances(arg0 context.Context, arg1 *proto.Task) ([]string, error) { +func (m *MockScheduler) GetEligibleInstances(ctx context.Context, task *proto.Task) ([]string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetEligibleInstances", arg0, arg1) + ret := m.ctrl.Call(m, "GetEligibleInstances", ctx, task) ret0, _ := ret[0].([]string) ret1, _ := ret[1].(error) return ret0, ret1 } // GetEligibleInstances indicates an expected call of GetEligibleInstances. -func (mr *MockSchedulerMockRecorder) GetEligibleInstances(arg0, arg1 any) *gomock.Call { +func (mr *MockSchedulerMockRecorder) GetEligibleInstances(ctx, task any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetEligibleInstances", reflect.TypeOf((*MockScheduler)(nil).GetEligibleInstances), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetEligibleInstances", reflect.TypeOf((*MockScheduler)(nil).GetEligibleInstances), ctx, task) } // GetNextStep mocks base method. -func (m *MockScheduler) GetNextStep(arg0 *proto.TaskBase) proto.Step { +func (m *MockScheduler) GetNextStep(task *proto.TaskBase) proto.Step { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetNextStep", arg0) + ret := m.ctrl.Call(m, "GetNextStep", task) ret0, _ := ret[0].(proto.Step) return ret0 } // GetNextStep indicates an expected call of GetNextStep. -func (mr *MockSchedulerMockRecorder) GetNextStep(arg0 any) *gomock.Call { +func (mr *MockSchedulerMockRecorder) GetNextStep(task any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNextStep", reflect.TypeOf((*MockScheduler)(nil).GetNextStep), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNextStep", reflect.TypeOf((*MockScheduler)(nil).GetNextStep), task) } // GetTask mocks base method. @@ -117,58 +113,58 @@ func (mr *MockSchedulerMockRecorder) Init() *gomock.Call { } // IsRetryableErr mocks base method. -func (m *MockScheduler) IsRetryableErr(arg0 error) bool { +func (m *MockScheduler) IsRetryableErr(err error) bool { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsRetryableErr", arg0) + ret := m.ctrl.Call(m, "IsRetryableErr", err) ret0, _ := ret[0].(bool) return ret0 } // IsRetryableErr indicates an expected call of IsRetryableErr. -func (mr *MockSchedulerMockRecorder) IsRetryableErr(arg0 any) *gomock.Call { +func (mr *MockSchedulerMockRecorder) IsRetryableErr(err any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsRetryableErr", reflect.TypeOf((*MockScheduler)(nil).IsRetryableErr), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsRetryableErr", reflect.TypeOf((*MockScheduler)(nil).IsRetryableErr), err) } // OnDone mocks base method. -func (m *MockScheduler) OnDone(arg0 context.Context, arg1 storage.TaskHandle, arg2 *proto.Task) error { +func (m *MockScheduler) OnDone(ctx context.Context, h storage.TaskHandle, task *proto.Task) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "OnDone", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "OnDone", ctx, h, task) ret0, _ := ret[0].(error) return ret0 } // OnDone indicates an expected call of OnDone. -func (mr *MockSchedulerMockRecorder) OnDone(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockSchedulerMockRecorder) OnDone(ctx, h, task any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnDone", reflect.TypeOf((*MockScheduler)(nil).OnDone), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnDone", reflect.TypeOf((*MockScheduler)(nil).OnDone), ctx, h, task) } // OnNextSubtasksBatch mocks base method. -func (m *MockScheduler) OnNextSubtasksBatch(arg0 context.Context, arg1 storage.TaskHandle, arg2 *proto.Task, arg3 []string, arg4 proto.Step) ([][]byte, error) { +func (m *MockScheduler) OnNextSubtasksBatch(ctx context.Context, h storage.TaskHandle, task *proto.Task, execIDs []string, step proto.Step) ([][]byte, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "OnNextSubtasksBatch", arg0, arg1, arg2, arg3, arg4) + ret := m.ctrl.Call(m, "OnNextSubtasksBatch", ctx, h, task, execIDs, step) ret0, _ := ret[0].([][]byte) ret1, _ := ret[1].(error) return ret0, ret1 } // OnNextSubtasksBatch indicates an expected call of OnNextSubtasksBatch. -func (mr *MockSchedulerMockRecorder) OnNextSubtasksBatch(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *MockSchedulerMockRecorder) OnNextSubtasksBatch(ctx, h, task, execIDs, step any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnNextSubtasksBatch", reflect.TypeOf((*MockScheduler)(nil).OnNextSubtasksBatch), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnNextSubtasksBatch", reflect.TypeOf((*MockScheduler)(nil).OnNextSubtasksBatch), ctx, h, task, execIDs, step) } // OnTick mocks base method. -func (m *MockScheduler) OnTick(arg0 context.Context, arg1 *proto.Task) { +func (m *MockScheduler) OnTick(ctx context.Context, task *proto.Task) { m.ctrl.T.Helper() - m.ctrl.Call(m, "OnTick", arg0, arg1) + m.ctrl.Call(m, "OnTick", ctx, task) } // OnTick indicates an expected call of OnTick. -func (mr *MockSchedulerMockRecorder) OnTick(arg0, arg1 any) *gomock.Call { +func (mr *MockSchedulerMockRecorder) OnTick(ctx, task any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnTick", reflect.TypeOf((*MockScheduler)(nil).OnTick), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnTick", reflect.TypeOf((*MockScheduler)(nil).OnTick), ctx, task) } // ScheduleTask mocks base method. @@ -187,6 +183,7 @@ func (mr *MockSchedulerMockRecorder) ScheduleTask() *gomock.Call { type MockCleanUpRoutine struct { ctrl *gomock.Controller recorder *MockCleanUpRoutineMockRecorder + isgomock struct{} } // MockCleanUpRoutineMockRecorder is the mock recorder for MockCleanUpRoutine. @@ -206,29 +203,25 @@ func (m *MockCleanUpRoutine) EXPECT() *MockCleanUpRoutineMockRecorder { return m.recorder } -// ISGOMOCK indicates that this struct is a gomock mock. -func (m *MockCleanUpRoutine) ISGOMOCK() struct{} { - return struct{}{} -} - // CleanUp mocks base method. -func (m *MockCleanUpRoutine) CleanUp(arg0 context.Context, arg1 *proto.Task) error { +func (m *MockCleanUpRoutine) CleanUp(ctx context.Context, task *proto.Task) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CleanUp", arg0, arg1) + ret := m.ctrl.Call(m, "CleanUp", ctx, task) ret0, _ := ret[0].(error) return ret0 } // CleanUp indicates an expected call of CleanUp. -func (mr *MockCleanUpRoutineMockRecorder) CleanUp(arg0, arg1 any) *gomock.Call { +func (mr *MockCleanUpRoutineMockRecorder) CleanUp(ctx, task any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CleanUp", reflect.TypeOf((*MockCleanUpRoutine)(nil).CleanUp), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CleanUp", reflect.TypeOf((*MockCleanUpRoutine)(nil).CleanUp), ctx, task) } // MockTaskManager is a mock of TaskManager interface. type MockTaskManager struct { ctrl *gomock.Controller recorder *MockTaskManagerMockRecorder + isgomock struct{} } // MockTaskManagerMockRecorder is the mock recorder for MockTaskManager. @@ -248,192 +241,187 @@ func (m *MockTaskManager) EXPECT() *MockTaskManagerMockRecorder { return m.recorder } -// ISGOMOCK indicates that this struct is a gomock mock. -func (m *MockTaskManager) ISGOMOCK() struct{} { - return struct{}{} -} - // CancelTask mocks base method. -func (m *MockTaskManager) CancelTask(arg0 context.Context, arg1 int64) error { +func (m *MockTaskManager) CancelTask(ctx context.Context, taskID int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CancelTask", arg0, arg1) + ret := m.ctrl.Call(m, "CancelTask", ctx, taskID) ret0, _ := ret[0].(error) return ret0 } // CancelTask indicates an expected call of CancelTask. -func (mr *MockTaskManagerMockRecorder) CancelTask(arg0, arg1 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) CancelTask(ctx, taskID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelTask", reflect.TypeOf((*MockTaskManager)(nil).CancelTask), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelTask", reflect.TypeOf((*MockTaskManager)(nil).CancelTask), ctx, taskID) } // DeleteDeadNodes mocks base method. -func (m *MockTaskManager) DeleteDeadNodes(arg0 context.Context, arg1 []string) error { +func (m *MockTaskManager) DeleteDeadNodes(ctx context.Context, nodes []string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteDeadNodes", arg0, arg1) + ret := m.ctrl.Call(m, "DeleteDeadNodes", ctx, nodes) ret0, _ := ret[0].(error) return ret0 } // DeleteDeadNodes indicates an expected call of DeleteDeadNodes. -func (mr *MockTaskManagerMockRecorder) DeleteDeadNodes(arg0, arg1 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) DeleteDeadNodes(ctx, nodes any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteDeadNodes", reflect.TypeOf((*MockTaskManager)(nil).DeleteDeadNodes), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteDeadNodes", reflect.TypeOf((*MockTaskManager)(nil).DeleteDeadNodes), ctx, nodes) } // FailTask mocks base method. -func (m *MockTaskManager) FailTask(arg0 context.Context, arg1 int64, arg2 proto.TaskState, arg3 error) error { +func (m *MockTaskManager) FailTask(ctx context.Context, taskID int64, currentState proto.TaskState, taskErr error) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FailTask", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "FailTask", ctx, taskID, currentState, taskErr) ret0, _ := ret[0].(error) return ret0 } // FailTask indicates an expected call of FailTask. -func (mr *MockTaskManagerMockRecorder) FailTask(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) FailTask(ctx, taskID, currentState, taskErr any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FailTask", reflect.TypeOf((*MockTaskManager)(nil).FailTask), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FailTask", reflect.TypeOf((*MockTaskManager)(nil).FailTask), ctx, taskID, currentState, taskErr) } // GCSubtasks mocks base method. -func (m *MockTaskManager) GCSubtasks(arg0 context.Context) error { +func (m *MockTaskManager) GCSubtasks(ctx context.Context) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GCSubtasks", arg0) + ret := m.ctrl.Call(m, "GCSubtasks", ctx) ret0, _ := ret[0].(error) return ret0 } // GCSubtasks indicates an expected call of GCSubtasks. -func (mr *MockTaskManagerMockRecorder) GCSubtasks(arg0 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) GCSubtasks(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GCSubtasks", reflect.TypeOf((*MockTaskManager)(nil).GCSubtasks), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GCSubtasks", reflect.TypeOf((*MockTaskManager)(nil).GCSubtasks), ctx) } // GetActiveSubtasks mocks base method. -func (m *MockTaskManager) GetActiveSubtasks(arg0 context.Context, arg1 int64) ([]*proto.SubtaskBase, error) { +func (m *MockTaskManager) GetActiveSubtasks(ctx context.Context, taskID int64) ([]*proto.SubtaskBase, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetActiveSubtasks", arg0, arg1) + ret := m.ctrl.Call(m, "GetActiveSubtasks", ctx, taskID) ret0, _ := ret[0].([]*proto.SubtaskBase) ret1, _ := ret[1].(error) return ret0, ret1 } // GetActiveSubtasks indicates an expected call of GetActiveSubtasks. -func (mr *MockTaskManagerMockRecorder) GetActiveSubtasks(arg0, arg1 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) GetActiveSubtasks(ctx, taskID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetActiveSubtasks", reflect.TypeOf((*MockTaskManager)(nil).GetActiveSubtasks), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetActiveSubtasks", reflect.TypeOf((*MockTaskManager)(nil).GetActiveSubtasks), ctx, taskID) } // GetAllNodes mocks base method. -func (m *MockTaskManager) GetAllNodes(arg0 context.Context) ([]proto.ManagedNode, error) { +func (m *MockTaskManager) GetAllNodes(ctx context.Context) ([]proto.ManagedNode, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAllNodes", arg0) + ret := m.ctrl.Call(m, "GetAllNodes", ctx) ret0, _ := ret[0].([]proto.ManagedNode) ret1, _ := ret[1].(error) return ret0, ret1 } // GetAllNodes indicates an expected call of GetAllNodes. -func (mr *MockTaskManagerMockRecorder) GetAllNodes(arg0 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) GetAllNodes(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllNodes", reflect.TypeOf((*MockTaskManager)(nil).GetAllNodes), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllNodes", reflect.TypeOf((*MockTaskManager)(nil).GetAllNodes), ctx) } // GetAllSubtasks mocks base method. -func (m *MockTaskManager) GetAllSubtasks(arg0 context.Context) ([]*proto.SubtaskBase, error) { +func (m *MockTaskManager) GetAllSubtasks(ctx context.Context) ([]*proto.SubtaskBase, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAllSubtasks", arg0) + ret := m.ctrl.Call(m, "GetAllSubtasks", ctx) ret0, _ := ret[0].([]*proto.SubtaskBase) ret1, _ := ret[1].(error) return ret0, ret1 } // GetAllSubtasks indicates an expected call of GetAllSubtasks. -func (mr *MockTaskManagerMockRecorder) GetAllSubtasks(arg0 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) GetAllSubtasks(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllSubtasks", reflect.TypeOf((*MockTaskManager)(nil).GetAllSubtasks), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllSubtasks", reflect.TypeOf((*MockTaskManager)(nil).GetAllSubtasks), ctx) } // GetAllSubtasksByStepAndState mocks base method. -func (m *MockTaskManager) GetAllSubtasksByStepAndState(arg0 context.Context, arg1 int64, arg2 proto.Step, arg3 proto.SubtaskState) ([]*proto.Subtask, error) { +func (m *MockTaskManager) GetAllSubtasksByStepAndState(ctx context.Context, taskID int64, step proto.Step, state proto.SubtaskState) ([]*proto.Subtask, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAllSubtasksByStepAndState", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "GetAllSubtasksByStepAndState", ctx, taskID, step, state) ret0, _ := ret[0].([]*proto.Subtask) ret1, _ := ret[1].(error) return ret0, ret1 } // GetAllSubtasksByStepAndState indicates an expected call of GetAllSubtasksByStepAndState. -func (mr *MockTaskManagerMockRecorder) GetAllSubtasksByStepAndState(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) GetAllSubtasksByStepAndState(ctx, taskID, step, state any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllSubtasksByStepAndState", reflect.TypeOf((*MockTaskManager)(nil).GetAllSubtasksByStepAndState), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllSubtasksByStepAndState", reflect.TypeOf((*MockTaskManager)(nil).GetAllSubtasksByStepAndState), ctx, taskID, step, state) } // GetSubtaskCntGroupByStates mocks base method. -func (m *MockTaskManager) GetSubtaskCntGroupByStates(arg0 context.Context, arg1 int64, arg2 proto.Step) (map[proto.SubtaskState]int64, error) { +func (m *MockTaskManager) GetSubtaskCntGroupByStates(ctx context.Context, taskID int64, step proto.Step) (map[proto.SubtaskState]int64, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetSubtaskCntGroupByStates", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "GetSubtaskCntGroupByStates", ctx, taskID, step) ret0, _ := ret[0].(map[proto.SubtaskState]int64) ret1, _ := ret[1].(error) return ret0, ret1 } // GetSubtaskCntGroupByStates indicates an expected call of GetSubtaskCntGroupByStates. -func (mr *MockTaskManagerMockRecorder) GetSubtaskCntGroupByStates(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) GetSubtaskCntGroupByStates(ctx, taskID, step any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSubtaskCntGroupByStates", reflect.TypeOf((*MockTaskManager)(nil).GetSubtaskCntGroupByStates), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSubtaskCntGroupByStates", reflect.TypeOf((*MockTaskManager)(nil).GetSubtaskCntGroupByStates), ctx, taskID, step) } // GetSubtaskErrors mocks base method. -func (m *MockTaskManager) GetSubtaskErrors(arg0 context.Context, arg1 int64) ([]error, error) { +func (m *MockTaskManager) GetSubtaskErrors(ctx context.Context, taskID int64) ([]error, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetSubtaskErrors", arg0, arg1) + ret := m.ctrl.Call(m, "GetSubtaskErrors", ctx, taskID) ret0, _ := ret[0].([]error) ret1, _ := ret[1].(error) return ret0, ret1 } // GetSubtaskErrors indicates an expected call of GetSubtaskErrors. -func (mr *MockTaskManagerMockRecorder) GetSubtaskErrors(arg0, arg1 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) GetSubtaskErrors(ctx, taskID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSubtaskErrors", reflect.TypeOf((*MockTaskManager)(nil).GetSubtaskErrors), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSubtaskErrors", reflect.TypeOf((*MockTaskManager)(nil).GetSubtaskErrors), ctx, taskID) } // GetTaskBaseByID mocks base method. -func (m *MockTaskManager) GetTaskBaseByID(arg0 context.Context, arg1 int64) (*proto.TaskBase, error) { +func (m *MockTaskManager) GetTaskBaseByID(ctx context.Context, taskID int64) (*proto.TaskBase, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTaskBaseByID", arg0, arg1) + ret := m.ctrl.Call(m, "GetTaskBaseByID", ctx, taskID) ret0, _ := ret[0].(*proto.TaskBase) ret1, _ := ret[1].(error) return ret0, ret1 } // GetTaskBaseByID indicates an expected call of GetTaskBaseByID. -func (mr *MockTaskManagerMockRecorder) GetTaskBaseByID(arg0, arg1 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) GetTaskBaseByID(ctx, taskID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTaskBaseByID", reflect.TypeOf((*MockTaskManager)(nil).GetTaskBaseByID), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTaskBaseByID", reflect.TypeOf((*MockTaskManager)(nil).GetTaskBaseByID), ctx, taskID) } // GetTaskByID mocks base method. -func (m *MockTaskManager) GetTaskByID(arg0 context.Context, arg1 int64) (*proto.Task, error) { +func (m *MockTaskManager) GetTaskByID(ctx context.Context, taskID int64) (*proto.Task, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTaskByID", arg0, arg1) + ret := m.ctrl.Call(m, "GetTaskByID", ctx, taskID) ret0, _ := ret[0].(*proto.Task) ret1, _ := ret[1].(error) return ret0, ret1 } // GetTaskByID indicates an expected call of GetTaskByID. -func (mr *MockTaskManagerMockRecorder) GetTaskByID(arg0, arg1 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) GetTaskByID(ctx, taskID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTaskByID", reflect.TypeOf((*MockTaskManager)(nil).GetTaskByID), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTaskByID", reflect.TypeOf((*MockTaskManager)(nil).GetTaskByID), ctx, taskID) } // GetTasksInStates mocks base method. -func (m *MockTaskManager) GetTasksInStates(arg0 context.Context, arg1 ...any) ([]*proto.Task, error) { +func (m *MockTaskManager) GetTasksInStates(ctx context.Context, states ...any) ([]*proto.Task, error) { m.ctrl.T.Helper() - varargs := []any{arg0} - for _, a := range arg1 { + varargs := []any{ctx} + for _, a := range states { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetTasksInStates", varargs...) @@ -443,221 +431,221 @@ func (m *MockTaskManager) GetTasksInStates(arg0 context.Context, arg1 ...any) ([ } // GetTasksInStates indicates an expected call of GetTasksInStates. -func (mr *MockTaskManagerMockRecorder) GetTasksInStates(arg0 any, arg1 ...any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) GetTasksInStates(ctx any, states ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]any{arg0}, arg1...) + varargs := append([]any{ctx}, states...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTasksInStates", reflect.TypeOf((*MockTaskManager)(nil).GetTasksInStates), varargs...) } // GetTopUnfinishedTasks mocks base method. -func (m *MockTaskManager) GetTopUnfinishedTasks(arg0 context.Context) ([]*proto.TaskBase, error) { +func (m *MockTaskManager) GetTopUnfinishedTasks(ctx context.Context) ([]*proto.TaskBase, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTopUnfinishedTasks", arg0) + ret := m.ctrl.Call(m, "GetTopUnfinishedTasks", ctx) ret0, _ := ret[0].([]*proto.TaskBase) ret1, _ := ret[1].(error) return ret0, ret1 } // GetTopUnfinishedTasks indicates an expected call of GetTopUnfinishedTasks. -func (mr *MockTaskManagerMockRecorder) GetTopUnfinishedTasks(arg0 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) GetTopUnfinishedTasks(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTopUnfinishedTasks", reflect.TypeOf((*MockTaskManager)(nil).GetTopUnfinishedTasks), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTopUnfinishedTasks", reflect.TypeOf((*MockTaskManager)(nil).GetTopUnfinishedTasks), ctx) } // GetUsedSlotsOnNodes mocks base method. -func (m *MockTaskManager) GetUsedSlotsOnNodes(arg0 context.Context) (map[string]int, error) { +func (m *MockTaskManager) GetUsedSlotsOnNodes(ctx context.Context) (map[string]int, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetUsedSlotsOnNodes", arg0) + ret := m.ctrl.Call(m, "GetUsedSlotsOnNodes", ctx) ret0, _ := ret[0].(map[string]int) ret1, _ := ret[1].(error) return ret0, ret1 } // GetUsedSlotsOnNodes indicates an expected call of GetUsedSlotsOnNodes. -func (mr *MockTaskManagerMockRecorder) GetUsedSlotsOnNodes(arg0 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) GetUsedSlotsOnNodes(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUsedSlotsOnNodes", reflect.TypeOf((*MockTaskManager)(nil).GetUsedSlotsOnNodes), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUsedSlotsOnNodes", reflect.TypeOf((*MockTaskManager)(nil).GetUsedSlotsOnNodes), ctx) } // PauseTask mocks base method. -func (m *MockTaskManager) PauseTask(arg0 context.Context, arg1 string) (bool, error) { +func (m *MockTaskManager) PauseTask(ctx context.Context, taskKey string) (bool, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PauseTask", arg0, arg1) + ret := m.ctrl.Call(m, "PauseTask", ctx, taskKey) ret0, _ := ret[0].(bool) ret1, _ := ret[1].(error) return ret0, ret1 } // PauseTask indicates an expected call of PauseTask. -func (mr *MockTaskManagerMockRecorder) PauseTask(arg0, arg1 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) PauseTask(ctx, taskKey any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PauseTask", reflect.TypeOf((*MockTaskManager)(nil).PauseTask), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PauseTask", reflect.TypeOf((*MockTaskManager)(nil).PauseTask), ctx, taskKey) } // PausedTask mocks base method. -func (m *MockTaskManager) PausedTask(arg0 context.Context, arg1 int64) error { +func (m *MockTaskManager) PausedTask(ctx context.Context, taskID int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PausedTask", arg0, arg1) + ret := m.ctrl.Call(m, "PausedTask", ctx, taskID) ret0, _ := ret[0].(error) return ret0 } // PausedTask indicates an expected call of PausedTask. -func (mr *MockTaskManagerMockRecorder) PausedTask(arg0, arg1 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) PausedTask(ctx, taskID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PausedTask", reflect.TypeOf((*MockTaskManager)(nil).PausedTask), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PausedTask", reflect.TypeOf((*MockTaskManager)(nil).PausedTask), ctx, taskID) } // ResumeSubtasks mocks base method. -func (m *MockTaskManager) ResumeSubtasks(arg0 context.Context, arg1 int64) error { +func (m *MockTaskManager) ResumeSubtasks(ctx context.Context, taskID int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ResumeSubtasks", arg0, arg1) + ret := m.ctrl.Call(m, "ResumeSubtasks", ctx, taskID) ret0, _ := ret[0].(error) return ret0 } // ResumeSubtasks indicates an expected call of ResumeSubtasks. -func (mr *MockTaskManagerMockRecorder) ResumeSubtasks(arg0, arg1 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) ResumeSubtasks(ctx, taskID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResumeSubtasks", reflect.TypeOf((*MockTaskManager)(nil).ResumeSubtasks), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResumeSubtasks", reflect.TypeOf((*MockTaskManager)(nil).ResumeSubtasks), ctx, taskID) } // ResumedTask mocks base method. -func (m *MockTaskManager) ResumedTask(arg0 context.Context, arg1 int64) error { +func (m *MockTaskManager) ResumedTask(ctx context.Context, taskID int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ResumedTask", arg0, arg1) + ret := m.ctrl.Call(m, "ResumedTask", ctx, taskID) ret0, _ := ret[0].(error) return ret0 } // ResumedTask indicates an expected call of ResumedTask. -func (mr *MockTaskManagerMockRecorder) ResumedTask(arg0, arg1 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) ResumedTask(ctx, taskID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResumedTask", reflect.TypeOf((*MockTaskManager)(nil).ResumedTask), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResumedTask", reflect.TypeOf((*MockTaskManager)(nil).ResumedTask), ctx, taskID) } // RevertTask mocks base method. -func (m *MockTaskManager) RevertTask(arg0 context.Context, arg1 int64, arg2 proto.TaskState, arg3 error) error { +func (m *MockTaskManager) RevertTask(ctx context.Context, taskID int64, taskState proto.TaskState, taskErr error) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RevertTask", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "RevertTask", ctx, taskID, taskState, taskErr) ret0, _ := ret[0].(error) return ret0 } // RevertTask indicates an expected call of RevertTask. -func (mr *MockTaskManagerMockRecorder) RevertTask(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) RevertTask(ctx, taskID, taskState, taskErr any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RevertTask", reflect.TypeOf((*MockTaskManager)(nil).RevertTask), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RevertTask", reflect.TypeOf((*MockTaskManager)(nil).RevertTask), ctx, taskID, taskState, taskErr) } // RevertedTask mocks base method. -func (m *MockTaskManager) RevertedTask(arg0 context.Context, arg1 int64) error { +func (m *MockTaskManager) RevertedTask(ctx context.Context, taskID int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RevertedTask", arg0, arg1) + ret := m.ctrl.Call(m, "RevertedTask", ctx, taskID) ret0, _ := ret[0].(error) return ret0 } // RevertedTask indicates an expected call of RevertedTask. -func (mr *MockTaskManagerMockRecorder) RevertedTask(arg0, arg1 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) RevertedTask(ctx, taskID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RevertedTask", reflect.TypeOf((*MockTaskManager)(nil).RevertedTask), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RevertedTask", reflect.TypeOf((*MockTaskManager)(nil).RevertedTask), ctx, taskID) } // SucceedTask mocks base method. -func (m *MockTaskManager) SucceedTask(arg0 context.Context, arg1 int64) error { +func (m *MockTaskManager) SucceedTask(ctx context.Context, taskID int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SucceedTask", arg0, arg1) + ret := m.ctrl.Call(m, "SucceedTask", ctx, taskID) ret0, _ := ret[0].(error) return ret0 } // SucceedTask indicates an expected call of SucceedTask. -func (mr *MockTaskManagerMockRecorder) SucceedTask(arg0, arg1 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) SucceedTask(ctx, taskID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SucceedTask", reflect.TypeOf((*MockTaskManager)(nil).SucceedTask), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SucceedTask", reflect.TypeOf((*MockTaskManager)(nil).SucceedTask), ctx, taskID) } // SwitchTaskStep mocks base method. -func (m *MockTaskManager) SwitchTaskStep(arg0 context.Context, arg1 *proto.Task, arg2 proto.TaskState, arg3 proto.Step, arg4 []*proto.Subtask) error { +func (m *MockTaskManager) SwitchTaskStep(ctx context.Context, task *proto.Task, nextState proto.TaskState, nextStep proto.Step, subtasks []*proto.Subtask) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SwitchTaskStep", arg0, arg1, arg2, arg3, arg4) + ret := m.ctrl.Call(m, "SwitchTaskStep", ctx, task, nextState, nextStep, subtasks) ret0, _ := ret[0].(error) return ret0 } // SwitchTaskStep indicates an expected call of SwitchTaskStep. -func (mr *MockTaskManagerMockRecorder) SwitchTaskStep(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) SwitchTaskStep(ctx, task, nextState, nextStep, subtasks any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SwitchTaskStep", reflect.TypeOf((*MockTaskManager)(nil).SwitchTaskStep), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SwitchTaskStep", reflect.TypeOf((*MockTaskManager)(nil).SwitchTaskStep), ctx, task, nextState, nextStep, subtasks) } // SwitchTaskStepInBatch mocks base method. -func (m *MockTaskManager) SwitchTaskStepInBatch(arg0 context.Context, arg1 *proto.Task, arg2 proto.TaskState, arg3 proto.Step, arg4 []*proto.Subtask) error { +func (m *MockTaskManager) SwitchTaskStepInBatch(ctx context.Context, task *proto.Task, nextState proto.TaskState, nextStep proto.Step, subtasks []*proto.Subtask) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SwitchTaskStepInBatch", arg0, arg1, arg2, arg3, arg4) + ret := m.ctrl.Call(m, "SwitchTaskStepInBatch", ctx, task, nextState, nextStep, subtasks) ret0, _ := ret[0].(error) return ret0 } // SwitchTaskStepInBatch indicates an expected call of SwitchTaskStepInBatch. -func (mr *MockTaskManagerMockRecorder) SwitchTaskStepInBatch(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) SwitchTaskStepInBatch(ctx, task, nextState, nextStep, subtasks any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SwitchTaskStepInBatch", reflect.TypeOf((*MockTaskManager)(nil).SwitchTaskStepInBatch), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SwitchTaskStepInBatch", reflect.TypeOf((*MockTaskManager)(nil).SwitchTaskStepInBatch), ctx, task, nextState, nextStep, subtasks) } // TransferTasks2History mocks base method. -func (m *MockTaskManager) TransferTasks2History(arg0 context.Context, arg1 []*proto.Task) error { +func (m *MockTaskManager) TransferTasks2History(ctx context.Context, tasks []*proto.Task) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "TransferTasks2History", arg0, arg1) + ret := m.ctrl.Call(m, "TransferTasks2History", ctx, tasks) ret0, _ := ret[0].(error) return ret0 } // TransferTasks2History indicates an expected call of TransferTasks2History. -func (mr *MockTaskManagerMockRecorder) TransferTasks2History(arg0, arg1 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) TransferTasks2History(ctx, tasks any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TransferTasks2History", reflect.TypeOf((*MockTaskManager)(nil).TransferTasks2History), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TransferTasks2History", reflect.TypeOf((*MockTaskManager)(nil).TransferTasks2History), ctx, tasks) } // UpdateSubtasksExecIDs mocks base method. -func (m *MockTaskManager) UpdateSubtasksExecIDs(arg0 context.Context, arg1 []*proto.SubtaskBase) error { +func (m *MockTaskManager) UpdateSubtasksExecIDs(ctx context.Context, subtasks []*proto.SubtaskBase) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateSubtasksExecIDs", arg0, arg1) + ret := m.ctrl.Call(m, "UpdateSubtasksExecIDs", ctx, subtasks) ret0, _ := ret[0].(error) return ret0 } // UpdateSubtasksExecIDs indicates an expected call of UpdateSubtasksExecIDs. -func (mr *MockTaskManagerMockRecorder) UpdateSubtasksExecIDs(arg0, arg1 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) UpdateSubtasksExecIDs(ctx, subtasks any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSubtasksExecIDs", reflect.TypeOf((*MockTaskManager)(nil).UpdateSubtasksExecIDs), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSubtasksExecIDs", reflect.TypeOf((*MockTaskManager)(nil).UpdateSubtasksExecIDs), ctx, subtasks) } // WithNewSession mocks base method. -func (m *MockTaskManager) WithNewSession(arg0 func(sessionctx.Context) error) error { +func (m *MockTaskManager) WithNewSession(fn func(sessionctx.Context) error) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "WithNewSession", arg0) + ret := m.ctrl.Call(m, "WithNewSession", fn) ret0, _ := ret[0].(error) return ret0 } // WithNewSession indicates an expected call of WithNewSession. -func (mr *MockTaskManagerMockRecorder) WithNewSession(arg0 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) WithNewSession(fn any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WithNewSession", reflect.TypeOf((*MockTaskManager)(nil).WithNewSession), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WithNewSession", reflect.TypeOf((*MockTaskManager)(nil).WithNewSession), fn) } // WithNewTxn mocks base method. -func (m *MockTaskManager) WithNewTxn(arg0 context.Context, arg1 func(sessionctx.Context) error) error { +func (m *MockTaskManager) WithNewTxn(ctx context.Context, fn func(sessionctx.Context) error) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "WithNewTxn", arg0, arg1) + ret := m.ctrl.Call(m, "WithNewTxn", ctx, fn) ret0, _ := ret[0].(error) return ret0 } // WithNewTxn indicates an expected call of WithNewTxn. -func (mr *MockTaskManagerMockRecorder) WithNewTxn(arg0, arg1 any) *gomock.Call { +func (mr *MockTaskManagerMockRecorder) WithNewTxn(ctx, fn any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WithNewTxn", reflect.TypeOf((*MockTaskManager)(nil).WithNewTxn), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WithNewTxn", reflect.TypeOf((*MockTaskManager)(nil).WithNewTxn), ctx, fn) } diff --git a/pkg/disttask/framework/mock/task_executor_mock.go b/pkg/disttask/framework/mock/task_executor_mock.go index 2ecd10ab0472a..e0e401bcfd168 100644 --- a/pkg/disttask/framework/mock/task_executor_mock.go +++ b/pkg/disttask/framework/mock/task_executor_mock.go @@ -23,6 +23,7 @@ import ( type MockTaskTable struct { ctrl *gomock.Controller recorder *MockTaskTableMockRecorder + isgomock struct{} } // MockTaskTableMockRecorder is the mock recorder for MockTaskTable. @@ -42,58 +43,53 @@ func (m *MockTaskTable) EXPECT() *MockTaskTableMockRecorder { return m.recorder } -// ISGOMOCK indicates that this struct is a gomock mock. -func (m *MockTaskTable) ISGOMOCK() struct{} { - return struct{}{} -} - // CancelSubtask mocks base method. -func (m *MockTaskTable) CancelSubtask(arg0 context.Context, arg1 string, arg2 int64) error { +func (m *MockTaskTable) CancelSubtask(ctx context.Context, exe string, taskID int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CancelSubtask", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "CancelSubtask", ctx, exe, taskID) ret0, _ := ret[0].(error) return ret0 } // CancelSubtask indicates an expected call of CancelSubtask. -func (mr *MockTaskTableMockRecorder) CancelSubtask(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockTaskTableMockRecorder) CancelSubtask(ctx, exe, taskID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelSubtask", reflect.TypeOf((*MockTaskTable)(nil).CancelSubtask), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelSubtask", reflect.TypeOf((*MockTaskTable)(nil).CancelSubtask), ctx, exe, taskID) } // FailSubtask mocks base method. -func (m *MockTaskTable) FailSubtask(arg0 context.Context, arg1 string, arg2 int64, arg3 error) error { +func (m *MockTaskTable) FailSubtask(ctx context.Context, execID string, taskID int64, err error) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FailSubtask", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "FailSubtask", ctx, execID, taskID, err) ret0, _ := ret[0].(error) return ret0 } // FailSubtask indicates an expected call of FailSubtask. -func (mr *MockTaskTableMockRecorder) FailSubtask(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *MockTaskTableMockRecorder) FailSubtask(ctx, execID, taskID, err any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FailSubtask", reflect.TypeOf((*MockTaskTable)(nil).FailSubtask), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FailSubtask", reflect.TypeOf((*MockTaskTable)(nil).FailSubtask), ctx, execID, taskID, err) } // FinishSubtask mocks base method. -func (m *MockTaskTable) FinishSubtask(arg0 context.Context, arg1 string, arg2 int64, arg3 []byte) error { +func (m *MockTaskTable) FinishSubtask(ctx context.Context, execID string, subtaskID int64, meta []byte) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FinishSubtask", arg0, arg1, arg2, arg3) + ret := m.ctrl.Call(m, "FinishSubtask", ctx, execID, subtaskID, meta) ret0, _ := ret[0].(error) return ret0 } // FinishSubtask indicates an expected call of FinishSubtask. -func (mr *MockTaskTableMockRecorder) FinishSubtask(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *MockTaskTableMockRecorder) FinishSubtask(ctx, execID, subtaskID, meta any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FinishSubtask", reflect.TypeOf((*MockTaskTable)(nil).FinishSubtask), arg0, arg1, arg2, arg3) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FinishSubtask", reflect.TypeOf((*MockTaskTable)(nil).FinishSubtask), ctx, execID, subtaskID, meta) } // GetFirstSubtaskInStates mocks base method. -func (m *MockTaskTable) GetFirstSubtaskInStates(arg0 context.Context, arg1 string, arg2 int64, arg3 proto.Step, arg4 ...proto.SubtaskState) (*proto.Subtask, error) { +func (m *MockTaskTable) GetFirstSubtaskInStates(ctx context.Context, instanceID string, taskID int64, step proto.Step, states ...proto.SubtaskState) (*proto.Subtask, error) { m.ctrl.T.Helper() - varargs := []any{arg0, arg1, arg2, arg3} - for _, a := range arg4 { + varargs := []any{ctx, instanceID, taskID, step} + for _, a := range states { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetFirstSubtaskInStates", varargs...) @@ -103,17 +99,17 @@ func (m *MockTaskTable) GetFirstSubtaskInStates(arg0 context.Context, arg1 strin } // GetFirstSubtaskInStates indicates an expected call of GetFirstSubtaskInStates. -func (mr *MockTaskTableMockRecorder) GetFirstSubtaskInStates(arg0, arg1, arg2, arg3 any, arg4 ...any) *gomock.Call { +func (mr *MockTaskTableMockRecorder) GetFirstSubtaskInStates(ctx, instanceID, taskID, step any, states ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]any{arg0, arg1, arg2, arg3}, arg4...) + varargs := append([]any{ctx, instanceID, taskID, step}, states...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetFirstSubtaskInStates", reflect.TypeOf((*MockTaskTable)(nil).GetFirstSubtaskInStates), varargs...) } // GetSubtasksByExecIDAndStepAndStates mocks base method. -func (m *MockTaskTable) GetSubtasksByExecIDAndStepAndStates(arg0 context.Context, arg1 string, arg2 int64, arg3 proto.Step, arg4 ...proto.SubtaskState) ([]*proto.Subtask, error) { +func (m *MockTaskTable) GetSubtasksByExecIDAndStepAndStates(ctx context.Context, execID string, taskID int64, step proto.Step, states ...proto.SubtaskState) ([]*proto.Subtask, error) { m.ctrl.T.Helper() - varargs := []any{arg0, arg1, arg2, arg3} - for _, a := range arg4 { + varargs := []any{ctx, execID, taskID, step} + for _, a := range states { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetSubtasksByExecIDAndStepAndStates", varargs...) @@ -123,62 +119,62 @@ func (m *MockTaskTable) GetSubtasksByExecIDAndStepAndStates(arg0 context.Context } // GetSubtasksByExecIDAndStepAndStates indicates an expected call of GetSubtasksByExecIDAndStepAndStates. -func (mr *MockTaskTableMockRecorder) GetSubtasksByExecIDAndStepAndStates(arg0, arg1, arg2, arg3 any, arg4 ...any) *gomock.Call { +func (mr *MockTaskTableMockRecorder) GetSubtasksByExecIDAndStepAndStates(ctx, execID, taskID, step any, states ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]any{arg0, arg1, arg2, arg3}, arg4...) + varargs := append([]any{ctx, execID, taskID, step}, states...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSubtasksByExecIDAndStepAndStates", reflect.TypeOf((*MockTaskTable)(nil).GetSubtasksByExecIDAndStepAndStates), varargs...) } // GetTaskBaseByID mocks base method. -func (m *MockTaskTable) GetTaskBaseByID(arg0 context.Context, arg1 int64) (*proto.TaskBase, error) { +func (m *MockTaskTable) GetTaskBaseByID(ctx context.Context, taskID int64) (*proto.TaskBase, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTaskBaseByID", arg0, arg1) + ret := m.ctrl.Call(m, "GetTaskBaseByID", ctx, taskID) ret0, _ := ret[0].(*proto.TaskBase) ret1, _ := ret[1].(error) return ret0, ret1 } // GetTaskBaseByID indicates an expected call of GetTaskBaseByID. -func (mr *MockTaskTableMockRecorder) GetTaskBaseByID(arg0, arg1 any) *gomock.Call { +func (mr *MockTaskTableMockRecorder) GetTaskBaseByID(ctx, taskID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTaskBaseByID", reflect.TypeOf((*MockTaskTable)(nil).GetTaskBaseByID), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTaskBaseByID", reflect.TypeOf((*MockTaskTable)(nil).GetTaskBaseByID), ctx, taskID) } // GetTaskByID mocks base method. -func (m *MockTaskTable) GetTaskByID(arg0 context.Context, arg1 int64) (*proto.Task, error) { +func (m *MockTaskTable) GetTaskByID(ctx context.Context, taskID int64) (*proto.Task, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTaskByID", arg0, arg1) + ret := m.ctrl.Call(m, "GetTaskByID", ctx, taskID) ret0, _ := ret[0].(*proto.Task) ret1, _ := ret[1].(error) return ret0, ret1 } // GetTaskByID indicates an expected call of GetTaskByID. -func (mr *MockTaskTableMockRecorder) GetTaskByID(arg0, arg1 any) *gomock.Call { +func (mr *MockTaskTableMockRecorder) GetTaskByID(ctx, taskID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTaskByID", reflect.TypeOf((*MockTaskTable)(nil).GetTaskByID), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTaskByID", reflect.TypeOf((*MockTaskTable)(nil).GetTaskByID), ctx, taskID) } // GetTaskExecInfoByExecID mocks base method. -func (m *MockTaskTable) GetTaskExecInfoByExecID(arg0 context.Context, arg1 string) ([]*storage.TaskExecInfo, error) { +func (m *MockTaskTable) GetTaskExecInfoByExecID(ctx context.Context, execID string) ([]*storage.TaskExecInfo, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTaskExecInfoByExecID", arg0, arg1) + ret := m.ctrl.Call(m, "GetTaskExecInfoByExecID", ctx, execID) ret0, _ := ret[0].([]*storage.TaskExecInfo) ret1, _ := ret[1].(error) return ret0, ret1 } // GetTaskExecInfoByExecID indicates an expected call of GetTaskExecInfoByExecID. -func (mr *MockTaskTableMockRecorder) GetTaskExecInfoByExecID(arg0, arg1 any) *gomock.Call { +func (mr *MockTaskTableMockRecorder) GetTaskExecInfoByExecID(ctx, execID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTaskExecInfoByExecID", reflect.TypeOf((*MockTaskTable)(nil).GetTaskExecInfoByExecID), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTaskExecInfoByExecID", reflect.TypeOf((*MockTaskTable)(nil).GetTaskExecInfoByExecID), ctx, execID) } // GetTasksInStates mocks base method. -func (m *MockTaskTable) GetTasksInStates(arg0 context.Context, arg1 ...any) ([]*proto.Task, error) { +func (m *MockTaskTable) GetTasksInStates(ctx context.Context, states ...any) ([]*proto.Task, error) { m.ctrl.T.Helper() - varargs := []any{arg0} - for _, a := range arg1 { + varargs := []any{ctx} + for _, a := range states { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetTasksInStates", varargs...) @@ -188,17 +184,17 @@ func (m *MockTaskTable) GetTasksInStates(arg0 context.Context, arg1 ...any) ([]* } // GetTasksInStates indicates an expected call of GetTasksInStates. -func (mr *MockTaskTableMockRecorder) GetTasksInStates(arg0 any, arg1 ...any) *gomock.Call { +func (mr *MockTaskTableMockRecorder) GetTasksInStates(ctx any, states ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]any{arg0}, arg1...) + varargs := append([]any{ctx}, states...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTasksInStates", reflect.TypeOf((*MockTaskTable)(nil).GetTasksInStates), varargs...) } // HasSubtasksInStates mocks base method. -func (m *MockTaskTable) HasSubtasksInStates(arg0 context.Context, arg1 string, arg2 int64, arg3 proto.Step, arg4 ...proto.SubtaskState) (bool, error) { +func (m *MockTaskTable) HasSubtasksInStates(ctx context.Context, execID string, taskID int64, step proto.Step, states ...proto.SubtaskState) (bool, error) { m.ctrl.T.Helper() - varargs := []any{arg0, arg1, arg2, arg3} - for _, a := range arg4 { + varargs := []any{ctx, execID, taskID, step} + for _, a := range states { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "HasSubtasksInStates", varargs...) @@ -208,100 +204,101 @@ func (m *MockTaskTable) HasSubtasksInStates(arg0 context.Context, arg1 string, a } // HasSubtasksInStates indicates an expected call of HasSubtasksInStates. -func (mr *MockTaskTableMockRecorder) HasSubtasksInStates(arg0, arg1, arg2, arg3 any, arg4 ...any) *gomock.Call { +func (mr *MockTaskTableMockRecorder) HasSubtasksInStates(ctx, execID, taskID, step any, states ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]any{arg0, arg1, arg2, arg3}, arg4...) + varargs := append([]any{ctx, execID, taskID, step}, states...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasSubtasksInStates", reflect.TypeOf((*MockTaskTable)(nil).HasSubtasksInStates), varargs...) } // InitMeta mocks base method. -func (m *MockTaskTable) InitMeta(arg0 context.Context, arg1, arg2 string) error { +func (m *MockTaskTable) InitMeta(ctx context.Context, execID, role string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "InitMeta", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "InitMeta", ctx, execID, role) ret0, _ := ret[0].(error) return ret0 } // InitMeta indicates an expected call of InitMeta. -func (mr *MockTaskTableMockRecorder) InitMeta(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockTaskTableMockRecorder) InitMeta(ctx, execID, role any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitMeta", reflect.TypeOf((*MockTaskTable)(nil).InitMeta), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitMeta", reflect.TypeOf((*MockTaskTable)(nil).InitMeta), ctx, execID, role) } // PauseSubtasks mocks base method. -func (m *MockTaskTable) PauseSubtasks(arg0 context.Context, arg1 string, arg2 int64) error { +func (m *MockTaskTable) PauseSubtasks(ctx context.Context, execID string, taskID int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PauseSubtasks", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "PauseSubtasks", ctx, execID, taskID) ret0, _ := ret[0].(error) return ret0 } // PauseSubtasks indicates an expected call of PauseSubtasks. -func (mr *MockTaskTableMockRecorder) PauseSubtasks(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockTaskTableMockRecorder) PauseSubtasks(ctx, execID, taskID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PauseSubtasks", reflect.TypeOf((*MockTaskTable)(nil).PauseSubtasks), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PauseSubtasks", reflect.TypeOf((*MockTaskTable)(nil).PauseSubtasks), ctx, execID, taskID) } // RecoverMeta mocks base method. -func (m *MockTaskTable) RecoverMeta(arg0 context.Context, arg1, arg2 string) error { +func (m *MockTaskTable) RecoverMeta(ctx context.Context, execID, role string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RecoverMeta", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "RecoverMeta", ctx, execID, role) ret0, _ := ret[0].(error) return ret0 } // RecoverMeta indicates an expected call of RecoverMeta. -func (mr *MockTaskTableMockRecorder) RecoverMeta(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockTaskTableMockRecorder) RecoverMeta(ctx, execID, role any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecoverMeta", reflect.TypeOf((*MockTaskTable)(nil).RecoverMeta), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecoverMeta", reflect.TypeOf((*MockTaskTable)(nil).RecoverMeta), ctx, execID, role) } // RunningSubtasksBack2Pending mocks base method. -func (m *MockTaskTable) RunningSubtasksBack2Pending(arg0 context.Context, arg1 []*proto.SubtaskBase) error { +func (m *MockTaskTable) RunningSubtasksBack2Pending(ctx context.Context, subtasks []*proto.SubtaskBase) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RunningSubtasksBack2Pending", arg0, arg1) + ret := m.ctrl.Call(m, "RunningSubtasksBack2Pending", ctx, subtasks) ret0, _ := ret[0].(error) return ret0 } // RunningSubtasksBack2Pending indicates an expected call of RunningSubtasksBack2Pending. -func (mr *MockTaskTableMockRecorder) RunningSubtasksBack2Pending(arg0, arg1 any) *gomock.Call { +func (mr *MockTaskTableMockRecorder) RunningSubtasksBack2Pending(ctx, subtasks any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunningSubtasksBack2Pending", reflect.TypeOf((*MockTaskTable)(nil).RunningSubtasksBack2Pending), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunningSubtasksBack2Pending", reflect.TypeOf((*MockTaskTable)(nil).RunningSubtasksBack2Pending), ctx, subtasks) } // StartSubtask mocks base method. -func (m *MockTaskTable) StartSubtask(arg0 context.Context, arg1 int64, arg2 string) error { +func (m *MockTaskTable) StartSubtask(ctx context.Context, subtaskID int64, execID string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "StartSubtask", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "StartSubtask", ctx, subtaskID, execID) ret0, _ := ret[0].(error) return ret0 } // StartSubtask indicates an expected call of StartSubtask. -func (mr *MockTaskTableMockRecorder) StartSubtask(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockTaskTableMockRecorder) StartSubtask(ctx, subtaskID, execID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StartSubtask", reflect.TypeOf((*MockTaskTable)(nil).StartSubtask), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StartSubtask", reflect.TypeOf((*MockTaskTable)(nil).StartSubtask), ctx, subtaskID, execID) } // UpdateSubtaskStateAndError mocks base method. -func (m *MockTaskTable) UpdateSubtaskStateAndError(arg0 context.Context, arg1 string, arg2 int64, arg3 proto.SubtaskState, arg4 error) error { +func (m *MockTaskTable) UpdateSubtaskStateAndError(ctx context.Context, execID string, subtaskID int64, state proto.SubtaskState, err error) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateSubtaskStateAndError", arg0, arg1, arg2, arg3, arg4) + ret := m.ctrl.Call(m, "UpdateSubtaskStateAndError", ctx, execID, subtaskID, state, err) ret0, _ := ret[0].(error) return ret0 } // UpdateSubtaskStateAndError indicates an expected call of UpdateSubtaskStateAndError. -func (mr *MockTaskTableMockRecorder) UpdateSubtaskStateAndError(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *MockTaskTableMockRecorder) UpdateSubtaskStateAndError(ctx, execID, subtaskID, state, err any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSubtaskStateAndError", reflect.TypeOf((*MockTaskTable)(nil).UpdateSubtaskStateAndError), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSubtaskStateAndError", reflect.TypeOf((*MockTaskTable)(nil).UpdateSubtaskStateAndError), ctx, execID, subtaskID, state, err) } // MockPool is a mock of Pool interface. type MockPool struct { ctrl *gomock.Controller recorder *MockPoolMockRecorder + isgomock struct{} } // MockPoolMockRecorder is the mock recorder for MockPool. @@ -321,11 +318,6 @@ func (m *MockPool) EXPECT() *MockPoolMockRecorder { return m.recorder } -// ISGOMOCK indicates that this struct is a gomock mock. -func (m *MockPool) ISGOMOCK() struct{} { - return struct{}{} -} - // ReleaseAndWait mocks base method. func (m *MockPool) ReleaseAndWait() { m.ctrl.T.Helper() @@ -370,6 +362,7 @@ func (mr *MockPoolMockRecorder) RunWithConcurrency(arg0, arg1 any) *gomock.Call type MockTaskExecutor struct { ctrl *gomock.Controller recorder *MockTaskExecutorMockRecorder + isgomock struct{} } // MockTaskExecutorMockRecorder is the mock recorder for MockTaskExecutor. @@ -389,11 +382,6 @@ func (m *MockTaskExecutor) EXPECT() *MockTaskExecutorMockRecorder { return m.recorder } -// ISGOMOCK indicates that this struct is a gomock mock. -func (m *MockTaskExecutor) ISGOMOCK() struct{} { - return struct{}{} -} - // Cancel mocks base method. func (m *MockTaskExecutor) Cancel() { m.ctrl.T.Helper() @@ -459,35 +447,36 @@ func (mr *MockTaskExecutorMockRecorder) Init(arg0 any) *gomock.Call { } // IsRetryableError mocks base method. -func (m *MockTaskExecutor) IsRetryableError(arg0 error) bool { +func (m *MockTaskExecutor) IsRetryableError(err error) bool { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsRetryableError", arg0) + ret := m.ctrl.Call(m, "IsRetryableError", err) ret0, _ := ret[0].(bool) return ret0 } // IsRetryableError indicates an expected call of IsRetryableError. -func (mr *MockTaskExecutorMockRecorder) IsRetryableError(arg0 any) *gomock.Call { +func (mr *MockTaskExecutorMockRecorder) IsRetryableError(err any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsRetryableError", reflect.TypeOf((*MockTaskExecutor)(nil).IsRetryableError), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsRetryableError", reflect.TypeOf((*MockTaskExecutor)(nil).IsRetryableError), err) } // Run mocks base method. -func (m *MockTaskExecutor) Run(arg0 *proto.StepResource) { +func (m *MockTaskExecutor) Run(resource *proto.StepResource) { m.ctrl.T.Helper() - m.ctrl.Call(m, "Run", arg0) + m.ctrl.Call(m, "Run", resource) } // Run indicates an expected call of Run. -func (mr *MockTaskExecutorMockRecorder) Run(arg0 any) *gomock.Call { +func (mr *MockTaskExecutorMockRecorder) Run(resource any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Run", reflect.TypeOf((*MockTaskExecutor)(nil).Run), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Run", reflect.TypeOf((*MockTaskExecutor)(nil).Run), resource) } // MockExtension is a mock of Extension interface. type MockExtension struct { ctrl *gomock.Controller recorder *MockExtensionMockRecorder + isgomock struct{} } // MockExtensionMockRecorder is the mock recorder for MockExtension. @@ -507,50 +496,45 @@ func (m *MockExtension) EXPECT() *MockExtensionMockRecorder { return m.recorder } -// ISGOMOCK indicates that this struct is a gomock mock. -func (m *MockExtension) ISGOMOCK() struct{} { - return struct{}{} -} - // GetStepExecutor mocks base method. -func (m *MockExtension) GetStepExecutor(arg0 *proto.Task) (execute.StepExecutor, error) { +func (m *MockExtension) GetStepExecutor(task *proto.Task) (execute.StepExecutor, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetStepExecutor", arg0) + ret := m.ctrl.Call(m, "GetStepExecutor", task) ret0, _ := ret[0].(execute.StepExecutor) ret1, _ := ret[1].(error) return ret0, ret1 } // GetStepExecutor indicates an expected call of GetStepExecutor. -func (mr *MockExtensionMockRecorder) GetStepExecutor(arg0 any) *gomock.Call { +func (mr *MockExtensionMockRecorder) GetStepExecutor(task any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStepExecutor", reflect.TypeOf((*MockExtension)(nil).GetStepExecutor), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStepExecutor", reflect.TypeOf((*MockExtension)(nil).GetStepExecutor), task) } // IsIdempotent mocks base method. -func (m *MockExtension) IsIdempotent(arg0 *proto.Subtask) bool { +func (m *MockExtension) IsIdempotent(subtask *proto.Subtask) bool { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsIdempotent", arg0) + ret := m.ctrl.Call(m, "IsIdempotent", subtask) ret0, _ := ret[0].(bool) return ret0 } // IsIdempotent indicates an expected call of IsIdempotent. -func (mr *MockExtensionMockRecorder) IsIdempotent(arg0 any) *gomock.Call { +func (mr *MockExtensionMockRecorder) IsIdempotent(subtask any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsIdempotent", reflect.TypeOf((*MockExtension)(nil).IsIdempotent), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsIdempotent", reflect.TypeOf((*MockExtension)(nil).IsIdempotent), subtask) } // IsRetryableError mocks base method. -func (m *MockExtension) IsRetryableError(arg0 error) bool { +func (m *MockExtension) IsRetryableError(err error) bool { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsRetryableError", arg0) + ret := m.ctrl.Call(m, "IsRetryableError", err) ret0, _ := ret[0].(bool) return ret0 } // IsRetryableError indicates an expected call of IsRetryableError. -func (mr *MockExtensionMockRecorder) IsRetryableError(arg0 any) *gomock.Call { +func (mr *MockExtensionMockRecorder) IsRetryableError(err any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsRetryableError", reflect.TypeOf((*MockExtension)(nil).IsRetryableError), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsRetryableError", reflect.TypeOf((*MockExtension)(nil).IsRetryableError), err) } diff --git a/pkg/disttask/framework/scheduler/mock/scheduler_mock.go b/pkg/disttask/framework/scheduler/mock/scheduler_mock.go index e820c22016f16..13fd6ab01681c 100644 --- a/pkg/disttask/framework/scheduler/mock/scheduler_mock.go +++ b/pkg/disttask/framework/scheduler/mock/scheduler_mock.go @@ -22,6 +22,7 @@ import ( type MockExtension struct { ctrl *gomock.Controller recorder *MockExtensionMockRecorder + isgomock struct{} } // MockExtensionMockRecorder is the mock recorder for MockExtension. @@ -41,91 +42,86 @@ func (m *MockExtension) EXPECT() *MockExtensionMockRecorder { return m.recorder } -// ISGOMOCK indicates that this struct is a gomock mock. -func (m *MockExtension) ISGOMOCK() struct{} { - return struct{}{} -} - // GetEligibleInstances mocks base method. -func (m *MockExtension) GetEligibleInstances(arg0 context.Context, arg1 *proto.Task) ([]string, error) { +func (m *MockExtension) GetEligibleInstances(ctx context.Context, task *proto.Task) ([]string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetEligibleInstances", arg0, arg1) + ret := m.ctrl.Call(m, "GetEligibleInstances", ctx, task) ret0, _ := ret[0].([]string) ret1, _ := ret[1].(error) return ret0, ret1 } // GetEligibleInstances indicates an expected call of GetEligibleInstances. -func (mr *MockExtensionMockRecorder) GetEligibleInstances(arg0, arg1 any) *gomock.Call { +func (mr *MockExtensionMockRecorder) GetEligibleInstances(ctx, task any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetEligibleInstances", reflect.TypeOf((*MockExtension)(nil).GetEligibleInstances), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetEligibleInstances", reflect.TypeOf((*MockExtension)(nil).GetEligibleInstances), ctx, task) } // GetNextStep mocks base method. -func (m *MockExtension) GetNextStep(arg0 *proto.TaskBase) proto.Step { +func (m *MockExtension) GetNextStep(task *proto.TaskBase) proto.Step { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetNextStep", arg0) + ret := m.ctrl.Call(m, "GetNextStep", task) ret0, _ := ret[0].(proto.Step) return ret0 } // GetNextStep indicates an expected call of GetNextStep. -func (mr *MockExtensionMockRecorder) GetNextStep(arg0 any) *gomock.Call { +func (mr *MockExtensionMockRecorder) GetNextStep(task any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNextStep", reflect.TypeOf((*MockExtension)(nil).GetNextStep), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNextStep", reflect.TypeOf((*MockExtension)(nil).GetNextStep), task) } // IsRetryableErr mocks base method. -func (m *MockExtension) IsRetryableErr(arg0 error) bool { +func (m *MockExtension) IsRetryableErr(err error) bool { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsRetryableErr", arg0) + ret := m.ctrl.Call(m, "IsRetryableErr", err) ret0, _ := ret[0].(bool) return ret0 } // IsRetryableErr indicates an expected call of IsRetryableErr. -func (mr *MockExtensionMockRecorder) IsRetryableErr(arg0 any) *gomock.Call { +func (mr *MockExtensionMockRecorder) IsRetryableErr(err any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsRetryableErr", reflect.TypeOf((*MockExtension)(nil).IsRetryableErr), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsRetryableErr", reflect.TypeOf((*MockExtension)(nil).IsRetryableErr), err) } // OnDone mocks base method. -func (m *MockExtension) OnDone(arg0 context.Context, arg1 storage.TaskHandle, arg2 *proto.Task) error { +func (m *MockExtension) OnDone(ctx context.Context, h storage.TaskHandle, task *proto.Task) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "OnDone", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "OnDone", ctx, h, task) ret0, _ := ret[0].(error) return ret0 } // OnDone indicates an expected call of OnDone. -func (mr *MockExtensionMockRecorder) OnDone(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockExtensionMockRecorder) OnDone(ctx, h, task any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnDone", reflect.TypeOf((*MockExtension)(nil).OnDone), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnDone", reflect.TypeOf((*MockExtension)(nil).OnDone), ctx, h, task) } // OnNextSubtasksBatch mocks base method. -func (m *MockExtension) OnNextSubtasksBatch(arg0 context.Context, arg1 storage.TaskHandle, arg2 *proto.Task, arg3 []string, arg4 proto.Step) ([][]byte, error) { +func (m *MockExtension) OnNextSubtasksBatch(ctx context.Context, h storage.TaskHandle, task *proto.Task, execIDs []string, step proto.Step) ([][]byte, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "OnNextSubtasksBatch", arg0, arg1, arg2, arg3, arg4) + ret := m.ctrl.Call(m, "OnNextSubtasksBatch", ctx, h, task, execIDs, step) ret0, _ := ret[0].([][]byte) ret1, _ := ret[1].(error) return ret0, ret1 } // OnNextSubtasksBatch indicates an expected call of OnNextSubtasksBatch. -func (mr *MockExtensionMockRecorder) OnNextSubtasksBatch(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *MockExtensionMockRecorder) OnNextSubtasksBatch(ctx, h, task, execIDs, step any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnNextSubtasksBatch", reflect.TypeOf((*MockExtension)(nil).OnNextSubtasksBatch), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnNextSubtasksBatch", reflect.TypeOf((*MockExtension)(nil).OnNextSubtasksBatch), ctx, h, task, execIDs, step) } // OnTick mocks base method. -func (m *MockExtension) OnTick(arg0 context.Context, arg1 *proto.Task) { +func (m *MockExtension) OnTick(ctx context.Context, task *proto.Task) { m.ctrl.T.Helper() - m.ctrl.Call(m, "OnTick", arg0, arg1) + m.ctrl.Call(m, "OnTick", ctx, task) } // OnTick indicates an expected call of OnTick. -func (mr *MockExtensionMockRecorder) OnTick(arg0, arg1 any) *gomock.Call { +func (mr *MockExtensionMockRecorder) OnTick(ctx, task any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnTick", reflect.TypeOf((*MockExtension)(nil).OnTick), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OnTick", reflect.TypeOf((*MockExtension)(nil).OnTick), ctx, task) } diff --git a/pkg/disttask/importinto/mock/import_mock.go b/pkg/disttask/importinto/mock/import_mock.go index 7be883ce4e346..5b8382093d154 100644 --- a/pkg/disttask/importinto/mock/import_mock.go +++ b/pkg/disttask/importinto/mock/import_mock.go @@ -13,7 +13,7 @@ import ( context "context" reflect "reflect" - "github.com/pingcap/tidb/pkg/lightning/backend" + backend "github.com/pingcap/tidb/pkg/lightning/backend" gomock "go.uber.org/mock/gomock" ) @@ -21,6 +21,7 @@ import ( type MockMiniTaskExecutor struct { ctrl *gomock.Controller recorder *MockMiniTaskExecutorMockRecorder + isgomock struct{} } // MockMiniTaskExecutorMockRecorder is the mock recorder for MockMiniTaskExecutor. @@ -40,21 +41,16 @@ func (m *MockMiniTaskExecutor) EXPECT() *MockMiniTaskExecutorMockRecorder { return m.recorder } -// ISGOMOCK indicates that this struct is a gomock mock. -func (m *MockMiniTaskExecutor) ISGOMOCK() struct{} { - return struct{}{} -} - // Run mocks base method. -func (m *MockMiniTaskExecutor) Run(arg0 context.Context, arg1, arg2 backend.EngineWriter) error { +func (m *MockMiniTaskExecutor) Run(ctx context.Context, dataWriter, indexWriter backend.EngineWriter) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Run", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "Run", ctx, dataWriter, indexWriter) ret0, _ := ret[0].(error) return ret0 } // Run indicates an expected call of Run. -func (mr *MockMiniTaskExecutorMockRecorder) Run(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockMiniTaskExecutorMockRecorder) Run(ctx, dataWriter, indexWriter any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Run", reflect.TypeOf((*MockMiniTaskExecutor)(nil).Run), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Run", reflect.TypeOf((*MockMiniTaskExecutor)(nil).Run), ctx, dataWriter, indexWriter) } diff --git a/pkg/util/sqlexec/mock/restricted_sql_executor_mock.go b/pkg/util/sqlexec/mock/restricted_sql_executor_mock.go index 0ee7f88c8b64b..148ec72b2fcb6 100644 --- a/pkg/util/sqlexec/mock/restricted_sql_executor_mock.go +++ b/pkg/util/sqlexec/mock/restricted_sql_executor_mock.go @@ -14,7 +14,7 @@ import ( reflect "reflect" ast "github.com/pingcap/tidb/pkg/parser/ast" - "github.com/pingcap/tidb/pkg/planner/core/resolve" + resolve "github.com/pingcap/tidb/pkg/planner/core/resolve" chunk "github.com/pingcap/tidb/pkg/util/chunk" sqlexec "github.com/pingcap/tidb/pkg/util/sqlexec" gomock "go.uber.org/mock/gomock" @@ -24,6 +24,7 @@ import ( type MockRestrictedSQLExecutor struct { ctrl *gomock.Controller recorder *MockRestrictedSQLExecutorMockRecorder + isgomock struct{} } // MockRestrictedSQLExecutorMockRecorder is the mock recorder for MockRestrictedSQLExecutor. @@ -43,16 +44,11 @@ func (m *MockRestrictedSQLExecutor) EXPECT() *MockRestrictedSQLExecutorMockRecor return m.recorder } -// ISGOMOCK indicates that this struct is a gomock mock. -func (m *MockRestrictedSQLExecutor) ISGOMOCK() struct{} { - return struct{}{} -} - // ExecRestrictedSQL mocks base method. -func (m *MockRestrictedSQLExecutor) ExecRestrictedSQL(arg0 context.Context, arg1 []func(*sqlexec.ExecOption), arg2 string, arg3 ...any) ([]chunk.Row, []*resolve.ResultField, error) { +func (m *MockRestrictedSQLExecutor) ExecRestrictedSQL(ctx context.Context, opts []func(*sqlexec.ExecOption), sql string, args ...any) ([]chunk.Row, []*resolve.ResultField, error) { m.ctrl.T.Helper() - varargs := []any{arg0, arg1, arg2} - for _, a := range arg3 { + varargs := []any{ctx, opts, sql} + for _, a := range args { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "ExecRestrictedSQL", varargs...) @@ -63,17 +59,17 @@ func (m *MockRestrictedSQLExecutor) ExecRestrictedSQL(arg0 context.Context, arg1 } // ExecRestrictedSQL indicates an expected call of ExecRestrictedSQL. -func (mr *MockRestrictedSQLExecutorMockRecorder) ExecRestrictedSQL(arg0, arg1, arg2 any, arg3 ...any) *gomock.Call { +func (mr *MockRestrictedSQLExecutorMockRecorder) ExecRestrictedSQL(ctx, opts, sql any, args ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]any{arg0, arg1, arg2}, arg3...) + varargs := append([]any{ctx, opts, sql}, args...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExecRestrictedSQL", reflect.TypeOf((*MockRestrictedSQLExecutor)(nil).ExecRestrictedSQL), varargs...) } // ExecRestrictedStmt mocks base method. -func (m *MockRestrictedSQLExecutor) ExecRestrictedStmt(arg0 context.Context, arg1 ast.StmtNode, arg2 ...func(*sqlexec.ExecOption)) ([]chunk.Row, []*resolve.ResultField, error) { +func (m *MockRestrictedSQLExecutor) ExecRestrictedStmt(ctx context.Context, stmt ast.StmtNode, opts ...func(*sqlexec.ExecOption)) ([]chunk.Row, []*resolve.ResultField, error) { m.ctrl.T.Helper() - varargs := []any{arg0, arg1} - for _, a := range arg2 { + varargs := []any{ctx, stmt} + for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "ExecRestrictedStmt", varargs...) @@ -84,17 +80,17 @@ func (m *MockRestrictedSQLExecutor) ExecRestrictedStmt(arg0 context.Context, arg } // ExecRestrictedStmt indicates an expected call of ExecRestrictedStmt. -func (mr *MockRestrictedSQLExecutorMockRecorder) ExecRestrictedStmt(arg0, arg1 any, arg2 ...any) *gomock.Call { +func (mr *MockRestrictedSQLExecutorMockRecorder) ExecRestrictedStmt(ctx, stmt any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]any{arg0, arg1}, arg2...) + varargs := append([]any{ctx, stmt}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExecRestrictedStmt", reflect.TypeOf((*MockRestrictedSQLExecutor)(nil).ExecRestrictedStmt), varargs...) } // ParseWithParams mocks base method. -func (m *MockRestrictedSQLExecutor) ParseWithParams(arg0 context.Context, arg1 string, arg2 ...any) (ast.StmtNode, error) { +func (m *MockRestrictedSQLExecutor) ParseWithParams(ctx context.Context, sql string, args ...any) (ast.StmtNode, error) { m.ctrl.T.Helper() - varargs := []any{arg0, arg1} - for _, a := range arg2 { + varargs := []any{ctx, sql} + for _, a := range args { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "ParseWithParams", varargs...) @@ -104,8 +100,8 @@ func (m *MockRestrictedSQLExecutor) ParseWithParams(arg0 context.Context, arg1 s } // ParseWithParams indicates an expected call of ParseWithParams. -func (mr *MockRestrictedSQLExecutorMockRecorder) ParseWithParams(arg0, arg1 any, arg2 ...any) *gomock.Call { +func (mr *MockRestrictedSQLExecutorMockRecorder) ParseWithParams(ctx, sql any, args ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]any{arg0, arg1}, arg2...) + varargs := append([]any{ctx, sql}, args...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ParseWithParams", reflect.TypeOf((*MockRestrictedSQLExecutor)(nil).ParseWithParams), varargs...) } From 08b1c612813430b0ed09be89e57b86f022d6a65f Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Mon, 21 Oct 2024 13:33:02 +0800 Subject: [PATCH 5/5] update Signed-off-by: Weizhen Wang --- br/pkg/mock/mocklocal/BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/br/pkg/mock/mocklocal/BUILD.bazel b/br/pkg/mock/mocklocal/BUILD.bazel index 78f39e5824ea7..b54fc070ac554 100644 --- a/br/pkg/mock/mocklocal/BUILD.bazel +++ b/br/pkg/mock/mocklocal/BUILD.bazel @@ -8,7 +8,7 @@ go_library( deps = [ "//pkg/lightning/backend", "@com_github_pingcap_kvproto//pkg/import_sstpb", - "@com_github_tikv_client_go_v2//tikv", + "@com_github_tikv_client_go_v2//internal/apicodec", "@org_uber_go_mock//gomock", ], )