github.com/grafana/pyroscope@v1.18.0/pkg/test/mocks/mockqueryfrontend/mock_query_backend.go (about) 1 // Code generated by mockery. DO NOT EDIT. 2 3 package mockqueryfrontend 4 5 import ( 6 context "context" 7 8 mock "github.com/stretchr/testify/mock" 9 10 queryv1 "github.com/grafana/pyroscope/api/gen/proto/go/query/v1" 11 ) 12 13 // MockQueryBackend is an autogenerated mock type for the QueryBackend type 14 type MockQueryBackend struct { 15 mock.Mock 16 } 17 18 type MockQueryBackend_Expecter struct { 19 mock *mock.Mock 20 } 21 22 func (_m *MockQueryBackend) EXPECT() *MockQueryBackend_Expecter { 23 return &MockQueryBackend_Expecter{mock: &_m.Mock} 24 } 25 26 // Invoke provides a mock function with given fields: ctx, req 27 func (_m *MockQueryBackend) Invoke(ctx context.Context, req *queryv1.InvokeRequest) (*queryv1.InvokeResponse, error) { 28 ret := _m.Called(ctx, req) 29 30 if len(ret) == 0 { 31 panic("no return value specified for Invoke") 32 } 33 34 var r0 *queryv1.InvokeResponse 35 var r1 error 36 if rf, ok := ret.Get(0).(func(context.Context, *queryv1.InvokeRequest) (*queryv1.InvokeResponse, error)); ok { 37 return rf(ctx, req) 38 } 39 if rf, ok := ret.Get(0).(func(context.Context, *queryv1.InvokeRequest) *queryv1.InvokeResponse); ok { 40 r0 = rf(ctx, req) 41 } else { 42 if ret.Get(0) != nil { 43 r0 = ret.Get(0).(*queryv1.InvokeResponse) 44 } 45 } 46 47 if rf, ok := ret.Get(1).(func(context.Context, *queryv1.InvokeRequest) error); ok { 48 r1 = rf(ctx, req) 49 } else { 50 r1 = ret.Error(1) 51 } 52 53 return r0, r1 54 } 55 56 // MockQueryBackend_Invoke_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Invoke' 57 type MockQueryBackend_Invoke_Call struct { 58 *mock.Call 59 } 60 61 // Invoke is a helper method to define mock.On call 62 // - ctx context.Context 63 // - req *queryv1.InvokeRequest 64 func (_e *MockQueryBackend_Expecter) Invoke(ctx interface{}, req interface{}) *MockQueryBackend_Invoke_Call { 65 return &MockQueryBackend_Invoke_Call{Call: _e.mock.On("Invoke", ctx, req)} 66 } 67 68 func (_c *MockQueryBackend_Invoke_Call) Run(run func(ctx context.Context, req *queryv1.InvokeRequest)) *MockQueryBackend_Invoke_Call { 69 _c.Call.Run(func(args mock.Arguments) { 70 run(args[0].(context.Context), args[1].(*queryv1.InvokeRequest)) 71 }) 72 return _c 73 } 74 75 func (_c *MockQueryBackend_Invoke_Call) Return(_a0 *queryv1.InvokeResponse, _a1 error) *MockQueryBackend_Invoke_Call { 76 _c.Call.Return(_a0, _a1) 77 return _c 78 } 79 80 func (_c *MockQueryBackend_Invoke_Call) RunAndReturn(run func(context.Context, *queryv1.InvokeRequest) (*queryv1.InvokeResponse, error)) *MockQueryBackend_Invoke_Call { 81 _c.Call.Return(run) 82 return _c 83 } 84 85 // NewMockQueryBackend creates a new instance of MockQueryBackend. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. 86 // The first argument is typically a *testing.T value. 87 func NewMockQueryBackend(t interface { 88 mock.TestingT 89 Cleanup(func()) 90 }) *MockQueryBackend { 91 mock := &MockQueryBackend{} 92 mock.Mock.Test(t) 93 94 t.Cleanup(func() { mock.AssertExpectations(t) }) 95 96 return mock 97 }