github.com/grafana/pyroscope@v1.18.0/pkg/test/mocks/mockpyroscope/mock_push_service.go (about) 1 // Code generated by mockery. DO NOT EDIT. 2 3 package mockpyroscope 4 5 import ( 6 context "context" 7 8 connect "connectrpc.com/connect" 9 10 mock "github.com/stretchr/testify/mock" 11 12 model "github.com/grafana/pyroscope/pkg/distributor/model" 13 14 pushv1 "github.com/grafana/pyroscope/api/gen/proto/go/push/v1" 15 ) 16 17 // MockPushService is an autogenerated mock type for the PushService type 18 type MockPushService struct { 19 mock.Mock 20 } 21 22 type MockPushService_Expecter struct { 23 mock *mock.Mock 24 } 25 26 func (_m *MockPushService) EXPECT() *MockPushService_Expecter { 27 return &MockPushService_Expecter{mock: &_m.Mock} 28 } 29 30 // Push provides a mock function with given fields: ctx, req 31 func (_m *MockPushService) Push(ctx context.Context, req *connect.Request[pushv1.PushRequest]) (*connect.Response[pushv1.PushResponse], error) { 32 ret := _m.Called(ctx, req) 33 34 if len(ret) == 0 { 35 panic("no return value specified for Push") 36 } 37 38 var r0 *connect.Response[pushv1.PushResponse] 39 var r1 error 40 if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[pushv1.PushRequest]) (*connect.Response[pushv1.PushResponse], error)); ok { 41 return rf(ctx, req) 42 } 43 if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[pushv1.PushRequest]) *connect.Response[pushv1.PushResponse]); ok { 44 r0 = rf(ctx, req) 45 } else { 46 if ret.Get(0) != nil { 47 r0 = ret.Get(0).(*connect.Response[pushv1.PushResponse]) 48 } 49 } 50 51 if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[pushv1.PushRequest]) error); ok { 52 r1 = rf(ctx, req) 53 } else { 54 r1 = ret.Error(1) 55 } 56 57 return r0, r1 58 } 59 60 // MockPushService_Push_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Push' 61 type MockPushService_Push_Call struct { 62 *mock.Call 63 } 64 65 // Push is a helper method to define mock.On call 66 // - ctx context.Context 67 // - req *connect.Request[pushv1.PushRequest] 68 func (_e *MockPushService_Expecter) Push(ctx interface{}, req interface{}) *MockPushService_Push_Call { 69 return &MockPushService_Push_Call{Call: _e.mock.On("Push", ctx, req)} 70 } 71 72 func (_c *MockPushService_Push_Call) Run(run func(ctx context.Context, req *connect.Request[pushv1.PushRequest])) *MockPushService_Push_Call { 73 _c.Call.Run(func(args mock.Arguments) { 74 run(args[0].(context.Context), args[1].(*connect.Request[pushv1.PushRequest])) 75 }) 76 return _c 77 } 78 79 func (_c *MockPushService_Push_Call) Return(_a0 *connect.Response[pushv1.PushResponse], _a1 error) *MockPushService_Push_Call { 80 _c.Call.Return(_a0, _a1) 81 return _c 82 } 83 84 func (_c *MockPushService_Push_Call) RunAndReturn(run func(context.Context, *connect.Request[pushv1.PushRequest]) (*connect.Response[pushv1.PushResponse], error)) *MockPushService_Push_Call { 85 _c.Call.Return(run) 86 return _c 87 } 88 89 // PushBatch provides a mock function with given fields: ctx, req 90 func (_m *MockPushService) PushBatch(ctx context.Context, req *model.PushRequest) error { 91 ret := _m.Called(ctx, req) 92 93 if len(ret) == 0 { 94 panic("no return value specified for PushBatch") 95 } 96 97 var r0 error 98 if rf, ok := ret.Get(0).(func(context.Context, *model.PushRequest) error); ok { 99 r0 = rf(ctx, req) 100 } else { 101 r0 = ret.Error(0) 102 } 103 104 return r0 105 } 106 107 // MockPushService_PushBatch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PushBatch' 108 type MockPushService_PushBatch_Call struct { 109 *mock.Call 110 } 111 112 // PushBatch is a helper method to define mock.On call 113 // - ctx context.Context 114 // - req *model.PushRequest 115 func (_e *MockPushService_Expecter) PushBatch(ctx interface{}, req interface{}) *MockPushService_PushBatch_Call { 116 return &MockPushService_PushBatch_Call{Call: _e.mock.On("PushBatch", ctx, req)} 117 } 118 119 func (_c *MockPushService_PushBatch_Call) Run(run func(ctx context.Context, req *model.PushRequest)) *MockPushService_PushBatch_Call { 120 _c.Call.Run(func(args mock.Arguments) { 121 run(args[0].(context.Context), args[1].(*model.PushRequest)) 122 }) 123 return _c 124 } 125 126 func (_c *MockPushService_PushBatch_Call) Return(_a0 error) *MockPushService_PushBatch_Call { 127 _c.Call.Return(_a0) 128 return _c 129 } 130 131 func (_c *MockPushService_PushBatch_Call) RunAndReturn(run func(context.Context, *model.PushRequest) error) *MockPushService_PushBatch_Call { 132 _c.Call.Return(run) 133 return _c 134 } 135 136 // NewMockPushService creates a new instance of MockPushService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. 137 // The first argument is typically a *testing.T value. 138 func NewMockPushService(t interface { 139 mock.TestingT 140 Cleanup(func()) 141 }) *MockPushService { 142 mock := &MockPushService{} 143 mock.Mock.Test(t) 144 145 t.Cleanup(func() { mock.AssertExpectations(t) }) 146 147 return mock 148 }