mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 01:28:27 +08:00
Related to #44761 #38339 This commit consolidates the proxy package's mockery generation to use a centralized `.mockery.yaml` configuration file, aligning with the pattern used by other packages like querycoordv2. Changes - **Makefile**: Replace multiple individual mockery commands with a single config-based invocation for `generate-mockery-proxy` target - **internal/proxy/.mockery.yaml**: Add mockery configuration defining all mock interfaces for proxy and proxy/shardclient packages - **Mock files**: Regenerate mocks using the new configuration: - `mock_cache.go`: Clean up by removing unused interface methods (credential, shard cache, policy methods) - `shardclient/mock_lb_balancer.go`: Update type comments (nodeInfo → NodeInfo) - `shardclient/mock_lb_policy.go`: Update formatting - `shardclient/mock_shardclient_manager.go`: Fix parameter naming consistency (nodeInfo1 → nodeInfo) - **task_search_test.go**: Remove obsolete mock expectations for deprecated cache methods Benefits - Centralized mockery configuration for easier maintenance - Consistent with other packages (querycoordv2, etc.) - Cleaner mock interfaces by removing unused methods - Better type consistency in generated mocks Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
466 lines
17 KiB
Go
466 lines
17 KiB
Go
// Code generated by mockery v2.53.3. DO NOT EDIT.
|
|
|
|
package shardclient
|
|
|
|
import (
|
|
context "context"
|
|
|
|
types "github.com/milvus-io/milvus/internal/types"
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// MockShardClientManager is an autogenerated mock type for the ShardClientMgr type
|
|
type MockShardClientManager struct {
|
|
mock.Mock
|
|
}
|
|
|
|
type MockShardClientManager_Expecter struct {
|
|
mock *mock.Mock
|
|
}
|
|
|
|
func (_m *MockShardClientManager) EXPECT() *MockShardClientManager_Expecter {
|
|
return &MockShardClientManager_Expecter{mock: &_m.Mock}
|
|
}
|
|
|
|
// Close provides a mock function with no fields
|
|
func (_m *MockShardClientManager) Close() {
|
|
_m.Called()
|
|
}
|
|
|
|
// MockShardClientManager_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
|
|
type MockShardClientManager_Close_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Close is a helper method to define mock.On call
|
|
func (_e *MockShardClientManager_Expecter) Close() *MockShardClientManager_Close_Call {
|
|
return &MockShardClientManager_Close_Call{Call: _e.mock.On("Close")}
|
|
}
|
|
|
|
func (_c *MockShardClientManager_Close_Call) Run(run func()) *MockShardClientManager_Close_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run()
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockShardClientManager_Close_Call) Return() *MockShardClientManager_Close_Call {
|
|
_c.Call.Return()
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockShardClientManager_Close_Call) RunAndReturn(run func()) *MockShardClientManager_Close_Call {
|
|
_c.Run(run)
|
|
return _c
|
|
}
|
|
|
|
// DeprecateShardCache provides a mock function with given fields: database, collectionName
|
|
func (_m *MockShardClientManager) DeprecateShardCache(database string, collectionName string) {
|
|
_m.Called(database, collectionName)
|
|
}
|
|
|
|
// MockShardClientManager_DeprecateShardCache_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeprecateShardCache'
|
|
type MockShardClientManager_DeprecateShardCache_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// DeprecateShardCache is a helper method to define mock.On call
|
|
// - database string
|
|
// - collectionName string
|
|
func (_e *MockShardClientManager_Expecter) DeprecateShardCache(database interface{}, collectionName interface{}) *MockShardClientManager_DeprecateShardCache_Call {
|
|
return &MockShardClientManager_DeprecateShardCache_Call{Call: _e.mock.On("DeprecateShardCache", database, collectionName)}
|
|
}
|
|
|
|
func (_c *MockShardClientManager_DeprecateShardCache_Call) Run(run func(database string, collectionName string)) *MockShardClientManager_DeprecateShardCache_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(string), args[1].(string))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockShardClientManager_DeprecateShardCache_Call) Return() *MockShardClientManager_DeprecateShardCache_Call {
|
|
_c.Call.Return()
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockShardClientManager_DeprecateShardCache_Call) RunAndReturn(run func(string, string)) *MockShardClientManager_DeprecateShardCache_Call {
|
|
_c.Run(run)
|
|
return _c
|
|
}
|
|
|
|
// 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")
|
|
}
|
|
|
|
var r0 types.QueryNodeClient
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, NodeInfo) (types.QueryNodeClient, error)); ok {
|
|
return rf(ctx, nodeInfo)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, NodeInfo) types.QueryNodeClient); ok {
|
|
r0 = rf(ctx, nodeInfo)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(types.QueryNodeClient)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, NodeInfo) error); ok {
|
|
r1 = rf(ctx, nodeInfo)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// MockShardClientManager_GetClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetClient'
|
|
type MockShardClientManager_GetClient_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// GetClient is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - 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, nodeInfo NodeInfo)) *MockShardClientManager_GetClient_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(NodeInfo))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockShardClientManager_GetClient_Call) Return(_a0 types.QueryNodeClient, _a1 error) *MockShardClientManager_GetClient_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockShardClientManager_GetClient_Call) RunAndReturn(run func(context.Context, NodeInfo) (types.QueryNodeClient, error)) *MockShardClientManager_GetClient_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// GetShard provides a mock function with given fields: ctx, withCache, database, collectionName, collectionID, channel
|
|
func (_m *MockShardClientManager) GetShard(ctx context.Context, withCache bool, database string, collectionName string, collectionID int64, channel string) ([]NodeInfo, error) {
|
|
ret := _m.Called(ctx, withCache, database, collectionName, collectionID, channel)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetShard")
|
|
}
|
|
|
|
var r0 []NodeInfo
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, bool, string, string, int64, string) ([]NodeInfo, error)); ok {
|
|
return rf(ctx, withCache, database, collectionName, collectionID, channel)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, bool, string, string, int64, string) []NodeInfo); ok {
|
|
r0 = rf(ctx, withCache, database, collectionName, collectionID, channel)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]NodeInfo)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, bool, string, string, int64, string) error); ok {
|
|
r1 = rf(ctx, withCache, database, collectionName, collectionID, channel)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// MockShardClientManager_GetShard_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetShard'
|
|
type MockShardClientManager_GetShard_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// GetShard is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - withCache bool
|
|
// - database string
|
|
// - collectionName string
|
|
// - collectionID int64
|
|
// - channel string
|
|
func (_e *MockShardClientManager_Expecter) GetShard(ctx interface{}, withCache interface{}, database interface{}, collectionName interface{}, collectionID interface{}, channel interface{}) *MockShardClientManager_GetShard_Call {
|
|
return &MockShardClientManager_GetShard_Call{Call: _e.mock.On("GetShard", ctx, withCache, database, collectionName, collectionID, channel)}
|
|
}
|
|
|
|
func (_c *MockShardClientManager_GetShard_Call) Run(run func(ctx context.Context, withCache bool, database string, collectionName string, collectionID int64, channel string)) *MockShardClientManager_GetShard_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(bool), args[2].(string), args[3].(string), args[4].(int64), args[5].(string))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockShardClientManager_GetShard_Call) Return(_a0 []NodeInfo, _a1 error) *MockShardClientManager_GetShard_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockShardClientManager_GetShard_Call) RunAndReturn(run func(context.Context, bool, string, string, int64, string) ([]NodeInfo, error)) *MockShardClientManager_GetShard_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// GetShardLeaderList provides a mock function with given fields: ctx, database, collectionName, collectionID, withCache
|
|
func (_m *MockShardClientManager) 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
|
|
}
|
|
|
|
// MockShardClientManager_GetShardLeaderList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetShardLeaderList'
|
|
type MockShardClientManager_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 *MockShardClientManager_Expecter) GetShardLeaderList(ctx interface{}, database interface{}, collectionName interface{}, collectionID interface{}, withCache interface{}) *MockShardClientManager_GetShardLeaderList_Call {
|
|
return &MockShardClientManager_GetShardLeaderList_Call{Call: _e.mock.On("GetShardLeaderList", ctx, database, collectionName, collectionID, withCache)}
|
|
}
|
|
|
|
func (_c *MockShardClientManager_GetShardLeaderList_Call) Run(run func(ctx context.Context, database string, collectionName string, collectionID int64, withCache bool)) *MockShardClientManager_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 *MockShardClientManager_GetShardLeaderList_Call) Return(_a0 []string, _a1 error) *MockShardClientManager_GetShardLeaderList_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockShardClientManager_GetShardLeaderList_Call) RunAndReturn(run func(context.Context, string, string, int64, bool) ([]string, error)) *MockShardClientManager_GetShardLeaderList_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// InvalidateShardLeaderCache provides a mock function with given fields: collections
|
|
func (_m *MockShardClientManager) InvalidateShardLeaderCache(collections []int64) {
|
|
_m.Called(collections)
|
|
}
|
|
|
|
// MockShardClientManager_InvalidateShardLeaderCache_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InvalidateShardLeaderCache'
|
|
type MockShardClientManager_InvalidateShardLeaderCache_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// InvalidateShardLeaderCache is a helper method to define mock.On call
|
|
// - collections []int64
|
|
func (_e *MockShardClientManager_Expecter) InvalidateShardLeaderCache(collections interface{}) *MockShardClientManager_InvalidateShardLeaderCache_Call {
|
|
return &MockShardClientManager_InvalidateShardLeaderCache_Call{Call: _e.mock.On("InvalidateShardLeaderCache", collections)}
|
|
}
|
|
|
|
func (_c *MockShardClientManager_InvalidateShardLeaderCache_Call) Run(run func(collections []int64)) *MockShardClientManager_InvalidateShardLeaderCache_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].([]int64))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockShardClientManager_InvalidateShardLeaderCache_Call) Return() *MockShardClientManager_InvalidateShardLeaderCache_Call {
|
|
_c.Call.Return()
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockShardClientManager_InvalidateShardLeaderCache_Call) RunAndReturn(run func([]int64)) *MockShardClientManager_InvalidateShardLeaderCache_Call {
|
|
_c.Run(run)
|
|
return _c
|
|
}
|
|
|
|
// ListShardLocation provides a mock function with no fields
|
|
func (_m *MockShardClientManager) ListShardLocation() map[int64]NodeInfo {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ListShardLocation")
|
|
}
|
|
|
|
var r0 map[int64]NodeInfo
|
|
if rf, ok := ret.Get(0).(func() map[int64]NodeInfo); ok {
|
|
r0 = rf()
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(map[int64]NodeInfo)
|
|
}
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// MockShardClientManager_ListShardLocation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListShardLocation'
|
|
type MockShardClientManager_ListShardLocation_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// ListShardLocation is a helper method to define mock.On call
|
|
func (_e *MockShardClientManager_Expecter) ListShardLocation() *MockShardClientManager_ListShardLocation_Call {
|
|
return &MockShardClientManager_ListShardLocation_Call{Call: _e.mock.On("ListShardLocation")}
|
|
}
|
|
|
|
func (_c *MockShardClientManager_ListShardLocation_Call) Run(run func()) *MockShardClientManager_ListShardLocation_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run()
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockShardClientManager_ListShardLocation_Call) Return(_a0 map[int64]NodeInfo) *MockShardClientManager_ListShardLocation_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockShardClientManager_ListShardLocation_Call) RunAndReturn(run func() map[int64]NodeInfo) *MockShardClientManager_ListShardLocation_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// RemoveDatabase provides a mock function with given fields: database
|
|
func (_m *MockShardClientManager) RemoveDatabase(database string) {
|
|
_m.Called(database)
|
|
}
|
|
|
|
// MockShardClientManager_RemoveDatabase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveDatabase'
|
|
type MockShardClientManager_RemoveDatabase_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// RemoveDatabase is a helper method to define mock.On call
|
|
// - database string
|
|
func (_e *MockShardClientManager_Expecter) RemoveDatabase(database interface{}) *MockShardClientManager_RemoveDatabase_Call {
|
|
return &MockShardClientManager_RemoveDatabase_Call{Call: _e.mock.On("RemoveDatabase", database)}
|
|
}
|
|
|
|
func (_c *MockShardClientManager_RemoveDatabase_Call) Run(run func(database string)) *MockShardClientManager_RemoveDatabase_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(string))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockShardClientManager_RemoveDatabase_Call) Return() *MockShardClientManager_RemoveDatabase_Call {
|
|
_c.Call.Return()
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockShardClientManager_RemoveDatabase_Call) RunAndReturn(run func(string)) *MockShardClientManager_RemoveDatabase_Call {
|
|
_c.Run(run)
|
|
return _c
|
|
}
|
|
|
|
// SetClientCreatorFunc provides a mock function with given fields: creator
|
|
func (_m *MockShardClientManager) SetClientCreatorFunc(creator queryNodeCreatorFunc) {
|
|
_m.Called(creator)
|
|
}
|
|
|
|
// MockShardClientManager_SetClientCreatorFunc_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetClientCreatorFunc'
|
|
type MockShardClientManager_SetClientCreatorFunc_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// SetClientCreatorFunc is a helper method to define mock.On call
|
|
// - creator queryNodeCreatorFunc
|
|
func (_e *MockShardClientManager_Expecter) SetClientCreatorFunc(creator interface{}) *MockShardClientManager_SetClientCreatorFunc_Call {
|
|
return &MockShardClientManager_SetClientCreatorFunc_Call{Call: _e.mock.On("SetClientCreatorFunc", creator)}
|
|
}
|
|
|
|
func (_c *MockShardClientManager_SetClientCreatorFunc_Call) Run(run func(creator queryNodeCreatorFunc)) *MockShardClientManager_SetClientCreatorFunc_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(queryNodeCreatorFunc))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockShardClientManager_SetClientCreatorFunc_Call) Return() *MockShardClientManager_SetClientCreatorFunc_Call {
|
|
_c.Call.Return()
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockShardClientManager_SetClientCreatorFunc_Call) RunAndReturn(run func(queryNodeCreatorFunc)) *MockShardClientManager_SetClientCreatorFunc_Call {
|
|
_c.Run(run)
|
|
return _c
|
|
}
|
|
|
|
// Start provides a mock function with no fields
|
|
func (_m *MockShardClientManager) Start() {
|
|
_m.Called()
|
|
}
|
|
|
|
// MockShardClientManager_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start'
|
|
type MockShardClientManager_Start_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Start is a helper method to define mock.On call
|
|
func (_e *MockShardClientManager_Expecter) Start() *MockShardClientManager_Start_Call {
|
|
return &MockShardClientManager_Start_Call{Call: _e.mock.On("Start")}
|
|
}
|
|
|
|
func (_c *MockShardClientManager_Start_Call) Run(run func()) *MockShardClientManager_Start_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run()
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockShardClientManager_Start_Call) Return() *MockShardClientManager_Start_Call {
|
|
_c.Call.Return()
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockShardClientManager_Start_Call) RunAndReturn(run func()) *MockShardClientManager_Start_Call {
|
|
_c.Run(run)
|
|
return _c
|
|
}
|
|
|
|
// NewMockShardClientManager creates a new instance of MockShardClientManager. 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 NewMockShardClientManager(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *MockShardClientManager {
|
|
mock := &MockShardClientManager{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|