diff --git a/internal/mocks/mock_proxy.go b/internal/mocks/mock_proxy.go index ce1e9e1353f3..1186f90632e8 100644 --- a/internal/mocks/mock_proxy.go +++ b/internal/mocks/mock_proxy.go @@ -199,6 +199,61 @@ func (_c *MockProxy_AlterCollection_Call) RunAndReturn(run func(context.Context, return _c } +// AlterIndex provides a mock function with given fields: _a0, _a1 +func (_m *MockProxy) AlterIndex(_a0 context.Context, _a1 *milvuspb.AlterIndexRequest) (*commonpb.Status, error) { + ret := _m.Called(_a0, _a1) + + var r0 *commonpb.Status + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.AlterIndexRequest) (*commonpb.Status, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.AlterIndexRequest) *commonpb.Status); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*commonpb.Status) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.AlterIndexRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockProxy_AlterIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AlterIndex' +type MockProxy_AlterIndex_Call struct { + *mock.Call +} + +// AlterIndex is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *milvuspb.AlterIndexRequest +func (_e *MockProxy_Expecter) AlterIndex(_a0 interface{}, _a1 interface{}) *MockProxy_AlterIndex_Call { + return &MockProxy_AlterIndex_Call{Call: _e.mock.On("AlterIndex", _a0, _a1)} +} + +func (_c *MockProxy_AlterIndex_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.AlterIndexRequest)) *MockProxy_AlterIndex_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.AlterIndexRequest)) + }) + return _c +} + +func (_c *MockProxy_AlterIndex_Call) Return(_a0 *commonpb.Status, _a1 error) *MockProxy_AlterIndex_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockProxy_AlterIndex_Call) RunAndReturn(run func(context.Context, *milvuspb.AlterIndexRequest) (*commonpb.Status, error)) *MockProxy_AlterIndex_Call { + _c.Call.Return(run) + return _c +} + // CalcDistance provides a mock function with given fields: _a0, _a1 func (_m *MockProxy) CalcDistance(_a0 context.Context, _a1 *milvuspb.CalcDistanceRequest) (*milvuspb.CalcDistanceResults, error) { ret := _m.Called(_a0, _a1) @@ -639,11 +694,6 @@ func (_c *MockProxy_CreateIndex_Call) RunAndReturn(run func(context.Context, *mi return _c } -func (_m *MockProxy) AlterIndex(_a0 context.Context, _a1 *milvuspb.AlterIndexRequest) (*commonpb.Status, error) { - // Todo - return nil, nil -} - // CreatePartition provides a mock function with given fields: _a0, _a1 func (_m *MockProxy) CreatePartition(_a0 context.Context, _a1 *milvuspb.CreatePartitionRequest) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) @@ -4560,9 +4610,59 @@ func (_c *MockProxy_Search_Call) RunAndReturn(run func(context.Context, *milvusp return _c } +// SearchV2 provides a mock function with given fields: _a0, _a1 func (_m *MockProxy) SearchV2(_a0 context.Context, _a1 *milvuspb.SearchRequestV2) (*milvuspb.SearchResults, error) { - // Todo - return nil, nil + ret := _m.Called(_a0, _a1) + + var r0 *milvuspb.SearchResults + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.SearchRequestV2) (*milvuspb.SearchResults, error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.SearchRequestV2) *milvuspb.SearchResults); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*milvuspb.SearchResults) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.SearchRequestV2) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockProxy_SearchV2_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SearchV2' +type MockProxy_SearchV2_Call struct { + *mock.Call +} + +// SearchV2 is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *milvuspb.SearchRequestV2 +func (_e *MockProxy_Expecter) SearchV2(_a0 interface{}, _a1 interface{}) *MockProxy_SearchV2_Call { + return &MockProxy_SearchV2_Call{Call: _e.mock.On("SearchV2", _a0, _a1)} +} + +func (_c *MockProxy_SearchV2_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.SearchRequestV2)) *MockProxy_SearchV2_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*milvuspb.SearchRequestV2)) + }) + return _c +} + +func (_c *MockProxy_SearchV2_Call) Return(_a0 *milvuspb.SearchResults, _a1 error) *MockProxy_SearchV2_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockProxy_SearchV2_Call) RunAndReturn(run func(context.Context, *milvuspb.SearchRequestV2) (*milvuspb.SearchResults, error)) *MockProxy_SearchV2_Call { + _c.Call.Return(run) + return _c } // SelectGrant provides a mock function with given fields: _a0, _a1 diff --git a/internal/mocks/mock_rootcoord.go b/internal/mocks/mock_rootcoord.go index 65fe9c8d8835..f222d37dddff 100644 --- a/internal/mocks/mock_rootcoord.go +++ b/internal/mocks/mock_rootcoord.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.38.0. DO NOT EDIT. +// Code generated by mockery v2.32.4. DO NOT EDIT. package mocks @@ -6,6 +6,7 @@ import ( context "context" commonpb "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" + clientv3 "go.etcd.io/etcd/client/v3" internalpb "github.com/milvus-io/milvus/internal/proto/internalpb" @@ -16,9 +17,13 @@ import ( proxypb "github.com/milvus-io/milvus/internal/proto/proxypb" rootcoordpb "github.com/milvus-io/milvus/internal/proto/rootcoordpb" + + txnkv "github.com/tikv/client-go/v2/txnkv" + + types "github.com/milvus-io/milvus/internal/types" ) -// RootCoord is an autogenerated mock type for the RootCoord type +// RootCoord is an autogenerated mock type for the RootCoordComponent type type RootCoord struct { mock.Mock } @@ -35,10 +40,6 @@ func (_m *RootCoord) EXPECT() *RootCoord_Expecter { func (_m *RootCoord) AllocID(_a0 context.Context, _a1 *rootcoordpb.AllocIDRequest) (*rootcoordpb.AllocIDResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for AllocID") - } - var r0 *rootcoordpb.AllocIDResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *rootcoordpb.AllocIDRequest) (*rootcoordpb.AllocIDResponse, error)); ok { @@ -94,10 +95,6 @@ func (_c *RootCoord_AllocID_Call) RunAndReturn(run func(context.Context, *rootco func (_m *RootCoord) AllocTimestamp(_a0 context.Context, _a1 *rootcoordpb.AllocTimestampRequest) (*rootcoordpb.AllocTimestampResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for AllocTimestamp") - } - var r0 *rootcoordpb.AllocTimestampResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *rootcoordpb.AllocTimestampRequest) (*rootcoordpb.AllocTimestampResponse, error)); ok { @@ -153,10 +150,6 @@ func (_c *RootCoord_AllocTimestamp_Call) RunAndReturn(run func(context.Context, func (_m *RootCoord) AlterAlias(_a0 context.Context, _a1 *milvuspb.AlterAliasRequest) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for AlterAlias") - } - var r0 *commonpb.Status var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.AlterAliasRequest) (*commonpb.Status, error)); ok { @@ -212,10 +205,6 @@ func (_c *RootCoord_AlterAlias_Call) RunAndReturn(run func(context.Context, *mil func (_m *RootCoord) AlterCollection(_a0 context.Context, _a1 *milvuspb.AlterCollectionRequest) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for AlterCollection") - } - var r0 *commonpb.Status var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.AlterCollectionRequest) (*commonpb.Status, error)); ok { @@ -271,10 +260,6 @@ func (_c *RootCoord_AlterCollection_Call) RunAndReturn(run func(context.Context, func (_m *RootCoord) CheckHealth(_a0 context.Context, _a1 *milvuspb.CheckHealthRequest) (*milvuspb.CheckHealthResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for CheckHealth") - } - var r0 *milvuspb.CheckHealthResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.CheckHealthRequest) (*milvuspb.CheckHealthResponse, error)); ok { @@ -330,10 +315,6 @@ func (_c *RootCoord_CheckHealth_Call) RunAndReturn(run func(context.Context, *mi func (_m *RootCoord) CreateAlias(_a0 context.Context, _a1 *milvuspb.CreateAliasRequest) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for CreateAlias") - } - var r0 *commonpb.Status var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.CreateAliasRequest) (*commonpb.Status, error)); ok { @@ -389,10 +370,6 @@ func (_c *RootCoord_CreateAlias_Call) RunAndReturn(run func(context.Context, *mi func (_m *RootCoord) CreateCollection(_a0 context.Context, _a1 *milvuspb.CreateCollectionRequest) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for CreateCollection") - } - var r0 *commonpb.Status var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.CreateCollectionRequest) (*commonpb.Status, error)); ok { @@ -448,10 +425,6 @@ func (_c *RootCoord_CreateCollection_Call) RunAndReturn(run func(context.Context func (_m *RootCoord) CreateCredential(_a0 context.Context, _a1 *internalpb.CredentialInfo) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for CreateCredential") - } - var r0 *commonpb.Status var r1 error if rf, ok := ret.Get(0).(func(context.Context, *internalpb.CredentialInfo) (*commonpb.Status, error)); ok { @@ -507,10 +480,6 @@ func (_c *RootCoord_CreateCredential_Call) RunAndReturn(run func(context.Context func (_m *RootCoord) CreateDatabase(_a0 context.Context, _a1 *milvuspb.CreateDatabaseRequest) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for CreateDatabase") - } - var r0 *commonpb.Status var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.CreateDatabaseRequest) (*commonpb.Status, error)); ok { @@ -566,10 +535,6 @@ func (_c *RootCoord_CreateDatabase_Call) RunAndReturn(run func(context.Context, func (_m *RootCoord) CreatePartition(_a0 context.Context, _a1 *milvuspb.CreatePartitionRequest) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for CreatePartition") - } - var r0 *commonpb.Status var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.CreatePartitionRequest) (*commonpb.Status, error)); ok { @@ -625,10 +590,6 @@ func (_c *RootCoord_CreatePartition_Call) RunAndReturn(run func(context.Context, func (_m *RootCoord) CreateRole(_a0 context.Context, _a1 *milvuspb.CreateRoleRequest) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for CreateRole") - } - var r0 *commonpb.Status var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.CreateRoleRequest) (*commonpb.Status, error)); ok { @@ -684,10 +645,6 @@ func (_c *RootCoord_CreateRole_Call) RunAndReturn(run func(context.Context, *mil func (_m *RootCoord) DeleteCredential(_a0 context.Context, _a1 *milvuspb.DeleteCredentialRequest) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for DeleteCredential") - } - var r0 *commonpb.Status var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DeleteCredentialRequest) (*commonpb.Status, error)); ok { @@ -743,10 +700,6 @@ func (_c *RootCoord_DeleteCredential_Call) RunAndReturn(run func(context.Context func (_m *RootCoord) DescribeAlias(_a0 context.Context, _a1 *milvuspb.DescribeAliasRequest) (*milvuspb.DescribeAliasResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for DescribeAlias") - } - var r0 *milvuspb.DescribeAliasResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DescribeAliasRequest) (*milvuspb.DescribeAliasResponse, error)); ok { @@ -802,10 +755,6 @@ func (_c *RootCoord_DescribeAlias_Call) RunAndReturn(run func(context.Context, * func (_m *RootCoord) DescribeCollection(_a0 context.Context, _a1 *milvuspb.DescribeCollectionRequest) (*milvuspb.DescribeCollectionResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for DescribeCollection") - } - var r0 *milvuspb.DescribeCollectionResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DescribeCollectionRequest) (*milvuspb.DescribeCollectionResponse, error)); ok { @@ -861,10 +810,6 @@ func (_c *RootCoord_DescribeCollection_Call) RunAndReturn(run func(context.Conte func (_m *RootCoord) DescribeCollectionInternal(_a0 context.Context, _a1 *milvuspb.DescribeCollectionRequest) (*milvuspb.DescribeCollectionResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for DescribeCollectionInternal") - } - var r0 *milvuspb.DescribeCollectionResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DescribeCollectionRequest) (*milvuspb.DescribeCollectionResponse, error)); ok { @@ -920,10 +865,6 @@ func (_c *RootCoord_DescribeCollectionInternal_Call) RunAndReturn(run func(conte func (_m *RootCoord) DropAlias(_a0 context.Context, _a1 *milvuspb.DropAliasRequest) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for DropAlias") - } - var r0 *commonpb.Status var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DropAliasRequest) (*commonpb.Status, error)); ok { @@ -979,10 +920,6 @@ func (_c *RootCoord_DropAlias_Call) RunAndReturn(run func(context.Context, *milv func (_m *RootCoord) DropCollection(_a0 context.Context, _a1 *milvuspb.DropCollectionRequest) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for DropCollection") - } - var r0 *commonpb.Status var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DropCollectionRequest) (*commonpb.Status, error)); ok { @@ -1038,10 +975,6 @@ func (_c *RootCoord_DropCollection_Call) RunAndReturn(run func(context.Context, func (_m *RootCoord) DropDatabase(_a0 context.Context, _a1 *milvuspb.DropDatabaseRequest) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for DropDatabase") - } - var r0 *commonpb.Status var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DropDatabaseRequest) (*commonpb.Status, error)); ok { @@ -1097,10 +1030,6 @@ func (_c *RootCoord_DropDatabase_Call) RunAndReturn(run func(context.Context, *m func (_m *RootCoord) DropPartition(_a0 context.Context, _a1 *milvuspb.DropPartitionRequest) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for DropPartition") - } - var r0 *commonpb.Status var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DropPartitionRequest) (*commonpb.Status, error)); ok { @@ -1156,10 +1085,6 @@ func (_c *RootCoord_DropPartition_Call) RunAndReturn(run func(context.Context, * func (_m *RootCoord) DropRole(_a0 context.Context, _a1 *milvuspb.DropRoleRequest) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for DropRole") - } - var r0 *commonpb.Status var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.DropRoleRequest) (*commonpb.Status, error)); ok { @@ -1215,10 +1140,6 @@ func (_c *RootCoord_DropRole_Call) RunAndReturn(run func(context.Context, *milvu func (_m *RootCoord) GetComponentStates(_a0 context.Context, _a1 *milvuspb.GetComponentStatesRequest) (*milvuspb.ComponentStates, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for GetComponentStates") - } - var r0 *milvuspb.ComponentStates var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetComponentStatesRequest) (*milvuspb.ComponentStates, error)); ok { @@ -1274,10 +1195,6 @@ func (_c *RootCoord_GetComponentStates_Call) RunAndReturn(run func(context.Conte func (_m *RootCoord) GetCredential(_a0 context.Context, _a1 *rootcoordpb.GetCredentialRequest) (*rootcoordpb.GetCredentialResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for GetCredential") - } - var r0 *rootcoordpb.GetCredentialResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *rootcoordpb.GetCredentialRequest) (*rootcoordpb.GetCredentialResponse, error)); ok { @@ -1333,10 +1250,6 @@ func (_c *RootCoord_GetCredential_Call) RunAndReturn(run func(context.Context, * func (_m *RootCoord) GetImportState(_a0 context.Context, _a1 *milvuspb.GetImportStateRequest) (*milvuspb.GetImportStateResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for GetImportState") - } - var r0 *milvuspb.GetImportStateResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetImportStateRequest) (*milvuspb.GetImportStateResponse, error)); ok { @@ -1388,21 +1301,17 @@ func (_c *RootCoord_GetImportState_Call) RunAndReturn(run func(context.Context, return _c } -// GetMetrics provides a mock function with given fields: _a0, _a1 -func (_m *RootCoord) GetMetrics(_a0 context.Context, _a1 *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error) { - ret := _m.Called(_a0, _a1) - - if len(ret) == 0 { - panic("no return value specified for GetMetrics") - } +// GetMetrics provides a mock function with given fields: ctx, req +func (_m *RootCoord) GetMetrics(ctx context.Context, req *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error) { + ret := _m.Called(ctx, req) var r0 *milvuspb.GetMetricsResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error)); ok { - return rf(_a0, _a1) + return rf(ctx, req) } if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetMetricsRequest) *milvuspb.GetMetricsResponse); ok { - r0 = rf(_a0, _a1) + r0 = rf(ctx, req) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*milvuspb.GetMetricsResponse) @@ -1410,7 +1319,7 @@ func (_m *RootCoord) GetMetrics(_a0 context.Context, _a1 *milvuspb.GetMetricsReq } if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.GetMetricsRequest) error); ok { - r1 = rf(_a0, _a1) + r1 = rf(ctx, req) } else { r1 = ret.Error(1) } @@ -1424,13 +1333,13 @@ type RootCoord_GetMetrics_Call struct { } // GetMetrics is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *milvuspb.GetMetricsRequest -func (_e *RootCoord_Expecter) GetMetrics(_a0 interface{}, _a1 interface{}) *RootCoord_GetMetrics_Call { - return &RootCoord_GetMetrics_Call{Call: _e.mock.On("GetMetrics", _a0, _a1)} +// - ctx context.Context +// - req *milvuspb.GetMetricsRequest +func (_e *RootCoord_Expecter) GetMetrics(ctx interface{}, req interface{}) *RootCoord_GetMetrics_Call { + return &RootCoord_GetMetrics_Call{Call: _e.mock.On("GetMetrics", ctx, req)} } -func (_c *RootCoord_GetMetrics_Call) Run(run func(_a0 context.Context, _a1 *milvuspb.GetMetricsRequest)) *RootCoord_GetMetrics_Call { +func (_c *RootCoord_GetMetrics_Call) Run(run func(ctx context.Context, req *milvuspb.GetMetricsRequest)) *RootCoord_GetMetrics_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(*milvuspb.GetMetricsRequest)) }) @@ -1451,10 +1360,6 @@ func (_c *RootCoord_GetMetrics_Call) RunAndReturn(run func(context.Context, *mil func (_m *RootCoord) GetStatisticsChannel(_a0 context.Context, _a1 *internalpb.GetStatisticsChannelRequest) (*milvuspb.StringResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for GetStatisticsChannel") - } - var r0 *milvuspb.StringResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *internalpb.GetStatisticsChannelRequest) (*milvuspb.StringResponse, error)); ok { @@ -1510,10 +1415,6 @@ func (_c *RootCoord_GetStatisticsChannel_Call) RunAndReturn(run func(context.Con func (_m *RootCoord) GetTimeTickChannel(_a0 context.Context, _a1 *internalpb.GetTimeTickChannelRequest) (*milvuspb.StringResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for GetTimeTickChannel") - } - var r0 *milvuspb.StringResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *internalpb.GetTimeTickChannelRequest) (*milvuspb.StringResponse, error)); ok { @@ -1569,10 +1470,6 @@ func (_c *RootCoord_GetTimeTickChannel_Call) RunAndReturn(run func(context.Conte func (_m *RootCoord) HasCollection(_a0 context.Context, _a1 *milvuspb.HasCollectionRequest) (*milvuspb.BoolResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for HasCollection") - } - var r0 *milvuspb.BoolResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.HasCollectionRequest) (*milvuspb.BoolResponse, error)); ok { @@ -1628,10 +1525,6 @@ func (_c *RootCoord_HasCollection_Call) RunAndReturn(run func(context.Context, * func (_m *RootCoord) HasPartition(_a0 context.Context, _a1 *milvuspb.HasPartitionRequest) (*milvuspb.BoolResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for HasPartition") - } - var r0 *milvuspb.BoolResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.HasPartitionRequest) (*milvuspb.BoolResponse, error)); ok { @@ -1687,10 +1580,6 @@ func (_c *RootCoord_HasPartition_Call) RunAndReturn(run func(context.Context, *m func (_m *RootCoord) Import(_a0 context.Context, _a1 *milvuspb.ImportRequest) (*milvuspb.ImportResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for Import") - } - var r0 *milvuspb.ImportResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ImportRequest) (*milvuspb.ImportResponse, error)); ok { @@ -1746,10 +1635,6 @@ func (_c *RootCoord_Import_Call) RunAndReturn(run func(context.Context, *milvusp func (_m *RootCoord) Init() error { ret := _m.Called() - if len(ret) == 0 { - panic("no return value specified for Init") - } - var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -1791,10 +1676,6 @@ func (_c *RootCoord_Init_Call) RunAndReturn(run func() error) *RootCoord_Init_Ca func (_m *RootCoord) InvalidateCollectionMetaCache(_a0 context.Context, _a1 *proxypb.InvalidateCollMetaCacheRequest) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for InvalidateCollectionMetaCache") - } - var r0 *commonpb.Status var r1 error if rf, ok := ret.Get(0).(func(context.Context, *proxypb.InvalidateCollMetaCacheRequest) (*commonpb.Status, error)); ok { @@ -1850,10 +1731,6 @@ func (_c *RootCoord_InvalidateCollectionMetaCache_Call) RunAndReturn(run func(co func (_m *RootCoord) ListAliases(_a0 context.Context, _a1 *milvuspb.ListAliasesRequest) (*milvuspb.ListAliasesResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for ListAliases") - } - var r0 *milvuspb.ListAliasesResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListAliasesRequest) (*milvuspb.ListAliasesResponse, error)); ok { @@ -1909,10 +1786,6 @@ func (_c *RootCoord_ListAliases_Call) RunAndReturn(run func(context.Context, *mi func (_m *RootCoord) ListCredUsers(_a0 context.Context, _a1 *milvuspb.ListCredUsersRequest) (*milvuspb.ListCredUsersResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for ListCredUsers") - } - var r0 *milvuspb.ListCredUsersResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListCredUsersRequest) (*milvuspb.ListCredUsersResponse, error)); ok { @@ -1968,10 +1841,6 @@ func (_c *RootCoord_ListCredUsers_Call) RunAndReturn(run func(context.Context, * func (_m *RootCoord) ListDatabases(_a0 context.Context, _a1 *milvuspb.ListDatabasesRequest) (*milvuspb.ListDatabasesResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for ListDatabases") - } - var r0 *milvuspb.ListDatabasesResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListDatabasesRequest) (*milvuspb.ListDatabasesResponse, error)); ok { @@ -2027,10 +1896,6 @@ func (_c *RootCoord_ListDatabases_Call) RunAndReturn(run func(context.Context, * func (_m *RootCoord) ListImportTasks(_a0 context.Context, _a1 *milvuspb.ListImportTasksRequest) (*milvuspb.ListImportTasksResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for ListImportTasks") - } - var r0 *milvuspb.ListImportTasksResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ListImportTasksRequest) (*milvuspb.ListImportTasksResponse, error)); ok { @@ -2086,10 +1951,6 @@ func (_c *RootCoord_ListImportTasks_Call) RunAndReturn(run func(context.Context, func (_m *RootCoord) ListPolicy(_a0 context.Context, _a1 *internalpb.ListPolicyRequest) (*internalpb.ListPolicyResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for ListPolicy") - } - var r0 *internalpb.ListPolicyResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *internalpb.ListPolicyRequest) (*internalpb.ListPolicyResponse, error)); ok { @@ -2145,10 +2006,6 @@ func (_c *RootCoord_ListPolicy_Call) RunAndReturn(run func(context.Context, *int func (_m *RootCoord) OperatePrivilege(_a0 context.Context, _a1 *milvuspb.OperatePrivilegeRequest) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for OperatePrivilege") - } - var r0 *commonpb.Status var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.OperatePrivilegeRequest) (*commonpb.Status, error)); ok { @@ -2204,10 +2061,6 @@ func (_c *RootCoord_OperatePrivilege_Call) RunAndReturn(run func(context.Context func (_m *RootCoord) OperateUserRole(_a0 context.Context, _a1 *milvuspb.OperateUserRoleRequest) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for OperateUserRole") - } - var r0 *commonpb.Status var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.OperateUserRoleRequest) (*commonpb.Status, error)); ok { @@ -2263,10 +2116,6 @@ func (_c *RootCoord_OperateUserRole_Call) RunAndReturn(run func(context.Context, func (_m *RootCoord) Register() error { ret := _m.Called() - if len(ret) == 0 { - panic("no return value specified for Register") - } - var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -2308,10 +2157,6 @@ func (_c *RootCoord_Register_Call) RunAndReturn(run func() error) *RootCoord_Reg func (_m *RootCoord) RenameCollection(_a0 context.Context, _a1 *milvuspb.RenameCollectionRequest) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for RenameCollection") - } - var r0 *commonpb.Status var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.RenameCollectionRequest) (*commonpb.Status, error)); ok { @@ -2367,10 +2212,6 @@ func (_c *RootCoord_RenameCollection_Call) RunAndReturn(run func(context.Context func (_m *RootCoord) ReportImport(_a0 context.Context, _a1 *rootcoordpb.ImportResult) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for ReportImport") - } - var r0 *commonpb.Status var r1 error if rf, ok := ret.Get(0).(func(context.Context, *rootcoordpb.ImportResult) (*commonpb.Status, error)); ok { @@ -2426,10 +2267,6 @@ func (_c *RootCoord_ReportImport_Call) RunAndReturn(run func(context.Context, *r func (_m *RootCoord) SelectGrant(_a0 context.Context, _a1 *milvuspb.SelectGrantRequest) (*milvuspb.SelectGrantResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for SelectGrant") - } - var r0 *milvuspb.SelectGrantResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.SelectGrantRequest) (*milvuspb.SelectGrantResponse, error)); ok { @@ -2485,10 +2322,6 @@ func (_c *RootCoord_SelectGrant_Call) RunAndReturn(run func(context.Context, *mi func (_m *RootCoord) SelectRole(_a0 context.Context, _a1 *milvuspb.SelectRoleRequest) (*milvuspb.SelectRoleResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for SelectRole") - } - var r0 *milvuspb.SelectRoleResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.SelectRoleRequest) (*milvuspb.SelectRoleResponse, error)); ok { @@ -2544,10 +2377,6 @@ func (_c *RootCoord_SelectRole_Call) RunAndReturn(run func(context.Context, *mil func (_m *RootCoord) SelectUser(_a0 context.Context, _a1 *milvuspb.SelectUserRequest) (*milvuspb.SelectUserResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for SelectUser") - } - var r0 *milvuspb.SelectUserResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.SelectUserRequest) (*milvuspb.SelectUserResponse, error)); ok { @@ -2599,14 +2428,226 @@ func (_c *RootCoord_SelectUser_Call) RunAndReturn(run func(context.Context, *mil return _c } +// SetAddress provides a mock function with given fields: address +func (_m *RootCoord) SetAddress(address string) { + _m.Called(address) +} + +// RootCoord_SetAddress_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetAddress' +type RootCoord_SetAddress_Call struct { + *mock.Call +} + +// SetAddress is a helper method to define mock.On call +// - address string +func (_e *RootCoord_Expecter) SetAddress(address interface{}) *RootCoord_SetAddress_Call { + return &RootCoord_SetAddress_Call{Call: _e.mock.On("SetAddress", address)} +} + +func (_c *RootCoord_SetAddress_Call) Run(run func(address string)) *RootCoord_SetAddress_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *RootCoord_SetAddress_Call) Return() *RootCoord_SetAddress_Call { + _c.Call.Return() + return _c +} + +func (_c *RootCoord_SetAddress_Call) RunAndReturn(run func(string)) *RootCoord_SetAddress_Call { + _c.Call.Return(run) + return _c +} + +// SetDataCoordClient provides a mock function with given fields: dataCoord +func (_m *RootCoord) SetDataCoordClient(dataCoord types.DataCoordClient) error { + ret := _m.Called(dataCoord) + + var r0 error + if rf, ok := ret.Get(0).(func(types.DataCoordClient) error); ok { + r0 = rf(dataCoord) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// RootCoord_SetDataCoordClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetDataCoordClient' +type RootCoord_SetDataCoordClient_Call struct { + *mock.Call +} + +// SetDataCoordClient is a helper method to define mock.On call +// - dataCoord types.DataCoordClient +func (_e *RootCoord_Expecter) SetDataCoordClient(dataCoord interface{}) *RootCoord_SetDataCoordClient_Call { + return &RootCoord_SetDataCoordClient_Call{Call: _e.mock.On("SetDataCoordClient", dataCoord)} +} + +func (_c *RootCoord_SetDataCoordClient_Call) Run(run func(dataCoord types.DataCoordClient)) *RootCoord_SetDataCoordClient_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.DataCoordClient)) + }) + return _c +} + +func (_c *RootCoord_SetDataCoordClient_Call) Return(_a0 error) *RootCoord_SetDataCoordClient_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *RootCoord_SetDataCoordClient_Call) RunAndReturn(run func(types.DataCoordClient) error) *RootCoord_SetDataCoordClient_Call { + _c.Call.Return(run) + return _c +} + +// SetEtcdClient provides a mock function with given fields: etcdClient +func (_m *RootCoord) SetEtcdClient(etcdClient *clientv3.Client) { + _m.Called(etcdClient) +} + +// RootCoord_SetEtcdClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetEtcdClient' +type RootCoord_SetEtcdClient_Call struct { + *mock.Call +} + +// SetEtcdClient is a helper method to define mock.On call +// - etcdClient *clientv3.Client +func (_e *RootCoord_Expecter) SetEtcdClient(etcdClient interface{}) *RootCoord_SetEtcdClient_Call { + return &RootCoord_SetEtcdClient_Call{Call: _e.mock.On("SetEtcdClient", etcdClient)} +} + +func (_c *RootCoord_SetEtcdClient_Call) Run(run func(etcdClient *clientv3.Client)) *RootCoord_SetEtcdClient_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*clientv3.Client)) + }) + return _c +} + +func (_c *RootCoord_SetEtcdClient_Call) Return() *RootCoord_SetEtcdClient_Call { + _c.Call.Return() + return _c +} + +func (_c *RootCoord_SetEtcdClient_Call) RunAndReturn(run func(*clientv3.Client)) *RootCoord_SetEtcdClient_Call { + _c.Call.Return(run) + return _c +} + +// SetProxyCreator provides a mock function with given fields: _a0 +func (_m *RootCoord) SetProxyCreator(_a0 func(context.Context, string, int64) (types.ProxyClient, error)) { + _m.Called(_a0) +} + +// RootCoord_SetProxyCreator_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetProxyCreator' +type RootCoord_SetProxyCreator_Call struct { + *mock.Call +} + +// SetProxyCreator is a helper method to define mock.On call +// - _a0 func(context.Context , string , int64)(types.ProxyClient , error) +func (_e *RootCoord_Expecter) SetProxyCreator(_a0 interface{}) *RootCoord_SetProxyCreator_Call { + return &RootCoord_SetProxyCreator_Call{Call: _e.mock.On("SetProxyCreator", _a0)} +} + +func (_c *RootCoord_SetProxyCreator_Call) Run(run func(_a0 func(context.Context, string, int64) (types.ProxyClient, error))) *RootCoord_SetProxyCreator_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(func(context.Context, string, int64) (types.ProxyClient, error))) + }) + return _c +} + +func (_c *RootCoord_SetProxyCreator_Call) Return() *RootCoord_SetProxyCreator_Call { + _c.Call.Return() + return _c +} + +func (_c *RootCoord_SetProxyCreator_Call) RunAndReturn(run func(func(context.Context, string, int64) (types.ProxyClient, error))) *RootCoord_SetProxyCreator_Call { + _c.Call.Return(run) + return _c +} + +// SetQueryCoordClient provides a mock function with given fields: queryCoord +func (_m *RootCoord) SetQueryCoordClient(queryCoord types.QueryCoordClient) error { + ret := _m.Called(queryCoord) + + var r0 error + if rf, ok := ret.Get(0).(func(types.QueryCoordClient) error); ok { + r0 = rf(queryCoord) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// RootCoord_SetQueryCoordClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetQueryCoordClient' +type RootCoord_SetQueryCoordClient_Call struct { + *mock.Call +} + +// SetQueryCoordClient is a helper method to define mock.On call +// - queryCoord types.QueryCoordClient +func (_e *RootCoord_Expecter) SetQueryCoordClient(queryCoord interface{}) *RootCoord_SetQueryCoordClient_Call { + return &RootCoord_SetQueryCoordClient_Call{Call: _e.mock.On("SetQueryCoordClient", queryCoord)} +} + +func (_c *RootCoord_SetQueryCoordClient_Call) Run(run func(queryCoord types.QueryCoordClient)) *RootCoord_SetQueryCoordClient_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.QueryCoordClient)) + }) + return _c +} + +func (_c *RootCoord_SetQueryCoordClient_Call) Return(_a0 error) *RootCoord_SetQueryCoordClient_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *RootCoord_SetQueryCoordClient_Call) RunAndReturn(run func(types.QueryCoordClient) error) *RootCoord_SetQueryCoordClient_Call { + _c.Call.Return(run) + return _c +} + +// SetTiKVClient provides a mock function with given fields: client +func (_m *RootCoord) SetTiKVClient(client *txnkv.Client) { + _m.Called(client) +} + +// RootCoord_SetTiKVClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetTiKVClient' +type RootCoord_SetTiKVClient_Call struct { + *mock.Call +} + +// SetTiKVClient is a helper method to define mock.On call +// - client *txnkv.Client +func (_e *RootCoord_Expecter) SetTiKVClient(client interface{}) *RootCoord_SetTiKVClient_Call { + return &RootCoord_SetTiKVClient_Call{Call: _e.mock.On("SetTiKVClient", client)} +} + +func (_c *RootCoord_SetTiKVClient_Call) Run(run func(client *txnkv.Client)) *RootCoord_SetTiKVClient_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*txnkv.Client)) + }) + return _c +} + +func (_c *RootCoord_SetTiKVClient_Call) Return() *RootCoord_SetTiKVClient_Call { + _c.Call.Return() + return _c +} + +func (_c *RootCoord_SetTiKVClient_Call) RunAndReturn(run func(*txnkv.Client)) *RootCoord_SetTiKVClient_Call { + _c.Call.Return(run) + return _c +} + // ShowCollections provides a mock function with given fields: _a0, _a1 func (_m *RootCoord) ShowCollections(_a0 context.Context, _a1 *milvuspb.ShowCollectionsRequest) (*milvuspb.ShowCollectionsResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for ShowCollections") - } - var r0 *milvuspb.ShowCollectionsResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ShowCollectionsRequest) (*milvuspb.ShowCollectionsResponse, error)); ok { @@ -2662,10 +2703,6 @@ func (_c *RootCoord_ShowCollections_Call) RunAndReturn(run func(context.Context, func (_m *RootCoord) ShowConfigurations(_a0 context.Context, _a1 *internalpb.ShowConfigurationsRequest) (*internalpb.ShowConfigurationsResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for ShowConfigurations") - } - var r0 *internalpb.ShowConfigurationsResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *internalpb.ShowConfigurationsRequest) (*internalpb.ShowConfigurationsResponse, error)); ok { @@ -2721,10 +2758,6 @@ func (_c *RootCoord_ShowConfigurations_Call) RunAndReturn(run func(context.Conte func (_m *RootCoord) ShowPartitions(_a0 context.Context, _a1 *milvuspb.ShowPartitionsRequest) (*milvuspb.ShowPartitionsResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for ShowPartitions") - } - var r0 *milvuspb.ShowPartitionsResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ShowPartitionsRequest) (*milvuspb.ShowPartitionsResponse, error)); ok { @@ -2780,10 +2813,6 @@ func (_c *RootCoord_ShowPartitions_Call) RunAndReturn(run func(context.Context, func (_m *RootCoord) ShowPartitionsInternal(_a0 context.Context, _a1 *milvuspb.ShowPartitionsRequest) (*milvuspb.ShowPartitionsResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for ShowPartitionsInternal") - } - var r0 *milvuspb.ShowPartitionsResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ShowPartitionsRequest) (*milvuspb.ShowPartitionsResponse, error)); ok { @@ -2839,10 +2868,6 @@ func (_c *RootCoord_ShowPartitionsInternal_Call) RunAndReturn(run func(context.C func (_m *RootCoord) ShowSegments(_a0 context.Context, _a1 *milvuspb.ShowSegmentsRequest) (*milvuspb.ShowSegmentsResponse, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for ShowSegments") - } - var r0 *milvuspb.ShowSegmentsResponse var r1 error if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.ShowSegmentsRequest) (*milvuspb.ShowSegmentsResponse, error)); ok { @@ -2898,10 +2923,6 @@ func (_c *RootCoord_ShowSegments_Call) RunAndReturn(run func(context.Context, *m func (_m *RootCoord) Start() error { ret := _m.Called() - if len(ret) == 0 { - panic("no return value specified for Start") - } - var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -2943,10 +2964,6 @@ func (_c *RootCoord_Start_Call) RunAndReturn(run func() error) *RootCoord_Start_ func (_m *RootCoord) Stop() error { ret := _m.Called() - if len(ret) == 0 { - panic("no return value specified for Stop") - } - var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -2988,10 +3005,6 @@ func (_c *RootCoord_Stop_Call) RunAndReturn(run func() error) *RootCoord_Stop_Ca func (_m *RootCoord) UpdateChannelTimeTick(_a0 context.Context, _a1 *internalpb.ChannelTimeTickMsg) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for UpdateChannelTimeTick") - } - var r0 *commonpb.Status var r1 error if rf, ok := ret.Get(0).(func(context.Context, *internalpb.ChannelTimeTickMsg) (*commonpb.Status, error)); ok { @@ -3047,10 +3060,6 @@ func (_c *RootCoord_UpdateChannelTimeTick_Call) RunAndReturn(run func(context.Co func (_m *RootCoord) UpdateCredential(_a0 context.Context, _a1 *internalpb.CredentialInfo) (*commonpb.Status, error) { ret := _m.Called(_a0, _a1) - if len(ret) == 0 { - panic("no return value specified for UpdateCredential") - } - var r0 *commonpb.Status var r1 error if rf, ok := ret.Get(0).(func(context.Context, *internalpb.CredentialInfo) (*commonpb.Status, error)); ok { @@ -3102,6 +3111,39 @@ func (_c *RootCoord_UpdateCredential_Call) RunAndReturn(run func(context.Context return _c } +// UpdateStateCode provides a mock function with given fields: _a0 +func (_m *RootCoord) UpdateStateCode(_a0 commonpb.StateCode) { + _m.Called(_a0) +} + +// RootCoord_UpdateStateCode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateStateCode' +type RootCoord_UpdateStateCode_Call struct { + *mock.Call +} + +// UpdateStateCode is a helper method to define mock.On call +// - _a0 commonpb.StateCode +func (_e *RootCoord_Expecter) UpdateStateCode(_a0 interface{}) *RootCoord_UpdateStateCode_Call { + return &RootCoord_UpdateStateCode_Call{Call: _e.mock.On("UpdateStateCode", _a0)} +} + +func (_c *RootCoord_UpdateStateCode_Call) Run(run func(_a0 commonpb.StateCode)) *RootCoord_UpdateStateCode_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(commonpb.StateCode)) + }) + return _c +} + +func (_c *RootCoord_UpdateStateCode_Call) Return() *RootCoord_UpdateStateCode_Call { + _c.Call.Return() + return _c +} + +func (_c *RootCoord_UpdateStateCode_Call) RunAndReturn(run func(commonpb.StateCode)) *RootCoord_UpdateStateCode_Call { + _c.Call.Return(run) + return _c +} + // NewRootCoord creates a new instance of RootCoord. 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 NewRootCoord(t interface { diff --git a/internal/proxy/impl.go b/internal/proxy/impl.go index d7605c33c86e..6450867c26e4 100644 --- a/internal/proxy/impl.go +++ b/internal/proxy/impl.go @@ -4512,6 +4512,22 @@ func (node *Proxy) OperatePrivilege(ctx context.Context, req *milvuspb.OperatePr log.Warn("fail to operate privilege", zap.Error(err)) return merr.Status(err), nil } + relatedPrivileges := util.RelatedPrivileges[util.PrivilegeNameForMetastore(req.Entity.Grantor.Privilege.Name)] + if len(relatedPrivileges) != 0 { + for _, relatedPrivilege := range relatedPrivileges { + relatedReq := proto.Clone(req).(*milvuspb.OperatePrivilegeRequest) + relatedReq.Entity.Grantor.Privilege.Name = util.PrivilegeNameForAPI(relatedPrivilege) + result, err = node.rootCoord.OperatePrivilege(ctx, relatedReq) + if err != nil { + log.Warn("fail to operate related privilege", zap.String("related_privilege", relatedPrivilege), zap.Error(err)) + return merr.Status(err), nil + } + if !merr.Ok(result) { + log.Warn("fail to operate related privilege", zap.String("related_privilege", relatedPrivilege), zap.Any("result", result)) + return result, nil + } + } + } return result, nil } diff --git a/internal/proxy/proxy_test.go b/internal/proxy/proxy_test.go index 610d96b5dbf3..381acb137920 100644 --- a/internal/proxy/proxy_test.go +++ b/internal/proxy/proxy_test.go @@ -53,6 +53,7 @@ import ( grpcquerynode "github.com/milvus-io/milvus/internal/distributed/querynode" grpcrootcoord "github.com/milvus-io/milvus/internal/distributed/rootcoord" rcc "github.com/milvus-io/milvus/internal/distributed/rootcoord/client" + "github.com/milvus-io/milvus/internal/mocks" "github.com/milvus-io/milvus/internal/proto/internalpb" "github.com/milvus-io/milvus/internal/proto/proxypb" "github.com/milvus-io/milvus/internal/proto/querypb" @@ -4614,3 +4615,54 @@ func TestUnhealthProxy_GetIndexStatistics(t *testing.T) { assert.Equal(t, commonpb.ErrorCode_NotReadyServe, resp.GetStatus().GetErrorCode()) }) } + +func TestProxy_RelatedPrivilege(t *testing.T) { + getReq := func() *milvuspb.OperatePrivilegeRequest { + return &milvuspb.OperatePrivilegeRequest{ + Entity: &milvuspb.GrantEntity{ + Role: &milvuspb.RoleEntity{Name: "public"}, + ObjectName: "col1", + Object: &milvuspb.ObjectEntity{Name: commonpb.ObjectType_Collection.String()}, + Grantor: &milvuspb.GrantorEntity{Privilege: &milvuspb.PrivilegeEntity{Name: util.MetaStore2API(commonpb.ObjectPrivilege_PrivilegeLoad.String())}}, + }, + } + } + ctx := GetContext(context.Background(), "root:123456") + + t.Run("related privilege grpc error", func(t *testing.T) { + rootCoord := mocks.NewMockRootCoordClient(t) + proxy := &Proxy{rootCoord: rootCoord} + proxy.UpdateStateCode(commonpb.StateCode_Healthy) + + rootCoord.EXPECT().OperatePrivilege(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, request *milvuspb.OperatePrivilegeRequest, option ...grpc.CallOption) (*commonpb.Status, error) { + privilegeName := request.Entity.Grantor.Privilege.Name + if privilegeName == util.MetaStore2API(commonpb.ObjectPrivilege_PrivilegeLoad.String()) { + return merr.Success(), nil + } + return nil, errors.New("mock grpc error") + }) + + resp, err := proxy.OperatePrivilege(ctx, getReq()) + assert.NoError(t, err) + assert.False(t, merr.Ok(resp)) + }) + + t.Run("related privilege status error", func(t *testing.T) { + rootCoord := mocks.NewMockRootCoordClient(t) + proxy := &Proxy{rootCoord: rootCoord} + proxy.UpdateStateCode(commonpb.StateCode_Healthy) + + rootCoord.EXPECT().OperatePrivilege(mock.Anything, mock.Anything).RunAndReturn(func(ctx context.Context, request *milvuspb.OperatePrivilegeRequest, option ...grpc.CallOption) (*commonpb.Status, error) { + privilegeName := request.Entity.Grantor.Privilege.Name + if privilegeName == util.MetaStore2API(commonpb.ObjectPrivilege_PrivilegeLoad.String()) || + privilegeName == util.MetaStore2API(commonpb.ObjectPrivilege_PrivilegeGetLoadState.String()) { + return merr.Success(), nil + } + return merr.Status(errors.New("mock status error")), nil + }) + + resp, err := proxy.OperatePrivilege(ctx, getReq()) + assert.NoError(t, err) + assert.False(t, merr.Ok(resp)) + }) +} diff --git a/pkg/util/constant.go b/pkg/util/constant.go index 95011d8aca7f..50a6ac318246 100644 --- a/pkg/util/constant.go +++ b/pkg/util/constant.go @@ -142,6 +142,16 @@ var ( MetaStore2API(commonpb.ObjectPrivilege_PrivilegeSelectUser.String()), }, } + + RelatedPrivileges = map[string][]string{ + commonpb.ObjectPrivilege_PrivilegeLoad.String(): { + commonpb.ObjectPrivilege_PrivilegeGetLoadState.String(), + commonpb.ObjectPrivilege_PrivilegeGetLoadingProgress.String(), + }, + commonpb.ObjectPrivilege_PrivilegeFlush.String(): { + commonpb.ObjectPrivilege_PrivilegeGetFlushState.String(), + }, + } ) // StringSet convert array to map for conveniently check if the array contains an element