From 1fa9c4814aeffff8c91359755cbb91fe9d13abba Mon Sep 17 00:00:00 2001 From: bigsheeper Date: Sat, 23 Dec 2023 18:30:35 +0800 Subject: [PATCH] add mocker Signed-off-by: bigsheeper --- internal/datanode/importv2/mock_reader.go | 176 ++++++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 internal/datanode/importv2/mock_reader.go diff --git a/internal/datanode/importv2/mock_reader.go b/internal/datanode/importv2/mock_reader.go new file mode 100644 index 0000000000000..ab9fe5a46a81d --- /dev/null +++ b/internal/datanode/importv2/mock_reader.go @@ -0,0 +1,176 @@ +// Code generated by mockery v2.30.1. DO NOT EDIT. + +package importv2 + +import ( + datapb "github.com/milvus-io/milvus/internal/proto/datapb" + mock "github.com/stretchr/testify/mock" + + storage "github.com/milvus-io/milvus/internal/storage" +) + +// MockReader is an autogenerated mock type for the Reader type +type MockReader struct { + mock.Mock +} + +type MockReader_Expecter struct { + mock *mock.Mock +} + +func (_m *MockReader) EXPECT() *MockReader_Expecter { + return &MockReader_Expecter{mock: &_m.Mock} +} + +// Close provides a mock function with given fields: +func (_m *MockReader) Close() { + _m.Called() +} + +// MockReader_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' +type MockReader_Close_Call struct { + *mock.Call +} + +// Close is a helper method to define mock.On call +func (_e *MockReader_Expecter) Close() *MockReader_Close_Call { + return &MockReader_Close_Call{Call: _e.mock.On("Close")} +} + +func (_c *MockReader_Close_Call) Run(run func()) *MockReader_Close_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockReader_Close_Call) Return() *MockReader_Close_Call { + _c.Call.Return() + return _c +} + +func (_c *MockReader_Close_Call) RunAndReturn(run func()) *MockReader_Close_Call { + _c.Call.Return(run) + return _c +} + +// Next provides a mock function with given fields: count +func (_m *MockReader) Next(count int64) (*storage.InsertData, error) { + ret := _m.Called(count) + + var r0 *storage.InsertData + var r1 error + if rf, ok := ret.Get(0).(func(int64) (*storage.InsertData, error)); ok { + return rf(count) + } + if rf, ok := ret.Get(0).(func(int64) *storage.InsertData); ok { + r0 = rf(count) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*storage.InsertData) + } + } + + if rf, ok := ret.Get(1).(func(int64) error); ok { + r1 = rf(count) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockReader_Next_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Next' +type MockReader_Next_Call struct { + *mock.Call +} + +// Next is a helper method to define mock.On call +// - count int64 +func (_e *MockReader_Expecter) Next(count interface{}) *MockReader_Next_Call { + return &MockReader_Next_Call{Call: _e.mock.On("Next", count)} +} + +func (_c *MockReader_Next_Call) Run(run func(count int64)) *MockReader_Next_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(int64)) + }) + return _c +} + +func (_c *MockReader_Next_Call) Return(_a0 *storage.InsertData, _a1 error) *MockReader_Next_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockReader_Next_Call) RunAndReturn(run func(int64) (*storage.InsertData, error)) *MockReader_Next_Call { + _c.Call.Return(run) + return _c +} + +// ReadStats provides a mock function with given fields: +func (_m *MockReader) ReadStats() (*datapb.ImportFileStats, error) { + ret := _m.Called() + + var r0 *datapb.ImportFileStats + var r1 error + if rf, ok := ret.Get(0).(func() (*datapb.ImportFileStats, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() *datapb.ImportFileStats); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*datapb.ImportFileStats) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockReader_ReadStats_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadStats' +type MockReader_ReadStats_Call struct { + *mock.Call +} + +// ReadStats is a helper method to define mock.On call +func (_e *MockReader_Expecter) ReadStats() *MockReader_ReadStats_Call { + return &MockReader_ReadStats_Call{Call: _e.mock.On("ReadStats")} +} + +func (_c *MockReader_ReadStats_Call) Run(run func()) *MockReader_ReadStats_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockReader_ReadStats_Call) Return(_a0 *datapb.ImportFileStats, _a1 error) *MockReader_ReadStats_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockReader_ReadStats_Call) RunAndReturn(run func() (*datapb.ImportFileStats, error)) *MockReader_ReadStats_Call { + _c.Call.Return(run) + return _c +} + +// NewMockReader creates a new instance of MockReader. 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 NewMockReader(t interface { + mock.TestingT + Cleanup(func()) +}) *MockReader { + mock := &MockReader{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +}