-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor - Use interface for rekor #98
Closed
naveensrinivasan
wants to merge
1
commit into
slsa-framework:main
from
naveensrinivasan:naveen/feat/refactor-rekorinterface
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe provide a Makefile target or instructions somewhere on how to regenerate these? |
||
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put generated mocks in a separate package.