From 71d080ba3bce52db5633f7db31687e926599712f Mon Sep 17 00:00:00 2001 From: Leonardo Di Donato Date: Tue, 30 Jun 2020 09:35:05 +0000 Subject: [PATCH] update(pkg/api/**/mocks): API mocks (for testing) should be checked in Fixes #46 Co-authored-by: Lorenzo Fontana Signed-off-by: Leonardo Di Donato --- .gitignore | 3 +- pkg/api/outputs/mocks/outputs.go | 337 +++++++++++++++++++++++++++++++ pkg/api/version/mocks/version.go | 56 +++++ 3 files changed, 394 insertions(+), 2 deletions(-) create mode 100644 pkg/api/outputs/mocks/outputs.go create mode 100644 pkg/api/version/mocks/version.go diff --git a/.gitignore b/.gitignore index 235fd85..78aed87 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ vendor/ -**/*.proto -**/mocks \ No newline at end of file +**/*.proto \ No newline at end of file diff --git a/pkg/api/outputs/mocks/outputs.go b/pkg/api/outputs/mocks/outputs.go new file mode 100644 index 0000000..0d921d4 --- /dev/null +++ b/pkg/api/outputs/mocks/outputs.go @@ -0,0 +1,337 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/falcosecurity/client-go/pkg/api/outputs (interfaces: ServiceClient,Service_GetClient,Service_SubClient) + +// Package mock_outputs is a generated GoMock package. +package mock_outputs + +import ( + context "context" + outputs "github.com/falcosecurity/client-go/pkg/api/outputs" + gomock "github.com/golang/mock/gomock" + grpc "google.golang.org/grpc" + metadata "google.golang.org/grpc/metadata" + reflect "reflect" +) + +// MockServiceClient is a mock of ServiceClient interface +type MockServiceClient struct { + ctrl *gomock.Controller + recorder *MockServiceClientMockRecorder +} + +// MockServiceClientMockRecorder is the mock recorder for MockServiceClient +type MockServiceClientMockRecorder struct { + mock *MockServiceClient +} + +// NewMockServiceClient creates a new mock instance +func NewMockServiceClient(ctrl *gomock.Controller) *MockServiceClient { + mock := &MockServiceClient{ctrl: ctrl} + mock.recorder = &MockServiceClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockServiceClient) EXPECT() *MockServiceClientMockRecorder { + return m.recorder +} + +// Get mocks base method +func (m *MockServiceClient) Get(arg0 context.Context, arg1 *outputs.Request, arg2 ...grpc.CallOption) (outputs.Service_GetClient, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "Get", varargs...) + ret0, _ := ret[0].(outputs.Service_GetClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get +func (mr *MockServiceClientMockRecorder) Get(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockServiceClient)(nil).Get), varargs...) +} + +// Sub mocks base method +func (m *MockServiceClient) Sub(arg0 context.Context, arg1 ...grpc.CallOption) (outputs.Service_SubClient, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0} + for _, a := range arg1 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "Sub", varargs...) + ret0, _ := ret[0].(outputs.Service_SubClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Sub indicates an expected call of Sub +func (mr *MockServiceClientMockRecorder) Sub(arg0 interface{}, arg1 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0}, arg1...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Sub", reflect.TypeOf((*MockServiceClient)(nil).Sub), varargs...) +} + +// MockService_GetClient is a mock of Service_GetClient interface +type MockService_GetClient struct { + ctrl *gomock.Controller + recorder *MockService_GetClientMockRecorder +} + +// MockService_GetClientMockRecorder is the mock recorder for MockService_GetClient +type MockService_GetClientMockRecorder struct { + mock *MockService_GetClient +} + +// NewMockService_GetClient creates a new mock instance +func NewMockService_GetClient(ctrl *gomock.Controller) *MockService_GetClient { + mock := &MockService_GetClient{ctrl: ctrl} + mock.recorder = &MockService_GetClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockService_GetClient) EXPECT() *MockService_GetClientMockRecorder { + return m.recorder +} + +// CloseSend mocks base method +func (m *MockService_GetClient) CloseSend() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CloseSend") + ret0, _ := ret[0].(error) + return ret0 +} + +// CloseSend indicates an expected call of CloseSend +func (mr *MockService_GetClientMockRecorder) CloseSend() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*MockService_GetClient)(nil).CloseSend)) +} + +// Context mocks base method +func (m *MockService_GetClient) Context() context.Context { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Context") + ret0, _ := ret[0].(context.Context) + return ret0 +} + +// Context indicates an expected call of Context +func (mr *MockService_GetClientMockRecorder) Context() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockService_GetClient)(nil).Context)) +} + +// Header mocks base method +func (m *MockService_GetClient) Header() (metadata.MD, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Header") + ret0, _ := ret[0].(metadata.MD) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Header indicates an expected call of Header +func (mr *MockService_GetClientMockRecorder) Header() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockService_GetClient)(nil).Header)) +} + +// Recv mocks base method +func (m *MockService_GetClient) Recv() (*outputs.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Recv") + ret0, _ := ret[0].(*outputs.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Recv indicates an expected call of Recv +func (mr *MockService_GetClientMockRecorder) Recv() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockService_GetClient)(nil).Recv)) +} + +// RecvMsg mocks base method +func (m *MockService_GetClient) RecvMsg(arg0 interface{}) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RecvMsg", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// RecvMsg indicates an expected call of RecvMsg +func (mr *MockService_GetClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockService_GetClient)(nil).RecvMsg), arg0) +} + +// SendMsg mocks base method +func (m *MockService_GetClient) SendMsg(arg0 interface{}) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendMsg", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendMsg indicates an expected call of SendMsg +func (mr *MockService_GetClientMockRecorder) SendMsg(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockService_GetClient)(nil).SendMsg), arg0) +} + +// Trailer mocks base method +func (m *MockService_GetClient) Trailer() metadata.MD { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Trailer") + ret0, _ := ret[0].(metadata.MD) + return ret0 +} + +// Trailer indicates an expected call of Trailer +func (mr *MockService_GetClientMockRecorder) Trailer() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockService_GetClient)(nil).Trailer)) +} + +// MockService_SubClient is a mock of Service_SubClient interface +type MockService_SubClient struct { + ctrl *gomock.Controller + recorder *MockService_SubClientMockRecorder +} + +// MockService_SubClientMockRecorder is the mock recorder for MockService_SubClient +type MockService_SubClientMockRecorder struct { + mock *MockService_SubClient +} + +// NewMockService_SubClient creates a new mock instance +func NewMockService_SubClient(ctrl *gomock.Controller) *MockService_SubClient { + mock := &MockService_SubClient{ctrl: ctrl} + mock.recorder = &MockService_SubClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockService_SubClient) EXPECT() *MockService_SubClientMockRecorder { + return m.recorder +} + +// CloseSend mocks base method +func (m *MockService_SubClient) CloseSend() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CloseSend") + ret0, _ := ret[0].(error) + return ret0 +} + +// CloseSend indicates an expected call of CloseSend +func (mr *MockService_SubClientMockRecorder) CloseSend() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*MockService_SubClient)(nil).CloseSend)) +} + +// Context mocks base method +func (m *MockService_SubClient) Context() context.Context { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Context") + ret0, _ := ret[0].(context.Context) + return ret0 +} + +// Context indicates an expected call of Context +func (mr *MockService_SubClientMockRecorder) Context() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockService_SubClient)(nil).Context)) +} + +// Header mocks base method +func (m *MockService_SubClient) Header() (metadata.MD, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Header") + ret0, _ := ret[0].(metadata.MD) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Header indicates an expected call of Header +func (mr *MockService_SubClientMockRecorder) Header() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockService_SubClient)(nil).Header)) +} + +// Recv mocks base method +func (m *MockService_SubClient) Recv() (*outputs.Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Recv") + ret0, _ := ret[0].(*outputs.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Recv indicates an expected call of Recv +func (mr *MockService_SubClientMockRecorder) Recv() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockService_SubClient)(nil).Recv)) +} + +// RecvMsg mocks base method +func (m *MockService_SubClient) RecvMsg(arg0 interface{}) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RecvMsg", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// RecvMsg indicates an expected call of RecvMsg +func (mr *MockService_SubClientMockRecorder) RecvMsg(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockService_SubClient)(nil).RecvMsg), arg0) +} + +// Send mocks base method +func (m *MockService_SubClient) Send(arg0 *outputs.Request) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Send", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Send indicates an expected call of Send +func (mr *MockService_SubClientMockRecorder) Send(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockService_SubClient)(nil).Send), arg0) +} + +// SendMsg mocks base method +func (m *MockService_SubClient) SendMsg(arg0 interface{}) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendMsg", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendMsg indicates an expected call of SendMsg +func (mr *MockService_SubClientMockRecorder) SendMsg(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockService_SubClient)(nil).SendMsg), arg0) +} + +// Trailer mocks base method +func (m *MockService_SubClient) Trailer() metadata.MD { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Trailer") + ret0, _ := ret[0].(metadata.MD) + return ret0 +} + +// Trailer indicates an expected call of Trailer +func (mr *MockService_SubClientMockRecorder) Trailer() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockService_SubClient)(nil).Trailer)) +} diff --git a/pkg/api/version/mocks/version.go b/pkg/api/version/mocks/version.go new file mode 100644 index 0000000..0c09e06 --- /dev/null +++ b/pkg/api/version/mocks/version.go @@ -0,0 +1,56 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/falcosecurity/client-go/pkg/api/version (interfaces: ServiceClient) + +// Package mock_version is a generated GoMock package. +package mock_version + +import ( + context "context" + version "github.com/falcosecurity/client-go/pkg/api/version" + gomock "github.com/golang/mock/gomock" + grpc "google.golang.org/grpc" + reflect "reflect" +) + +// MockServiceClient is a mock of ServiceClient interface +type MockServiceClient struct { + ctrl *gomock.Controller + recorder *MockServiceClientMockRecorder +} + +// MockServiceClientMockRecorder is the mock recorder for MockServiceClient +type MockServiceClientMockRecorder struct { + mock *MockServiceClient +} + +// NewMockServiceClient creates a new mock instance +func NewMockServiceClient(ctrl *gomock.Controller) *MockServiceClient { + mock := &MockServiceClient{ctrl: ctrl} + mock.recorder = &MockServiceClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockServiceClient) EXPECT() *MockServiceClientMockRecorder { + return m.recorder +} + +// Version mocks base method +func (m *MockServiceClient) Version(arg0 context.Context, arg1 *version.Request, arg2 ...grpc.CallOption) (*version.Response, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "Version", varargs...) + ret0, _ := ret[0].(*version.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Version indicates an expected call of Version +func (mr *MockServiceClientMockRecorder) Version(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Version", reflect.TypeOf((*MockServiceClient)(nil).Version), varargs...) +}