diff --git a/Makefile b/Makefile index eeded514e7..4d144696aa 100644 --- a/Makefile +++ b/Makefile @@ -478,12 +478,7 @@ generate-mockery-rootcoord: getdeps $(INSTALL_PATH)/mockery --name=IMetaTable --dir=$(PWD)/internal/rootcoord --output=$(PWD)/internal/rootcoord/mocks --filename=meta_table.go --with-expecter --outpkg=mockrootcoord generate-mockery-proxy: getdeps - $(INSTALL_PATH)/mockery --name=Cache --dir=$(PWD)/internal/proxy --output=$(PWD)/internal/proxy --filename=mock_cache.go --structname=MockCache --with-expecter --outpkg=proxy --inpackage - $(INSTALL_PATH)/mockery --name=timestampAllocatorInterface --dir=$(PWD)/internal/proxy --output=$(PWD)/internal/proxy --filename=mock_tso_test.go --structname=mockTimestampAllocator --with-expecter --outpkg=proxy --inpackage - $(INSTALL_PATH)/mockery --name=LBPolicy --dir=$(PWD)/internal/proxy --output=$(PWD)/internal/proxy --filename=mock_lb_policy.go --structname=MockLBPolicy --with-expecter --outpkg=proxy --inpackage - $(INSTALL_PATH)/mockery --name=LBBalancer --dir=$(PWD)/internal/proxy --output=$(PWD)/internal/proxy --filename=mock_lb_balancer.go --structname=MockLBBalancer --with-expecter --outpkg=proxy --inpackage - $(INSTALL_PATH)/mockery --name=shardClientMgr --dir=$(PWD)/internal/proxy --output=$(PWD)/internal/proxy --filename=mock_shardclient_manager.go --structname=MockShardClientManager --with-expecter --outpkg=proxy --inpackage - $(INSTALL_PATH)/mockery --name=channelsMgr --dir=$(PWD)/internal/proxy --output=$(PWD)/internal/proxy --filename=mock_channels_manager.go --structname=MockChannelsMgr --with-expecter --outpkg=proxy --inpackage + $(INSTALL_PATH)/mockery --config $(PWD)/internal/proxy/.mockery.yaml generate-mockery-querycoord: getdeps $(INSTALL_PATH)/mockery --config $(PWD)/internal/querycoordv2/.mockery.yaml diff --git a/internal/proxy/.mockery.yaml b/internal/proxy/.mockery.yaml new file mode 100644 index 0000000000..fe429dc2f7 --- /dev/null +++ b/internal/proxy/.mockery.yaml @@ -0,0 +1,31 @@ +quiet: False +with-expecter: True +inpackage: True +filename: "mock_{{.InterfaceNameSnake}}.go" +mockname: "Mock{{.InterfaceName}}" +outpkg: "{{.PackageName}}" +dir: "{{.InterfaceDir}}" +packages: + github.com/milvus-io/milvus/internal/proxy: + interfaces: + Cache: + timestampAllocatorInterface: + config: + mockname: mockTimestampAllocator + filename: mock_tso_test.go + channelsMgr: + config: + mockname: MockChannelsMgr + filename: mock_channels_manager.go + github.com/milvus-io/milvus/internal/proxy/shardclient: + interfaces: + LBPolicy: + config: + filename: mock_lb_policy.go + LBBalancer: + config: + filename: mock_lb_balancer.go + ShardClientMgr: + config: + filename: mock_shardclient_manager.go + mockname: MockShardClientManager diff --git a/internal/proxy/mock_cache.go b/internal/proxy/mock_cache.go index 27d7d32744..cbc4c2f721 100644 --- a/internal/proxy/mock_cache.go +++ b/internal/proxy/mock_cache.go @@ -5,10 +5,7 @@ package proxy import ( context "context" - internalpb "github.com/milvus-io/milvus/pkg/v2/proto/internalpb" mock "github.com/stretchr/testify/mock" - - typeutil "github.com/milvus-io/milvus/pkg/v2/util/typeutil" ) // MockCache is an autogenerated mock type for the Cache type @@ -80,40 +77,6 @@ func (_c *MockCache_AllocID_Call) RunAndReturn(run func(context.Context) (int64, return _c } -// DeprecateShardCache provides a mock function with given fields: database, collectionName -func (_m *MockCache) DeprecateShardCache(database string, collectionName string) { - _m.Called(database, collectionName) -} - -// MockCache_DeprecateShardCache_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeprecateShardCache' -type MockCache_DeprecateShardCache_Call struct { - *mock.Call -} - -// DeprecateShardCache is a helper method to define mock.On call -// - database string -// - collectionName string -func (_e *MockCache_Expecter) DeprecateShardCache(database interface{}, collectionName interface{}) *MockCache_DeprecateShardCache_Call { - return &MockCache_DeprecateShardCache_Call{Call: _e.mock.On("DeprecateShardCache", database, collectionName)} -} - -func (_c *MockCache_DeprecateShardCache_Call) Run(run func(database string, collectionName string)) *MockCache_DeprecateShardCache_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string), args[1].(string)) - }) - return _c -} - -func (_c *MockCache_DeprecateShardCache_Call) Return() *MockCache_DeprecateShardCache_Call { - _c.Call.Return() - return _c -} - -func (_c *MockCache_DeprecateShardCache_Call) RunAndReturn(run func(string, string)) *MockCache_DeprecateShardCache_Call { - _c.Run(run) - return _c -} - // GetCollectionID provides a mock function with given fields: ctx, database, collectionName func (_m *MockCache) GetCollectionID(ctx context.Context, database string, collectionName string) (int64, error) { ret := _m.Called(ctx, database, collectionName) @@ -351,65 +314,6 @@ func (_c *MockCache_GetCollectionSchema_Call) RunAndReturn(run func(context.Cont return _c } -// GetCredentialInfo provides a mock function with given fields: ctx, username -func (_m *MockCache) GetCredentialInfo(ctx context.Context, username string) (*internalpb.CredentialInfo, error) { - ret := _m.Called(ctx, username) - - if len(ret) == 0 { - panic("no return value specified for GetCredentialInfo") - } - - var r0 *internalpb.CredentialInfo - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) (*internalpb.CredentialInfo, error)); ok { - return rf(ctx, username) - } - if rf, ok := ret.Get(0).(func(context.Context, string) *internalpb.CredentialInfo); ok { - r0 = rf(ctx, username) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*internalpb.CredentialInfo) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, username) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockCache_GetCredentialInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCredentialInfo' -type MockCache_GetCredentialInfo_Call struct { - *mock.Call -} - -// GetCredentialInfo is a helper method to define mock.On call -// - ctx context.Context -// - username string -func (_e *MockCache_Expecter) GetCredentialInfo(ctx interface{}, username interface{}) *MockCache_GetCredentialInfo_Call { - return &MockCache_GetCredentialInfo_Call{Call: _e.mock.On("GetCredentialInfo", ctx, username)} -} - -func (_c *MockCache_GetCredentialInfo_Call) Run(run func(ctx context.Context, username string)) *MockCache_GetCredentialInfo_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(string)) - }) - return _c -} - -func (_c *MockCache_GetCredentialInfo_Call) Return(_a0 *internalpb.CredentialInfo, _a1 error) *MockCache_GetCredentialInfo_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockCache_GetCredentialInfo_Call) RunAndReturn(run func(context.Context, string) (*internalpb.CredentialInfo, error)) *MockCache_GetCredentialInfo_Call { - _c.Call.Return(run) - return _c -} - // GetDatabaseInfo provides a mock function with given fields: ctx, database func (_m *MockCache) GetDatabaseInfo(ctx context.Context, database string) (*databaseInfo, error) { ret := _m.Called(ctx, database) @@ -709,164 +613,6 @@ func (_c *MockCache_GetPartitionsIndex_Call) RunAndReturn(run func(context.Conte return _c } -// GetPrivilegeInfo provides a mock function with given fields: ctx -func (_m *MockCache) GetPrivilegeInfo(ctx context.Context) []string { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for GetPrivilegeInfo") - } - - var r0 []string - if rf, ok := ret.Get(0).(func(context.Context) []string); ok { - r0 = rf(ctx) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]string) - } - } - - return r0 -} - -// MockCache_GetPrivilegeInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPrivilegeInfo' -type MockCache_GetPrivilegeInfo_Call struct { - *mock.Call -} - -// GetPrivilegeInfo is a helper method to define mock.On call -// - ctx context.Context -func (_e *MockCache_Expecter) GetPrivilegeInfo(ctx interface{}) *MockCache_GetPrivilegeInfo_Call { - return &MockCache_GetPrivilegeInfo_Call{Call: _e.mock.On("GetPrivilegeInfo", ctx)} -} - -func (_c *MockCache_GetPrivilegeInfo_Call) Run(run func(ctx context.Context)) *MockCache_GetPrivilegeInfo_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context)) - }) - return _c -} - -func (_c *MockCache_GetPrivilegeInfo_Call) Return(_a0 []string) *MockCache_GetPrivilegeInfo_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockCache_GetPrivilegeInfo_Call) RunAndReturn(run func(context.Context) []string) *MockCache_GetPrivilegeInfo_Call { - _c.Call.Return(run) - return _c -} - -// GetShardLeaderList provides a mock function with given fields: ctx, database, collectionName, collectionID, withCache -func (_m *MockCache) GetShardLeaderList(ctx context.Context, database string, collectionName string, collectionID int64, withCache bool) ([]string, error) { - ret := _m.Called(ctx, database, collectionName, collectionID, withCache) - - if len(ret) == 0 { - panic("no return value specified for GetShardLeaderList") - } - - var r0 []string - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64, bool) ([]string, error)); ok { - return rf(ctx, database, collectionName, collectionID, withCache) - } - if rf, ok := ret.Get(0).(func(context.Context, string, string, int64, bool) []string); ok { - r0 = rf(ctx, database, collectionName, collectionID, withCache) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]string) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, string, int64, bool) error); ok { - r1 = rf(ctx, database, collectionName, collectionID, withCache) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockCache_GetShardLeaderList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetShardLeaderList' -type MockCache_GetShardLeaderList_Call struct { - *mock.Call -} - -// GetShardLeaderList is a helper method to define mock.On call -// - ctx context.Context -// - database string -// - collectionName string -// - collectionID int64 -// - withCache bool -func (_e *MockCache_Expecter) GetShardLeaderList(ctx interface{}, database interface{}, collectionName interface{}, collectionID interface{}, withCache interface{}) *MockCache_GetShardLeaderList_Call { - return &MockCache_GetShardLeaderList_Call{Call: _e.mock.On("GetShardLeaderList", ctx, database, collectionName, collectionID, withCache)} -} - -func (_c *MockCache_GetShardLeaderList_Call) Run(run func(ctx context.Context, database string, collectionName string, collectionID int64, withCache bool)) *MockCache_GetShardLeaderList_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(int64), args[4].(bool)) - }) - return _c -} - -func (_c *MockCache_GetShardLeaderList_Call) Return(_a0 []string, _a1 error) *MockCache_GetShardLeaderList_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockCache_GetShardLeaderList_Call) RunAndReturn(run func(context.Context, string, string, int64, bool) ([]string, error)) *MockCache_GetShardLeaderList_Call { - _c.Call.Return(run) - return _c -} - -// GetUserRole provides a mock function with given fields: username -func (_m *MockCache) GetUserRole(username string) []string { - ret := _m.Called(username) - - if len(ret) == 0 { - panic("no return value specified for GetUserRole") - } - - var r0 []string - if rf, ok := ret.Get(0).(func(string) []string); ok { - r0 = rf(username) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]string) - } - } - - return r0 -} - -// MockCache_GetUserRole_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUserRole' -type MockCache_GetUserRole_Call struct { - *mock.Call -} - -// GetUserRole is a helper method to define mock.On call -// - username string -func (_e *MockCache_Expecter) GetUserRole(username interface{}) *MockCache_GetUserRole_Call { - return &MockCache_GetUserRole_Call{Call: _e.mock.On("GetUserRole", username)} -} - -func (_c *MockCache_GetUserRole_Call) Run(run func(username string)) *MockCache_GetUserRole_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string)) - }) - return _c -} - -func (_c *MockCache_GetUserRole_Call) Return(_a0 []string) *MockCache_GetUserRole_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockCache_GetUserRole_Call) RunAndReturn(run func(string) []string) *MockCache_GetUserRole_Call { - _c.Call.Return(run) - return _c -} - // HasDatabase provides a mock function with given fields: ctx, database func (_m *MockCache) HasDatabase(ctx context.Context, database string) bool { ret := _m.Called(ctx, database) @@ -914,119 +660,6 @@ func (_c *MockCache_HasDatabase_Call) RunAndReturn(run func(context.Context, str return _c } -// InitPolicyInfo provides a mock function with given fields: info, userRoles -func (_m *MockCache) InitPolicyInfo(info []string, userRoles []string) { - _m.Called(info, userRoles) -} - -// MockCache_InitPolicyInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InitPolicyInfo' -type MockCache_InitPolicyInfo_Call struct { - *mock.Call -} - -// InitPolicyInfo is a helper method to define mock.On call -// - info []string -// - userRoles []string -func (_e *MockCache_Expecter) InitPolicyInfo(info interface{}, userRoles interface{}) *MockCache_InitPolicyInfo_Call { - return &MockCache_InitPolicyInfo_Call{Call: _e.mock.On("InitPolicyInfo", info, userRoles)} -} - -func (_c *MockCache_InitPolicyInfo_Call) Run(run func(info []string, userRoles []string)) *MockCache_InitPolicyInfo_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]string), args[1].([]string)) - }) - return _c -} - -func (_c *MockCache_InitPolicyInfo_Call) Return() *MockCache_InitPolicyInfo_Call { - _c.Call.Return() - return _c -} - -func (_c *MockCache_InitPolicyInfo_Call) RunAndReturn(run func([]string, []string)) *MockCache_InitPolicyInfo_Call { - _c.Run(run) - return _c -} - -// InvalidateShardLeaderCache provides a mock function with given fields: collections -func (_m *MockCache) InvalidateShardLeaderCache(collections []int64) { - _m.Called(collections) -} - -// MockCache_InvalidateShardLeaderCache_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InvalidateShardLeaderCache' -type MockCache_InvalidateShardLeaderCache_Call struct { - *mock.Call -} - -// InvalidateShardLeaderCache is a helper method to define mock.On call -// - collections []int64 -func (_e *MockCache_Expecter) InvalidateShardLeaderCache(collections interface{}) *MockCache_InvalidateShardLeaderCache_Call { - return &MockCache_InvalidateShardLeaderCache_Call{Call: _e.mock.On("InvalidateShardLeaderCache", collections)} -} - -func (_c *MockCache_InvalidateShardLeaderCache_Call) Run(run func(collections []int64)) *MockCache_InvalidateShardLeaderCache_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].([]int64)) - }) - return _c -} - -func (_c *MockCache_InvalidateShardLeaderCache_Call) Return() *MockCache_InvalidateShardLeaderCache_Call { - _c.Call.Return() - return _c -} - -func (_c *MockCache_InvalidateShardLeaderCache_Call) RunAndReturn(run func([]int64)) *MockCache_InvalidateShardLeaderCache_Call { - _c.Run(run) - return _c -} - -// RefreshPolicyInfo provides a mock function with given fields: op -func (_m *MockCache) RefreshPolicyInfo(op typeutil.CacheOp) error { - ret := _m.Called(op) - - if len(ret) == 0 { - panic("no return value specified for RefreshPolicyInfo") - } - - var r0 error - if rf, ok := ret.Get(0).(func(typeutil.CacheOp) error); ok { - r0 = rf(op) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockCache_RefreshPolicyInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RefreshPolicyInfo' -type MockCache_RefreshPolicyInfo_Call struct { - *mock.Call -} - -// RefreshPolicyInfo is a helper method to define mock.On call -// - op typeutil.CacheOp -func (_e *MockCache_Expecter) RefreshPolicyInfo(op interface{}) *MockCache_RefreshPolicyInfo_Call { - return &MockCache_RefreshPolicyInfo_Call{Call: _e.mock.On("RefreshPolicyInfo", op)} -} - -func (_c *MockCache_RefreshPolicyInfo_Call) Run(run func(op typeutil.CacheOp)) *MockCache_RefreshPolicyInfo_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(typeutil.CacheOp)) - }) - return _c -} - -func (_c *MockCache_RefreshPolicyInfo_Call) Return(_a0 error) *MockCache_RefreshPolicyInfo_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockCache_RefreshPolicyInfo_Call) RunAndReturn(run func(typeutil.CacheOp) error) *MockCache_RefreshPolicyInfo_Call { - _c.Call.Return(run) - return _c -} - // RemoveCollection provides a mock function with given fields: ctx, database, collectionName func (_m *MockCache) RemoveCollection(ctx context.Context, database string, collectionName string) { _m.Called(ctx, database, collectionName) @@ -1113,39 +746,6 @@ func (_c *MockCache_RemoveCollectionsByID_Call) RunAndReturn(run func(context.Co return _c } -// RemoveCredential provides a mock function with given fields: username -func (_m *MockCache) RemoveCredential(username string) { - _m.Called(username) -} - -// MockCache_RemoveCredential_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveCredential' -type MockCache_RemoveCredential_Call struct { - *mock.Call -} - -// RemoveCredential is a helper method to define mock.On call -// - username string -func (_e *MockCache_Expecter) RemoveCredential(username interface{}) *MockCache_RemoveCredential_Call { - return &MockCache_RemoveCredential_Call{Call: _e.mock.On("RemoveCredential", username)} -} - -func (_c *MockCache_RemoveCredential_Call) Run(run func(username string)) *MockCache_RemoveCredential_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string)) - }) - return _c -} - -func (_c *MockCache_RemoveCredential_Call) Return() *MockCache_RemoveCredential_Call { - _c.Call.Return() - return _c -} - -func (_c *MockCache_RemoveCredential_Call) RunAndReturn(run func(string)) *MockCache_RemoveCredential_Call { - _c.Run(run) - return _c -} - // RemoveDatabase provides a mock function with given fields: ctx, database func (_m *MockCache) RemoveDatabase(ctx context.Context, database string) { _m.Called(ctx, database) @@ -1180,46 +780,12 @@ func (_c *MockCache_RemoveDatabase_Call) RunAndReturn(run func(context.Context, return _c } -// UpdateCredential provides a mock function with given fields: credInfo -func (_m *MockCache) UpdateCredential(credInfo *internalpb.CredentialInfo) { - _m.Called(credInfo) -} - -// MockCache_UpdateCredential_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateCredential' -type MockCache_UpdateCredential_Call struct { - *mock.Call -} - -// UpdateCredential is a helper method to define mock.On call -// - credInfo *internalpb.CredentialInfo -func (_e *MockCache_Expecter) UpdateCredential(credInfo interface{}) *MockCache_UpdateCredential_Call { - return &MockCache_UpdateCredential_Call{Call: _e.mock.On("UpdateCredential", credInfo)} -} - -func (_c *MockCache_UpdateCredential_Call) Run(run func(credInfo *internalpb.CredentialInfo)) *MockCache_UpdateCredential_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*internalpb.CredentialInfo)) - }) - return _c -} - -func (_c *MockCache_UpdateCredential_Call) Return() *MockCache_UpdateCredential_Call { - _c.Call.Return() - return _c -} - -func (_c *MockCache_UpdateCredential_Call) RunAndReturn(run func(*internalpb.CredentialInfo)) *MockCache_UpdateCredential_Call { - _c.Run(run) - return _c -} - // NewMockCache creates a new instance of MockCache. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewMockCache(t interface { mock.TestingT Cleanup(func()) -}, -) *MockCache { +}) *MockCache { mock := &MockCache{} mock.Mock.Test(t) diff --git a/internal/proxy/shardclient/mock_lb_balancer.go b/internal/proxy/shardclient/mock_lb_balancer.go index 156f166b5d..4fdd05bd03 100644 --- a/internal/proxy/shardclient/mock_lb_balancer.go +++ b/internal/proxy/shardclient/mock_lb_balancer.go @@ -99,7 +99,7 @@ type MockLBBalancer_RegisterNodeInfo_Call struct { } // RegisterNodeInfo is a helper method to define mock.On call -// - nodeInfos []nodeInfo +// - nodeInfos []NodeInfo func (_e *MockLBBalancer_Expecter) RegisterNodeInfo(nodeInfos interface{}) *MockLBBalancer_RegisterNodeInfo_Call { return &MockLBBalancer_RegisterNodeInfo_Call{Call: _e.mock.On("RegisterNodeInfo", nodeInfos)} } @@ -251,8 +251,7 @@ func (_c *MockLBBalancer_UpdateCostMetrics_Call) RunAndReturn(run func(int64, *i func NewMockLBBalancer(t interface { mock.TestingT Cleanup(func()) -}, -) *MockLBBalancer { +}) *MockLBBalancer { mock := &MockLBBalancer{} mock.Mock.Test(t) diff --git a/internal/proxy/shardclient/mock_lb_policy.go b/internal/proxy/shardclient/mock_lb_policy.go index 7fe71876eb..60bf5e31a8 100644 --- a/internal/proxy/shardclient/mock_lb_policy.go +++ b/internal/proxy/shardclient/mock_lb_policy.go @@ -267,8 +267,7 @@ func (_c *MockLBPolicy_UpdateCostMetrics_Call) RunAndReturn(run func(int64, *int func NewMockLBPolicy(t interface { mock.TestingT Cleanup(func()) -}, -) *MockLBPolicy { +}) *MockLBPolicy { mock := &MockLBPolicy{} mock.Mock.Test(t) diff --git a/internal/proxy/shardclient/mock_shardclient_manager.go b/internal/proxy/shardclient/mock_shardclient_manager.go index 07d06d4012..10a6f6cff9 100644 --- a/internal/proxy/shardclient/mock_shardclient_manager.go +++ b/internal/proxy/shardclient/mock_shardclient_manager.go @@ -88,9 +88,9 @@ func (_c *MockShardClientManager_DeprecateShardCache_Call) RunAndReturn(run func return _c } -// GetClient provides a mock function with given fields: ctx, nodeInfo1 -func (_m *MockShardClientManager) GetClient(ctx context.Context, nodeInfo1 NodeInfo) (types.QueryNodeClient, error) { - ret := _m.Called(ctx, nodeInfo1) +// GetClient provides a mock function with given fields: ctx, nodeInfo +func (_m *MockShardClientManager) GetClient(ctx context.Context, nodeInfo NodeInfo) (types.QueryNodeClient, error) { + ret := _m.Called(ctx, nodeInfo) if len(ret) == 0 { panic("no return value specified for GetClient") @@ -99,10 +99,10 @@ func (_m *MockShardClientManager) GetClient(ctx context.Context, nodeInfo1 NodeI var r0 types.QueryNodeClient var r1 error if rf, ok := ret.Get(0).(func(context.Context, NodeInfo) (types.QueryNodeClient, error)); ok { - return rf(ctx, nodeInfo1) + return rf(ctx, nodeInfo) } if rf, ok := ret.Get(0).(func(context.Context, NodeInfo) types.QueryNodeClient); ok { - r0 = rf(ctx, nodeInfo1) + r0 = rf(ctx, nodeInfo) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(types.QueryNodeClient) @@ -110,7 +110,7 @@ func (_m *MockShardClientManager) GetClient(ctx context.Context, nodeInfo1 NodeI } if rf, ok := ret.Get(1).(func(context.Context, NodeInfo) error); ok { - r1 = rf(ctx, nodeInfo1) + r1 = rf(ctx, nodeInfo) } else { r1 = ret.Error(1) } @@ -125,12 +125,12 @@ type MockShardClientManager_GetClient_Call struct { // GetClient is a helper method to define mock.On call // - ctx context.Context -// - nodeInfo1 nodeInfo -func (_e *MockShardClientManager_Expecter) GetClient(ctx interface{}, nodeInfo1 interface{}) *MockShardClientManager_GetClient_Call { - return &MockShardClientManager_GetClient_Call{Call: _e.mock.On("GetClient", ctx, nodeInfo1)} +// - nodeInfo NodeInfo +func (_e *MockShardClientManager_Expecter) GetClient(ctx interface{}, nodeInfo interface{}) *MockShardClientManager_GetClient_Call { + return &MockShardClientManager_GetClient_Call{Call: _e.mock.On("GetClient", ctx, nodeInfo)} } -func (_c *MockShardClientManager_GetClient_Call) Run(run func(ctx context.Context, nodeInfo1 NodeInfo)) *MockShardClientManager_GetClient_Call { +func (_c *MockShardClientManager_GetClient_Call) Run(run func(ctx context.Context, nodeInfo NodeInfo)) *MockShardClientManager_GetClient_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(NodeInfo)) }) @@ -455,8 +455,7 @@ func (_c *MockShardClientManager_Start_Call) RunAndReturn(run func()) *MockShard func NewMockShardClientManager(t interface { mock.TestingT Cleanup(func()) -}, -) *MockShardClientManager { +}) *MockShardClientManager { mock := &MockShardClientManager{} mock.Mock.Test(t) diff --git a/internal/proxy/task_search_test.go b/internal/proxy/task_search_test.go index 8e2a0cc4f1..ab02ae231a 100644 --- a/internal/proxy/task_search_test.go +++ b/internal/proxy/task_search_test.go @@ -1103,8 +1103,6 @@ func TestSearchTask_WithFunctions(t *testing.T) { cache.EXPECT().GetCollectionSchema(mock.Anything, mock.Anything, mock.Anything).Return(info, nil).Maybe() cache.EXPECT().GetPartitions(mock.Anything, mock.Anything, mock.Anything).Return(map[string]int64{"_default": UniqueID(1)}, nil).Maybe() cache.EXPECT().GetCollectionInfo(mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(&collectionInfo{}, nil).Maybe() - // cache.EXPECT().GetShard(mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return([]nodeInfo{}, nil).Maybe() - cache.EXPECT().DeprecateShardCache(mock.Anything, mock.Anything).Return().Maybe() globalMetaCache = cache {