-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Use rekor interface instead of concrete implementation so that it can be mocked and tested. - Included the mock for the interfaces that will be used for unit testing the methods that doesn't have test coverage. Signed-off-by: naveensrinivasan <[email protected]>
- Loading branch information
1 parent
02bcbcc
commit 6b39a16
Showing
8 changed files
with
292 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
package pkg | ||
|
||
import ( | ||
reflect "reflect" | ||
|
||
runtime "github.com/go-openapi/runtime" | ||
gomock "github.com/golang/mock/gomock" | ||
entries "github.com/sigstore/rekor/pkg/generated/client/entries" | ||
) | ||
|
||
// MockEntriesClientService is a mock of ClientService interface. | ||
type MockEntriesClientService struct { | ||
ctrl *gomock.Controller | ||
recorder *MockEntriesClientServiceMockRecorder | ||
} | ||
|
||
// MockEntriesClientServiceMockRecorder is the mock recorder for MockEntriesClientService. | ||
type MockEntriesClientServiceMockRecorder struct { | ||
mock *MockEntriesClientService | ||
} | ||
|
||
// NewMockEntriesClientService creates a new mock instance. | ||
func NewMockEntriesClientService(ctrl *gomock.Controller) *MockEntriesClientService { | ||
mock := &MockEntriesClientService{ctrl: ctrl} | ||
mock.recorder = &MockEntriesClientServiceMockRecorder{mock} | ||
return mock | ||
} | ||
|
||
// EXPECT returns an object that allows the caller to indicate expected use. | ||
func (m *MockEntriesClientService) EXPECT() *MockEntriesClientServiceMockRecorder { | ||
return m.recorder | ||
} | ||
|
||
// CreateLogEntry mocks base method. | ||
func (m *MockEntriesClientService) CreateLogEntry(params *entries.CreateLogEntryParams, opts ...entries.ClientOption) (*entries.CreateLogEntryCreated, error) { | ||
m.ctrl.T.Helper() | ||
varargs := []interface{}{params} | ||
for _, a := range opts { | ||
varargs = append(varargs, a) | ||
} | ||
ret := m.ctrl.Call(m, "CreateLogEntry", varargs...) | ||
ret0, _ := ret[0].(*entries.CreateLogEntryCreated) | ||
ret1, _ := ret[1].(error) | ||
return ret0, ret1 | ||
} | ||
|
||
// CreateLogEntry indicates an expected call of CreateLogEntry. | ||
func (mr *MockEntriesClientServiceMockRecorder) CreateLogEntry(params interface{}, opts ...interface{}) *gomock.Call { | ||
mr.mock.ctrl.T.Helper() | ||
varargs := append([]interface{}{params}, opts...) | ||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateLogEntry", reflect.TypeOf((*MockEntriesClientService)(nil).CreateLogEntry), varargs...) | ||
} | ||
|
||
// GetLogEntryByIndex mocks base method. | ||
func (m *MockEntriesClientService) GetLogEntryByIndex(params *entries.GetLogEntryByIndexParams, opts ...entries.ClientOption) (*entries.GetLogEntryByIndexOK, error) { | ||
m.ctrl.T.Helper() | ||
varargs := []interface{}{params} | ||
for _, a := range opts { | ||
varargs = append(varargs, a) | ||
} | ||
ret := m.ctrl.Call(m, "GetLogEntryByIndex", varargs...) | ||
ret0, _ := ret[0].(*entries.GetLogEntryByIndexOK) | ||
ret1, _ := ret[1].(error) | ||
return ret0, ret1 | ||
} | ||
|
||
// GetLogEntryByIndex indicates an expected call of GetLogEntryByIndex. | ||
func (mr *MockEntriesClientServiceMockRecorder) GetLogEntryByIndex(params interface{}, opts ...interface{}) *gomock.Call { | ||
mr.mock.ctrl.T.Helper() | ||
varargs := append([]interface{}{params}, opts...) | ||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLogEntryByIndex", reflect.TypeOf((*MockEntriesClientService)(nil).GetLogEntryByIndex), varargs...) | ||
} | ||
|
||
// GetLogEntryByUUID mocks base method. | ||
func (m *MockEntriesClientService) GetLogEntryByUUID(params *entries.GetLogEntryByUUIDParams, opts ...entries.ClientOption) (*entries.GetLogEntryByUUIDOK, error) { | ||
m.ctrl.T.Helper() | ||
varargs := []interface{}{params} | ||
for _, a := range opts { | ||
varargs = append(varargs, a) | ||
} | ||
ret := m.ctrl.Call(m, "GetLogEntryByUUID", varargs...) | ||
ret0, _ := ret[0].(*entries.GetLogEntryByUUIDOK) | ||
ret1, _ := ret[1].(error) | ||
return ret0, ret1 | ||
} | ||
|
||
// GetLogEntryByUUID indicates an expected call of GetLogEntryByUUID. | ||
func (mr *MockEntriesClientServiceMockRecorder) GetLogEntryByUUID(params interface{}, opts ...interface{}) *gomock.Call { | ||
mr.mock.ctrl.T.Helper() | ||
varargs := append([]interface{}{params}, opts...) | ||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLogEntryByUUID", reflect.TypeOf((*MockEntriesClientService)(nil).GetLogEntryByUUID), varargs...) | ||
} | ||
|
||
// SearchLogQuery mocks base method. | ||
func (m *MockEntriesClientService) SearchLogQuery(params *entries.SearchLogQueryParams, opts ...entries.ClientOption) (*entries.SearchLogQueryOK, error) { | ||
m.ctrl.T.Helper() | ||
varargs := []interface{}{params} | ||
for _, a := range opts { | ||
varargs = append(varargs, a) | ||
} | ||
ret := m.ctrl.Call(m, "SearchLogQuery", varargs...) | ||
ret0, _ := ret[0].(*entries.SearchLogQueryOK) | ||
ret1, _ := ret[1].(error) | ||
return ret0, ret1 | ||
} | ||
|
||
// SearchLogQuery indicates an expected call of SearchLogQuery. | ||
func (mr *MockEntriesClientServiceMockRecorder) SearchLogQuery(params interface{}, opts ...interface{}) *gomock.Call { | ||
mr.mock.ctrl.T.Helper() | ||
varargs := append([]interface{}{params}, opts...) | ||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SearchLogQuery", reflect.TypeOf((*MockEntriesClientService)(nil).SearchLogQuery), varargs...) | ||
} | ||
|
||
// SetTransport mocks base method. | ||
func (m *MockEntriesClientService) SetTransport(transport runtime.ClientTransport) { | ||
m.ctrl.T.Helper() | ||
m.ctrl.Call(m, "SetTransport", transport) | ||
} | ||
|
||
// SetTransport indicates an expected call of SetTransport. | ||
func (mr *MockEntriesClientServiceMockRecorder) SetTransport(transport interface{}) *gomock.Call { | ||
mr.mock.ctrl.T.Helper() | ||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTransport", reflect.TypeOf((*MockEntriesClientService)(nil).SetTransport), transport) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package pkg | ||
|
||
import ( | ||
reflect "reflect" | ||
|
||
runtime "github.com/go-openapi/runtime" | ||
gomock "github.com/golang/mock/gomock" | ||
"github.com/sigstore/rekor/pkg/generated/client/index" | ||
) | ||
|
||
// MockClientService is a mock of ClientService interface. | ||
type MockClientService struct { | ||
ctrl *gomock.Controller | ||
recorder *MockClientServiceMockRecorder | ||
} | ||
|
||
// MockClientServiceMockRecorder is the mock recorder for MockClientService. | ||
type MockClientServiceMockRecorder struct { | ||
mock *MockClientService | ||
} | ||
|
||
// NewMockClientService creates a new mock instance. | ||
func NewMockClientService(ctrl *gomock.Controller) *MockClientService { | ||
mock := &MockClientService{ctrl: ctrl} | ||
mock.recorder = &MockClientServiceMockRecorder{mock} | ||
return mock | ||
} | ||
|
||
// EXPECT returns an object that allows the caller to indicate expected use. | ||
func (m *MockClientService) EXPECT() *MockClientServiceMockRecorder { | ||
return m.recorder | ||
} | ||
|
||
// SearchIndex mocks base method. | ||
func (m *MockClientService) SearchIndex(params *index.SearchIndexParams, opts ...index.ClientOption) (*index.SearchIndexOK, error) { | ||
m.ctrl.T.Helper() | ||
varargs := []interface{}{params} | ||
for _, a := range opts { | ||
varargs = append(varargs, a) | ||
} | ||
ret := m.ctrl.Call(m, "SearchIndex", varargs...) | ||
ret0, _ := ret[0].(*index.SearchIndexOK) | ||
ret1, _ := ret[1].(error) | ||
return ret0, ret1 | ||
} | ||
|
||
// SearchIndex indicates an expected call of SearchIndex. | ||
func (mr *MockClientServiceMockRecorder) SearchIndex(params interface{}, opts ...interface{}) *gomock.Call { | ||
mr.mock.ctrl.T.Helper() | ||
varargs := append([]interface{}{params}, opts...) | ||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SearchIndex", reflect.TypeOf((*MockClientService)(nil).SearchIndex), varargs...) | ||
} | ||
|
||
// SetTransport mocks base method. | ||
func (m *MockClientService) SetTransport(transport runtime.ClientTransport) { | ||
m.ctrl.T.Helper() | ||
m.ctrl.Call(m, "SetTransport", transport) | ||
} | ||
|
||
// SetTransport indicates an expected call of SetTransport. | ||
func (mr *MockClientServiceMockRecorder) SetTransport(transport interface{}) *gomock.Call { | ||
mr.mock.ctrl.T.Helper() | ||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTransport", reflect.TypeOf((*MockClientService)(nil).SetTransport), transport) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package pkg | ||
|
||
import ( | ||
reflect "reflect" | ||
|
||
runtime "github.com/go-openapi/runtime" | ||
gomock "github.com/golang/mock/gomock" | ||
tlog "github.com/sigstore/rekor/pkg/generated/client/tlog" | ||
) | ||
|
||
// MockTlogClientService is a mock of ClientService interface. | ||
type MockTlogClientService struct { | ||
ctrl *gomock.Controller | ||
recorder *MockTlogClientServiceMockRecorder | ||
} | ||
|
||
// MockTlogClientServiceMockRecorder is the mock recorder for MockTlogClientService. | ||
type MockTlogClientServiceMockRecorder struct { | ||
mock *MockTlogClientService | ||
} | ||
|
||
// NewMockTlogClientService creates a new mock instance. | ||
func NewMockTlogClientService(ctrl *gomock.Controller) *MockTlogClientService { | ||
mock := &MockTlogClientService{ctrl: ctrl} | ||
mock.recorder = &MockTlogClientServiceMockRecorder{mock} | ||
return mock | ||
} | ||
|
||
// EXPECT returns an object that allows the caller to indicate expected use. | ||
func (m *MockTlogClientService) EXPECT() *MockTlogClientServiceMockRecorder { | ||
return m.recorder | ||
} | ||
|
||
// GetLogInfo mocks base method. | ||
func (m *MockTlogClientService) GetLogInfo(params *tlog.GetLogInfoParams, opts ...tlog.ClientOption) (*tlog.GetLogInfoOK, error) { | ||
m.ctrl.T.Helper() | ||
varargs := []interface{}{params} | ||
for _, a := range opts { | ||
varargs = append(varargs, a) | ||
} | ||
ret := m.ctrl.Call(m, "GetLogInfo", varargs...) | ||
ret0, _ := ret[0].(*tlog.GetLogInfoOK) | ||
ret1, _ := ret[1].(error) | ||
return ret0, ret1 | ||
} | ||
|
||
// GetLogInfo indicates an expected call of GetLogInfo. | ||
func (mr *MockTlogClientServiceMockRecorder) GetLogInfo(params interface{}, opts ...interface{}) *gomock.Call { | ||
mr.mock.ctrl.T.Helper() | ||
varargs := append([]interface{}{params}, opts...) | ||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLogInfo", reflect.TypeOf((*MockTlogClientService)(nil).GetLogInfo), varargs...) | ||
} | ||
|
||
// GetLogProof mocks base method. | ||
func (m *MockTlogClientService) GetLogProof(params *tlog.GetLogProofParams, opts ...tlog.ClientOption) (*tlog.GetLogProofOK, error) { | ||
m.ctrl.T.Helper() | ||
varargs := []interface{}{params} | ||
for _, a := range opts { | ||
varargs = append(varargs, a) | ||
} | ||
ret := m.ctrl.Call(m, "GetLogProof", varargs...) | ||
ret0, _ := ret[0].(*tlog.GetLogProofOK) | ||
ret1, _ := ret[1].(error) | ||
return ret0, ret1 | ||
} | ||
|
||
// GetLogProof indicates an expected call of GetLogProof. | ||
func (mr *MockTlogClientServiceMockRecorder) GetLogProof(params interface{}, opts ...interface{}) *gomock.Call { | ||
mr.mock.ctrl.T.Helper() | ||
varargs := append([]interface{}{params}, opts...) | ||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLogProof", reflect.TypeOf((*MockTlogClientService)(nil).GetLogProof), varargs...) | ||
} | ||
|
||
// SetTransport mocks base method. | ||
func (m *MockTlogClientService) SetTransport(transport runtime.ClientTransport) { | ||
m.ctrl.T.Helper() | ||
m.ctrl.Call(m, "SetTransport", transport) | ||
} | ||
|
||
// SetTransport indicates an expected call of SetTransport. | ||
func (mr *MockTlogClientServiceMockRecorder) SetTransport(transport interface{}) *gomock.Call { | ||
mr.mock.ctrl.T.Helper() | ||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTransport", reflect.TypeOf((*MockTlogClientService)(nil).SetTransport), transport) | ||
} |
Oops, something went wrong.