1
0
mirror of https://codeberg.org/crowci/crow.git synced 2025-04-18 04:44:01 +03:00

refactor: mocking (#38)

- `mockery` can now be run in one call instead of multiple ones
- Use the recommended "packages" approach which will be the new default moving forward
- Enforce consistent naming of mock files
- Remove warnings when invoking `mockery`
- Get rid of *many* linter warnings 🎉️

Reviewed-on: https://codeberg.org/crowci/crow/pulls/38
Co-authored-by: pat-s <patrick.schratz@gmail.com>
Co-committed-by: pat-s <patrick.schratz@gmail.com>
This commit is contained in:
pat-s 2025-02-15 10:23:47 +00:00 committed by Patrick Schratz
parent 7654879f59
commit cecfb22099
105 changed files with 21244 additions and 14969 deletions

View File

@ -9,6 +9,7 @@
"node"
],
"words": [
"Mockwriter",
"javascripts",
"bmatcuk",
"securityscan",

View File

@ -1,2 +1,15 @@
---
disable-version-string: true
with-expecter: true
packages:
codeberg.org/crowci/crow/v3:
config:
recursive: true
inpackage: false
filename: 'mock_{{.InterfaceName}}.go'
dir: '{{.InterfaceDir}}/mocks'
outpkg: '{{.PackageName}}'
mockname: 'Mock{{.InterfaceName}}'
all: true
resolve-type-alias: false
issue-845-fix: true

View File

@ -20,7 +20,7 @@ LDFLAGS := if STATIC_BUILD == "true" { "-s -w -extldflags '-static'" } else { ""
CGO_ENABLED := "1"
HAS_GO := `hash go > /dev/null 2>&1 && echo "GO" || echo "NOGO"`
XGO_VERSION := if HAS_GO == "GO" { "go-1.23.x" } else { "" }
XGO_VERSION := if HAS_GO == "GO" { "go-1.24.x" } else { "" }
CGO_CFLAGS := if HAS_GO == "GO" { `go env CGO_CFLAGS` } else { "" }
### Recipes
@ -42,11 +42,7 @@ generate-openapi: install-tools
CGO_ENABLED=0 go generate cmd/server/openapi.go
mockery: install-tools
cd crow-go/crow && mockery --all
cd pipeline && mockery --all
cd server && mockery --all
cd agent && mockery --all
cd cli && mockery --all
mockery
install-tools:
@hash golangci-lint > /dev/null 2>&1 || go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

View File

@ -0,0 +1,78 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package output
import mock "github.com/stretchr/testify/mock"
// MockFieldFn is an autogenerated mock type for the FieldFn type
type MockFieldFn struct {
mock.Mock
}
type MockFieldFn_Expecter struct {
mock *mock.Mock
}
func (_m *MockFieldFn) EXPECT() *MockFieldFn_Expecter {
return &MockFieldFn_Expecter{mock: &_m.Mock}
}
// Execute provides a mock function with given fields: obj
func (_m *MockFieldFn) Execute(obj any) string {
ret := _m.Called(obj)
if len(ret) == 0 {
panic("no return value specified for Execute")
}
var r0 string
if rf, ok := ret.Get(0).(func(any) string); ok {
r0 = rf(obj)
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// MockFieldFn_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
type MockFieldFn_Execute_Call struct {
*mock.Call
}
// Execute is a helper method to define mock.On call
// - obj any
func (_e *MockFieldFn_Expecter) Execute(obj interface{}) *MockFieldFn_Execute_Call {
return &MockFieldFn_Execute_Call{Call: _e.mock.On("Execute", obj)}
}
func (_c *MockFieldFn_Execute_Call) Run(run func(obj any)) *MockFieldFn_Execute_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(any))
})
return _c
}
func (_c *MockFieldFn_Execute_Call) Return(_a0 string) *MockFieldFn_Execute_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockFieldFn_Execute_Call) RunAndReturn(run func(any) string) *MockFieldFn_Execute_Call {
_c.Call.Return(run)
return _c
}
// NewMockFieldFn creates a new instance of MockFieldFn. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockFieldFn(t interface {
mock.TestingT
Cleanup(func())
}) *MockFieldFn {
mock := &MockFieldFn{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,133 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package output
import mock "github.com/stretchr/testify/mock"
// MockwriterFlusher is an autogenerated mock type for the writerFlusher type
type MockwriterFlusher struct {
mock.Mock
}
type MockwriterFlusher_Expecter struct {
mock *mock.Mock
}
func (_m *MockwriterFlusher) EXPECT() *MockwriterFlusher_Expecter {
return &MockwriterFlusher_Expecter{mock: &_m.Mock}
}
// Flush provides a mock function with no fields
func (_m *MockwriterFlusher) Flush() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Flush")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// MockwriterFlusher_Flush_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Flush'
type MockwriterFlusher_Flush_Call struct {
*mock.Call
}
// Flush is a helper method to define mock.On call
func (_e *MockwriterFlusher_Expecter) Flush() *MockwriterFlusher_Flush_Call {
return &MockwriterFlusher_Flush_Call{Call: _e.mock.On("Flush")}
}
func (_c *MockwriterFlusher_Flush_Call) Run(run func()) *MockwriterFlusher_Flush_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockwriterFlusher_Flush_Call) Return(_a0 error) *MockwriterFlusher_Flush_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockwriterFlusher_Flush_Call) RunAndReturn(run func() error) *MockwriterFlusher_Flush_Call {
_c.Call.Return(run)
return _c
}
// Write provides a mock function with given fields: p
func (_m *MockwriterFlusher) Write(p []byte) (int, error) {
ret := _m.Called(p)
if len(ret) == 0 {
panic("no return value specified for Write")
}
var r0 int
var r1 error
if rf, ok := ret.Get(0).(func([]byte) (int, error)); ok {
return rf(p)
}
if rf, ok := ret.Get(0).(func([]byte) int); ok {
r0 = rf(p)
} else {
r0 = ret.Get(0).(int)
}
if rf, ok := ret.Get(1).(func([]byte) error); ok {
r1 = rf(p)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockwriterFlusher_Write_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Write'
type MockwriterFlusher_Write_Call struct {
*mock.Call
}
// Write is a helper method to define mock.On call
// - p []byte
func (_e *MockwriterFlusher_Expecter) Write(p interface{}) *MockwriterFlusher_Write_Call {
return &MockwriterFlusher_Write_Call{Call: _e.mock.On("Write", p)}
}
func (_c *MockwriterFlusher_Write_Call) Run(run func(p []byte)) *MockwriterFlusher_Write_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].([]byte))
})
return _c
}
func (_c *MockwriterFlusher_Write_Call) Return(n int, err error) *MockwriterFlusher_Write_Call {
_c.Call.Return(n, err)
return _c
}
func (_c *MockwriterFlusher_Write_Call) RunAndReturn(run func([]byte) (int, error)) *MockwriterFlusher_Write_Call {
_c.Call.Return(run)
return _c
}
// NewMockwriterFlusher creates a new instance of MockwriterFlusher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockwriterFlusher(t interface {
mock.TestingT
Cleanup(func())
}) *MockwriterFlusher {
mock := &MockwriterFlusher{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -11,7 +11,7 @@ import (
"github.com/urfave/cli/v3"
"codeberg.org/crowci/crow/v3/crow-go/crow"
"codeberg.org/crowci/crow/v3/crow-go/crow/mocks"
crow_mocks "codeberg.org/crowci/crow/v3/crow-go/crow/mocks"
)
func TestPipelineList(t *testing.T) {
@ -65,7 +65,7 @@ func TestPipelineList(t *testing.T) {
for _, tt := range testtases {
t.Run(tt.name, func(t *testing.T) {
mockClient := mocks.NewClient(t)
mockClient := new(crow_mocks.MockClient)
mockClient.On("PipelineList", mock.Anything, mock.Anything).Return(func(_ int64, opt crow.PipelineListOptions) ([]*crow.Pipeline, error) {
if tt.pipelineErr != nil {
return nil, tt.pipelineErr

View File

@ -11,7 +11,7 @@ import (
"github.com/urfave/cli/v3"
crow "codeberg.org/crowci/crow/v3/crow-go/crow"
"codeberg.org/crowci/crow/v3/crow-go/crow/mocks"
crow_mocks "codeberg.org/crowci/crow/v3/crow-go/crow/mocks"
)
func TestPipelinePurge(t *testing.T) {
@ -76,7 +76,7 @@ func TestPipelinePurge(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
mockClient := mocks.NewClient(t)
mockClient := new(crow_mocks.MockClient)
mockClient.On("RepoLookup", mock.Anything).Maybe().Return(&crow.Repo{ID: tt.repoID}, nil)
mockClient.On("PipelineList", mock.Anything, mock.Anything).Return(func(_ int64, opt crow.PipelineListOptions) ([]*crow.Pipeline, error) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,252 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
context "context"
cli "github.com/urfave/cli/v3"
io "io"
mock "github.com/stretchr/testify/mock"
types "codeberg.org/crowci/crow/v3/pipeline/backend/types"
)
// Backend is an autogenerated mock type for the Backend type
type Backend struct {
mock.Mock
}
// DestroyStep provides a mock function with given fields: ctx, step, taskUUID
func (_m *Backend) DestroyStep(ctx context.Context, step *types.Step, taskUUID string) error {
ret := _m.Called(ctx, step, taskUUID)
if len(ret) == 0 {
panic("no return value specified for DestroyStep")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *types.Step, string) error); ok {
r0 = rf(ctx, step, taskUUID)
} else {
r0 = ret.Error(0)
}
return r0
}
// DestroyWorkflow provides a mock function with given fields: ctx, conf, taskUUID
func (_m *Backend) DestroyWorkflow(ctx context.Context, conf *types.Config, taskUUID string) error {
ret := _m.Called(ctx, conf, taskUUID)
if len(ret) == 0 {
panic("no return value specified for DestroyWorkflow")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *types.Config, string) error); ok {
r0 = rf(ctx, conf, taskUUID)
} else {
r0 = ret.Error(0)
}
return r0
}
// Flags provides a mock function with given fields:
func (_m *Backend) Flags() []cli.Flag {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Flags")
}
var r0 []cli.Flag
if rf, ok := ret.Get(0).(func() []cli.Flag); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]cli.Flag)
}
}
return r0
}
// IsAvailable provides a mock function with given fields: ctx
func (_m *Backend) IsAvailable(ctx context.Context) bool {
ret := _m.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for IsAvailable")
}
var r0 bool
if rf, ok := ret.Get(0).(func(context.Context) bool); ok {
r0 = rf(ctx)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// Load provides a mock function with given fields: ctx
func (_m *Backend) Load(ctx context.Context) (*types.BackendInfo, error) {
ret := _m.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for Load")
}
var r0 *types.BackendInfo
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) (*types.BackendInfo, error)); ok {
return rf(ctx)
}
if rf, ok := ret.Get(0).(func(context.Context) *types.BackendInfo); ok {
r0 = rf(ctx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*types.BackendInfo)
}
}
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
r1 = rf(ctx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Name provides a mock function with given fields:
func (_m *Backend) Name() string {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Name")
}
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// SetupWorkflow provides a mock function with given fields: ctx, conf, taskUUID
func (_m *Backend) SetupWorkflow(ctx context.Context, conf *types.Config, taskUUID string) error {
ret := _m.Called(ctx, conf, taskUUID)
if len(ret) == 0 {
panic("no return value specified for SetupWorkflow")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *types.Config, string) error); ok {
r0 = rf(ctx, conf, taskUUID)
} else {
r0 = ret.Error(0)
}
return r0
}
// StartStep provides a mock function with given fields: ctx, step, taskUUID
func (_m *Backend) StartStep(ctx context.Context, step *types.Step, taskUUID string) error {
ret := _m.Called(ctx, step, taskUUID)
if len(ret) == 0 {
panic("no return value specified for StartStep")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *types.Step, string) error); ok {
r0 = rf(ctx, step, taskUUID)
} else {
r0 = ret.Error(0)
}
return r0
}
// TailStep provides a mock function with given fields: ctx, step, taskUUID
func (_m *Backend) TailStep(ctx context.Context, step *types.Step, taskUUID string) (io.ReadCloser, error) {
ret := _m.Called(ctx, step, taskUUID)
if len(ret) == 0 {
panic("no return value specified for TailStep")
}
var r0 io.ReadCloser
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *types.Step, string) (io.ReadCloser, error)); ok {
return rf(ctx, step, taskUUID)
}
if rf, ok := ret.Get(0).(func(context.Context, *types.Step, string) io.ReadCloser); ok {
r0 = rf(ctx, step, taskUUID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(io.ReadCloser)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *types.Step, string) error); ok {
r1 = rf(ctx, step, taskUUID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// WaitStep provides a mock function with given fields: ctx, step, taskUUID
func (_m *Backend) WaitStep(ctx context.Context, step *types.Step, taskUUID string) (*types.State, error) {
ret := _m.Called(ctx, step, taskUUID)
if len(ret) == 0 {
panic("no return value specified for WaitStep")
}
var r0 *types.State
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *types.Step, string) (*types.State, error)); ok {
return rf(ctx, step, taskUUID)
}
if rf, ok := ret.Get(0).(func(context.Context, *types.Step, string) *types.State); ok {
r0 = rf(ctx, step, taskUUID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*types.State)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *types.Step, string) error); ok {
r1 = rf(ctx, step, taskUUID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewBackend creates a new instance of Backend. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewBackend(t interface {
mock.TestingT
Cleanup(func())
}) *Backend {
mock := &Backend{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,550 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package types
import (
context "context"
cli "github.com/urfave/cli/v3"
io "io"
mock "github.com/stretchr/testify/mock"
types "codeberg.org/crowci/crow/v3/pipeline/backend/types"
)
// MockBackend is an autogenerated mock type for the Backend type
type MockBackend struct {
mock.Mock
}
type MockBackend_Expecter struct {
mock *mock.Mock
}
func (_m *MockBackend) EXPECT() *MockBackend_Expecter {
return &MockBackend_Expecter{mock: &_m.Mock}
}
// DestroyStep provides a mock function with given fields: ctx, step, taskUUID
func (_m *MockBackend) DestroyStep(ctx context.Context, step *types.Step, taskUUID string) error {
ret := _m.Called(ctx, step, taskUUID)
if len(ret) == 0 {
panic("no return value specified for DestroyStep")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *types.Step, string) error); ok {
r0 = rf(ctx, step, taskUUID)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockBackend_DestroyStep_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DestroyStep'
type MockBackend_DestroyStep_Call struct {
*mock.Call
}
// DestroyStep is a helper method to define mock.On call
// - ctx context.Context
// - step *types.Step
// - taskUUID string
func (_e *MockBackend_Expecter) DestroyStep(ctx interface{}, step interface{}, taskUUID interface{}) *MockBackend_DestroyStep_Call {
return &MockBackend_DestroyStep_Call{Call: _e.mock.On("DestroyStep", ctx, step, taskUUID)}
}
func (_c *MockBackend_DestroyStep_Call) Run(run func(ctx context.Context, step *types.Step, taskUUID string)) *MockBackend_DestroyStep_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*types.Step), args[2].(string))
})
return _c
}
func (_c *MockBackend_DestroyStep_Call) Return(_a0 error) *MockBackend_DestroyStep_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockBackend_DestroyStep_Call) RunAndReturn(run func(context.Context, *types.Step, string) error) *MockBackend_DestroyStep_Call {
_c.Call.Return(run)
return _c
}
// DestroyWorkflow provides a mock function with given fields: ctx, conf, taskUUID
func (_m *MockBackend) DestroyWorkflow(ctx context.Context, conf *types.Config, taskUUID string) error {
ret := _m.Called(ctx, conf, taskUUID)
if len(ret) == 0 {
panic("no return value specified for DestroyWorkflow")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *types.Config, string) error); ok {
r0 = rf(ctx, conf, taskUUID)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockBackend_DestroyWorkflow_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DestroyWorkflow'
type MockBackend_DestroyWorkflow_Call struct {
*mock.Call
}
// DestroyWorkflow is a helper method to define mock.On call
// - ctx context.Context
// - conf *types.Config
// - taskUUID string
func (_e *MockBackend_Expecter) DestroyWorkflow(ctx interface{}, conf interface{}, taskUUID interface{}) *MockBackend_DestroyWorkflow_Call {
return &MockBackend_DestroyWorkflow_Call{Call: _e.mock.On("DestroyWorkflow", ctx, conf, taskUUID)}
}
func (_c *MockBackend_DestroyWorkflow_Call) Run(run func(ctx context.Context, conf *types.Config, taskUUID string)) *MockBackend_DestroyWorkflow_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*types.Config), args[2].(string))
})
return _c
}
func (_c *MockBackend_DestroyWorkflow_Call) Return(_a0 error) *MockBackend_DestroyWorkflow_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockBackend_DestroyWorkflow_Call) RunAndReturn(run func(context.Context, *types.Config, string) error) *MockBackend_DestroyWorkflow_Call {
_c.Call.Return(run)
return _c
}
// Flags provides a mock function with no fields
func (_m *MockBackend) Flags() []cli.Flag {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Flags")
}
var r0 []cli.Flag
if rf, ok := ret.Get(0).(func() []cli.Flag); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]cli.Flag)
}
}
return r0
}
// MockBackend_Flags_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Flags'
type MockBackend_Flags_Call struct {
*mock.Call
}
// Flags is a helper method to define mock.On call
func (_e *MockBackend_Expecter) Flags() *MockBackend_Flags_Call {
return &MockBackend_Flags_Call{Call: _e.mock.On("Flags")}
}
func (_c *MockBackend_Flags_Call) Run(run func()) *MockBackend_Flags_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockBackend_Flags_Call) Return(_a0 []cli.Flag) *MockBackend_Flags_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockBackend_Flags_Call) RunAndReturn(run func() []cli.Flag) *MockBackend_Flags_Call {
_c.Call.Return(run)
return _c
}
// IsAvailable provides a mock function with given fields: ctx
func (_m *MockBackend) IsAvailable(ctx context.Context) bool {
ret := _m.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for IsAvailable")
}
var r0 bool
if rf, ok := ret.Get(0).(func(context.Context) bool); ok {
r0 = rf(ctx)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// MockBackend_IsAvailable_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsAvailable'
type MockBackend_IsAvailable_Call struct {
*mock.Call
}
// IsAvailable is a helper method to define mock.On call
// - ctx context.Context
func (_e *MockBackend_Expecter) IsAvailable(ctx interface{}) *MockBackend_IsAvailable_Call {
return &MockBackend_IsAvailable_Call{Call: _e.mock.On("IsAvailable", ctx)}
}
func (_c *MockBackend_IsAvailable_Call) Run(run func(ctx context.Context)) *MockBackend_IsAvailable_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *MockBackend_IsAvailable_Call) Return(_a0 bool) *MockBackend_IsAvailable_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockBackend_IsAvailable_Call) RunAndReturn(run func(context.Context) bool) *MockBackend_IsAvailable_Call {
_c.Call.Return(run)
return _c
}
// Load provides a mock function with given fields: ctx
func (_m *MockBackend) Load(ctx context.Context) (*types.BackendInfo, error) {
ret := _m.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for Load")
}
var r0 *types.BackendInfo
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) (*types.BackendInfo, error)); ok {
return rf(ctx)
}
if rf, ok := ret.Get(0).(func(context.Context) *types.BackendInfo); ok {
r0 = rf(ctx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*types.BackendInfo)
}
}
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
r1 = rf(ctx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockBackend_Load_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Load'
type MockBackend_Load_Call struct {
*mock.Call
}
// Load is a helper method to define mock.On call
// - ctx context.Context
func (_e *MockBackend_Expecter) Load(ctx interface{}) *MockBackend_Load_Call {
return &MockBackend_Load_Call{Call: _e.mock.On("Load", ctx)}
}
func (_c *MockBackend_Load_Call) Run(run func(ctx context.Context)) *MockBackend_Load_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *MockBackend_Load_Call) Return(_a0 *types.BackendInfo, _a1 error) *MockBackend_Load_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockBackend_Load_Call) RunAndReturn(run func(context.Context) (*types.BackendInfo, error)) *MockBackend_Load_Call {
_c.Call.Return(run)
return _c
}
// Name provides a mock function with no fields
func (_m *MockBackend) Name() string {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Name")
}
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// MockBackend_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name'
type MockBackend_Name_Call struct {
*mock.Call
}
// Name is a helper method to define mock.On call
func (_e *MockBackend_Expecter) Name() *MockBackend_Name_Call {
return &MockBackend_Name_Call{Call: _e.mock.On("Name")}
}
func (_c *MockBackend_Name_Call) Run(run func()) *MockBackend_Name_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockBackend_Name_Call) Return(_a0 string) *MockBackend_Name_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockBackend_Name_Call) RunAndReturn(run func() string) *MockBackend_Name_Call {
_c.Call.Return(run)
return _c
}
// SetupWorkflow provides a mock function with given fields: ctx, conf, taskUUID
func (_m *MockBackend) SetupWorkflow(ctx context.Context, conf *types.Config, taskUUID string) error {
ret := _m.Called(ctx, conf, taskUUID)
if len(ret) == 0 {
panic("no return value specified for SetupWorkflow")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *types.Config, string) error); ok {
r0 = rf(ctx, conf, taskUUID)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockBackend_SetupWorkflow_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetupWorkflow'
type MockBackend_SetupWorkflow_Call struct {
*mock.Call
}
// SetupWorkflow is a helper method to define mock.On call
// - ctx context.Context
// - conf *types.Config
// - taskUUID string
func (_e *MockBackend_Expecter) SetupWorkflow(ctx interface{}, conf interface{}, taskUUID interface{}) *MockBackend_SetupWorkflow_Call {
return &MockBackend_SetupWorkflow_Call{Call: _e.mock.On("SetupWorkflow", ctx, conf, taskUUID)}
}
func (_c *MockBackend_SetupWorkflow_Call) Run(run func(ctx context.Context, conf *types.Config, taskUUID string)) *MockBackend_SetupWorkflow_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*types.Config), args[2].(string))
})
return _c
}
func (_c *MockBackend_SetupWorkflow_Call) Return(_a0 error) *MockBackend_SetupWorkflow_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockBackend_SetupWorkflow_Call) RunAndReturn(run func(context.Context, *types.Config, string) error) *MockBackend_SetupWorkflow_Call {
_c.Call.Return(run)
return _c
}
// StartStep provides a mock function with given fields: ctx, step, taskUUID
func (_m *MockBackend) StartStep(ctx context.Context, step *types.Step, taskUUID string) error {
ret := _m.Called(ctx, step, taskUUID)
if len(ret) == 0 {
panic("no return value specified for StartStep")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *types.Step, string) error); ok {
r0 = rf(ctx, step, taskUUID)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockBackend_StartStep_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartStep'
type MockBackend_StartStep_Call struct {
*mock.Call
}
// StartStep is a helper method to define mock.On call
// - ctx context.Context
// - step *types.Step
// - taskUUID string
func (_e *MockBackend_Expecter) StartStep(ctx interface{}, step interface{}, taskUUID interface{}) *MockBackend_StartStep_Call {
return &MockBackend_StartStep_Call{Call: _e.mock.On("StartStep", ctx, step, taskUUID)}
}
func (_c *MockBackend_StartStep_Call) Run(run func(ctx context.Context, step *types.Step, taskUUID string)) *MockBackend_StartStep_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*types.Step), args[2].(string))
})
return _c
}
func (_c *MockBackend_StartStep_Call) Return(_a0 error) *MockBackend_StartStep_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockBackend_StartStep_Call) RunAndReturn(run func(context.Context, *types.Step, string) error) *MockBackend_StartStep_Call {
_c.Call.Return(run)
return _c
}
// TailStep provides a mock function with given fields: ctx, step, taskUUID
func (_m *MockBackend) TailStep(ctx context.Context, step *types.Step, taskUUID string) (io.ReadCloser, error) {
ret := _m.Called(ctx, step, taskUUID)
if len(ret) == 0 {
panic("no return value specified for TailStep")
}
var r0 io.ReadCloser
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *types.Step, string) (io.ReadCloser, error)); ok {
return rf(ctx, step, taskUUID)
}
if rf, ok := ret.Get(0).(func(context.Context, *types.Step, string) io.ReadCloser); ok {
r0 = rf(ctx, step, taskUUID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(io.ReadCloser)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *types.Step, string) error); ok {
r1 = rf(ctx, step, taskUUID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockBackend_TailStep_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TailStep'
type MockBackend_TailStep_Call struct {
*mock.Call
}
// TailStep is a helper method to define mock.On call
// - ctx context.Context
// - step *types.Step
// - taskUUID string
func (_e *MockBackend_Expecter) TailStep(ctx interface{}, step interface{}, taskUUID interface{}) *MockBackend_TailStep_Call {
return &MockBackend_TailStep_Call{Call: _e.mock.On("TailStep", ctx, step, taskUUID)}
}
func (_c *MockBackend_TailStep_Call) Run(run func(ctx context.Context, step *types.Step, taskUUID string)) *MockBackend_TailStep_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*types.Step), args[2].(string))
})
return _c
}
func (_c *MockBackend_TailStep_Call) Return(_a0 io.ReadCloser, _a1 error) *MockBackend_TailStep_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockBackend_TailStep_Call) RunAndReturn(run func(context.Context, *types.Step, string) (io.ReadCloser, error)) *MockBackend_TailStep_Call {
_c.Call.Return(run)
return _c
}
// WaitStep provides a mock function with given fields: ctx, step, taskUUID
func (_m *MockBackend) WaitStep(ctx context.Context, step *types.Step, taskUUID string) (*types.State, error) {
ret := _m.Called(ctx, step, taskUUID)
if len(ret) == 0 {
panic("no return value specified for WaitStep")
}
var r0 *types.State
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *types.Step, string) (*types.State, error)); ok {
return rf(ctx, step, taskUUID)
}
if rf, ok := ret.Get(0).(func(context.Context, *types.Step, string) *types.State); ok {
r0 = rf(ctx, step, taskUUID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*types.State)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *types.Step, string) error); ok {
r1 = rf(ctx, step, taskUUID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockBackend_WaitStep_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WaitStep'
type MockBackend_WaitStep_Call struct {
*mock.Call
}
// WaitStep is a helper method to define mock.On call
// - ctx context.Context
// - step *types.Step
// - taskUUID string
func (_e *MockBackend_Expecter) WaitStep(ctx interface{}, step interface{}, taskUUID interface{}) *MockBackend_WaitStep_Call {
return &MockBackend_WaitStep_Call{Call: _e.mock.On("WaitStep", ctx, step, taskUUID)}
}
func (_c *MockBackend_WaitStep_Call) Run(run func(ctx context.Context, step *types.Step, taskUUID string)) *MockBackend_WaitStep_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*types.Step), args[2].(string))
})
return _c
}
func (_c *MockBackend_WaitStep_Call) Return(_a0 *types.State, _a1 error) *MockBackend_WaitStep_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockBackend_WaitStep_Call) RunAndReturn(run func(context.Context, *types.Step, string) (*types.State, error)) *MockBackend_WaitStep_Call {
_c.Call.Return(run)
return _c
}
// NewMockBackend creates a new instance of MockBackend. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockBackend(t interface {
mock.TestingT
Cleanup(func())
}) *MockBackend {
mock := &MockBackend{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,122 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package metadata
import mock "github.com/stretchr/testify/mock"
// MockServerForge is an autogenerated mock type for the ServerForge type
type MockServerForge struct {
mock.Mock
}
type MockServerForge_Expecter struct {
mock *mock.Mock
}
func (_m *MockServerForge) EXPECT() *MockServerForge_Expecter {
return &MockServerForge_Expecter{mock: &_m.Mock}
}
// Name provides a mock function with no fields
func (_m *MockServerForge) Name() string {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Name")
}
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// MockServerForge_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name'
type MockServerForge_Name_Call struct {
*mock.Call
}
// Name is a helper method to define mock.On call
func (_e *MockServerForge_Expecter) Name() *MockServerForge_Name_Call {
return &MockServerForge_Name_Call{Call: _e.mock.On("Name")}
}
func (_c *MockServerForge_Name_Call) Run(run func()) *MockServerForge_Name_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockServerForge_Name_Call) Return(_a0 string) *MockServerForge_Name_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockServerForge_Name_Call) RunAndReturn(run func() string) *MockServerForge_Name_Call {
_c.Call.Return(run)
return _c
}
// URL provides a mock function with no fields
func (_m *MockServerForge) URL() string {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for URL")
}
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// MockServerForge_URL_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'URL'
type MockServerForge_URL_Call struct {
*mock.Call
}
// URL is a helper method to define mock.On call
func (_e *MockServerForge_Expecter) URL() *MockServerForge_URL_Call {
return &MockServerForge_URL_Call{Call: _e.mock.On("URL")}
}
func (_c *MockServerForge_URL_Call) Run(run func()) *MockServerForge_URL_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockServerForge_URL_Call) Return(_a0 string) *MockServerForge_URL_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockServerForge_URL_Call) RunAndReturn(run func() string) *MockServerForge_URL_Call {
_c.Call.Return(run)
return _c
}
// NewMockServerForge creates a new instance of MockServerForge. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockServerForge(t interface {
mock.TestingT
Cleanup(func())
}) *MockServerForge {
mock := &MockServerForge{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,68 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package compiler
import (
compiler "codeberg.org/crowci/crow/v3/pipeline/frontend/yaml/compiler"
mock "github.com/stretchr/testify/mock"
)
// MockOption is an autogenerated mock type for the Option type
type MockOption struct {
mock.Mock
}
type MockOption_Expecter struct {
mock *mock.Mock
}
func (_m *MockOption) EXPECT() *MockOption_Expecter {
return &MockOption_Expecter{mock: &_m.Mock}
}
// Execute provides a mock function with given fields: _a0
func (_m *MockOption) Execute(_a0 *compiler.Compiler) {
_m.Called(_a0)
}
// MockOption_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
type MockOption_Execute_Call struct {
*mock.Call
}
// Execute is a helper method to define mock.On call
// - _a0 *compiler.Compiler
func (_e *MockOption_Expecter) Execute(_a0 interface{}) *MockOption_Execute_Call {
return &MockOption_Execute_Call{Call: _e.mock.On("Execute", _a0)}
}
func (_c *MockOption_Execute_Call) Run(run func(_a0 *compiler.Compiler)) *MockOption_Execute_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*compiler.Compiler))
})
return _c
}
func (_c *MockOption_Execute_Call) Return() *MockOption_Execute_Call {
_c.Call.Return()
return _c
}
func (_c *MockOption_Execute_Call) RunAndReturn(run func(*compiler.Compiler)) *MockOption_Execute_Call {
_c.Run(run)
return _c
}
// NewMockOption creates a new instance of MockOption. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockOption(t interface {
mock.TestingT
Cleanup(func())
}) *MockOption {
mock := &MockOption{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,68 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package linter
import (
linter "codeberg.org/crowci/crow/v3/pipeline/frontend/yaml/linter"
mock "github.com/stretchr/testify/mock"
)
// MockOption is an autogenerated mock type for the Option type
type MockOption struct {
mock.Mock
}
type MockOption_Expecter struct {
mock *mock.Mock
}
func (_m *MockOption) EXPECT() *MockOption_Expecter {
return &MockOption_Expecter{mock: &_m.Mock}
}
// Execute provides a mock function with given fields: _a0
func (_m *MockOption) Execute(_a0 *linter.Linter) {
_m.Called(_a0)
}
// MockOption_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
type MockOption_Execute_Call struct {
*mock.Call
}
// Execute is a helper method to define mock.On call
// - _a0 *linter.Linter
func (_e *MockOption_Expecter) Execute(_a0 interface{}) *MockOption_Execute_Call {
return &MockOption_Execute_Call{Call: _e.mock.On("Execute", _a0)}
}
func (_c *MockOption_Execute_Call) Run(run func(_a0 *linter.Linter)) *MockOption_Execute_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*linter.Linter))
})
return _c
}
func (_c *MockOption_Execute_Call) Return() *MockOption_Execute_Call {
_c.Call.Return()
return _c
}
func (_c *MockOption_Execute_Call) RunAndReturn(run func(*linter.Linter)) *MockOption_Execute_Call {
_c.Run(run)
return _c
}
// NewMockOption creates a new instance of MockOption. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockOption(t interface {
mock.TestingT
Cleanup(func())
}) *MockOption {
mock := &MockOption{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -22,11 +22,11 @@ import (
"codeberg.org/crowci/crow/v3/pipeline/log"
"codeberg.org/crowci/crow/v3/pipeline/rpc"
"codeberg.org/crowci/crow/v3/pipeline/rpc/mocks"
rpc_mocks "codeberg.org/crowci/crow/v3/pipeline/rpc/mocks"
)
func TestLineWriter(t *testing.T) {
peer := mocks.NewPeer(t)
peer := new(rpc_mocks.MockPeer)
peer.On("EnqueueLog", mock.Anything)
secrets := []string{"world"}

View File

@ -0,0 +1,85 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package pipeline
import (
io "io"
mock "github.com/stretchr/testify/mock"
types "codeberg.org/crowci/crow/v3/pipeline/backend/types"
)
// MockLogger is an autogenerated mock type for the Logger type
type MockLogger struct {
mock.Mock
}
type MockLogger_Expecter struct {
mock *mock.Mock
}
func (_m *MockLogger) EXPECT() *MockLogger_Expecter {
return &MockLogger_Expecter{mock: &_m.Mock}
}
// Execute provides a mock function with given fields: _a0, _a1
func (_m *MockLogger) Execute(_a0 *types.Step, _a1 io.ReadCloser) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Execute")
}
var r0 error
if rf, ok := ret.Get(0).(func(*types.Step, io.ReadCloser) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockLogger_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
type MockLogger_Execute_Call struct {
*mock.Call
}
// Execute is a helper method to define mock.On call
// - _a0 *types.Step
// - _a1 io.ReadCloser
func (_e *MockLogger_Expecter) Execute(_a0 interface{}, _a1 interface{}) *MockLogger_Execute_Call {
return &MockLogger_Execute_Call{Call: _e.mock.On("Execute", _a0, _a1)}
}
func (_c *MockLogger_Execute_Call) Run(run func(_a0 *types.Step, _a1 io.ReadCloser)) *MockLogger_Execute_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*types.Step), args[1].(io.ReadCloser))
})
return _c
}
func (_c *MockLogger_Execute_Call) Return(_a0 error) *MockLogger_Execute_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockLogger_Execute_Call) RunAndReturn(run func(*types.Step, io.ReadCloser) error) *MockLogger_Execute_Call {
_c.Call.Return(run)
return _c
}
// NewMockLogger creates a new instance of MockLogger. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockLogger(t interface {
mock.TestingT
Cleanup(func())
}) *MockLogger {
mock := &MockLogger{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,68 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package pipeline
import (
pipeline "codeberg.org/crowci/crow/v3/pipeline"
mock "github.com/stretchr/testify/mock"
)
// MockOption is an autogenerated mock type for the Option type
type MockOption struct {
mock.Mock
}
type MockOption_Expecter struct {
mock *mock.Mock
}
func (_m *MockOption) EXPECT() *MockOption_Expecter {
return &MockOption_Expecter{mock: &_m.Mock}
}
// Execute provides a mock function with given fields: _a0
func (_m *MockOption) Execute(_a0 *pipeline.Runtime) {
_m.Called(_a0)
}
// MockOption_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
type MockOption_Execute_Call struct {
*mock.Call
}
// Execute is a helper method to define mock.On call
// - _a0 *pipeline.Runtime
func (_e *MockOption_Expecter) Execute(_a0 interface{}) *MockOption_Execute_Call {
return &MockOption_Execute_Call{Call: _e.mock.On("Execute", _a0)}
}
func (_c *MockOption_Execute_Call) Run(run func(_a0 *pipeline.Runtime)) *MockOption_Execute_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*pipeline.Runtime))
})
return _c
}
func (_c *MockOption_Execute_Call) Return() *MockOption_Execute_Call {
_c.Call.Return()
return _c
}
func (_c *MockOption_Execute_Call) RunAndReturn(run func(*pipeline.Runtime)) *MockOption_Execute_Call {
_c.Run(run)
return _c
}
// NewMockOption creates a new instance of MockOption. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockOption(t interface {
mock.TestingT
Cleanup(func())
}) *MockOption {
mock := &MockOption{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,81 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package pipeline
import (
pipeline "codeberg.org/crowci/crow/v3/pipeline"
mock "github.com/stretchr/testify/mock"
)
// MockTraceFunc is an autogenerated mock type for the TraceFunc type
type MockTraceFunc struct {
mock.Mock
}
type MockTraceFunc_Expecter struct {
mock *mock.Mock
}
func (_m *MockTraceFunc) EXPECT() *MockTraceFunc_Expecter {
return &MockTraceFunc_Expecter{mock: &_m.Mock}
}
// Execute provides a mock function with given fields: _a0
func (_m *MockTraceFunc) Execute(_a0 *pipeline.State) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for Execute")
}
var r0 error
if rf, ok := ret.Get(0).(func(*pipeline.State) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockTraceFunc_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
type MockTraceFunc_Execute_Call struct {
*mock.Call
}
// Execute is a helper method to define mock.On call
// - _a0 *pipeline.State
func (_e *MockTraceFunc_Expecter) Execute(_a0 interface{}) *MockTraceFunc_Execute_Call {
return &MockTraceFunc_Execute_Call{Call: _e.mock.On("Execute", _a0)}
}
func (_c *MockTraceFunc_Execute_Call) Run(run func(_a0 *pipeline.State)) *MockTraceFunc_Execute_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*pipeline.State))
})
return _c
}
func (_c *MockTraceFunc_Execute_Call) Return(_a0 error) *MockTraceFunc_Execute_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockTraceFunc_Execute_Call) RunAndReturn(run func(*pipeline.State) error) *MockTraceFunc_Execute_Call {
_c.Call.Return(run)
return _c
}
// NewMockTraceFunc creates a new instance of MockTraceFunc. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockTraceFunc(t interface {
mock.TestingT
Cleanup(func())
}) *MockTraceFunc {
mock := &MockTraceFunc{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,81 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package pipeline
import (
pipeline "codeberg.org/crowci/crow/v3/pipeline"
mock "github.com/stretchr/testify/mock"
)
// MockTracer is an autogenerated mock type for the Tracer type
type MockTracer struct {
mock.Mock
}
type MockTracer_Expecter struct {
mock *mock.Mock
}
func (_m *MockTracer) EXPECT() *MockTracer_Expecter {
return &MockTracer_Expecter{mock: &_m.Mock}
}
// Trace provides a mock function with given fields: _a0
func (_m *MockTracer) Trace(_a0 *pipeline.State) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for Trace")
}
var r0 error
if rf, ok := ret.Get(0).(func(*pipeline.State) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockTracer_Trace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Trace'
type MockTracer_Trace_Call struct {
*mock.Call
}
// Trace is a helper method to define mock.On call
// - _a0 *pipeline.State
func (_e *MockTracer_Expecter) Trace(_a0 interface{}) *MockTracer_Trace_Call {
return &MockTracer_Trace_Call{Call: _e.mock.On("Trace", _a0)}
}
func (_c *MockTracer_Trace_Call) Run(run func(_a0 *pipeline.State)) *MockTracer_Trace_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*pipeline.State))
})
return _c
}
func (_c *MockTracer_Trace_Call) Return(_a0 error) *MockTracer_Trace_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockTracer_Trace_Call) RunAndReturn(run func(*pipeline.State) error) *MockTracer_Trace_Call {
_c.Call.Return(run)
return _c
}
// NewMockTracer creates a new instance of MockTracer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockTracer(t interface {
mock.TestingT
Cleanup(func())
}) *MockTracer {
mock := &MockTracer{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,69 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
context "context"
grpc "google.golang.org/grpc"
mock "github.com/stretchr/testify/mock"
proto "codeberg.org/crowci/crow/v3/pipeline/rpc/proto"
)
// CrowAuthClient is an autogenerated mock type for the CrowAuthClient type
type CrowAuthClient struct {
mock.Mock
}
// Auth provides a mock function with given fields: ctx, in, opts
func (_m *CrowAuthClient) Auth(ctx context.Context, in *proto.AuthRequest, opts ...grpc.CallOption) (*proto.AuthResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Auth")
}
var r0 *proto.AuthResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.AuthRequest, ...grpc.CallOption) (*proto.AuthResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.AuthRequest, ...grpc.CallOption) *proto.AuthResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.AuthResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.AuthRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewCrowAuthClient creates a new instance of CrowAuthClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewCrowAuthClient(t interface {
mock.TestingT
Cleanup(func())
}) *CrowAuthClient {
mock := &CrowAuthClient{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,64 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
context "context"
proto "codeberg.org/crowci/crow/v3/pipeline/rpc/proto"
mock "github.com/stretchr/testify/mock"
)
// CrowAuthServer is an autogenerated mock type for the CrowAuthServer type
type CrowAuthServer struct {
mock.Mock
}
// Auth provides a mock function with given fields: _a0, _a1
func (_m *CrowAuthServer) Auth(_a0 context.Context, _a1 *proto.AuthRequest) (*proto.AuthResponse, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Auth")
}
var r0 *proto.AuthResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.AuthRequest) (*proto.AuthResponse, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.AuthRequest) *proto.AuthResponse); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.AuthResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.AuthRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// mustEmbedUnimplementedCrowAuthServer provides a mock function with given fields:
func (_m *CrowAuthServer) mustEmbedUnimplementedCrowAuthServer() {
_m.Called()
}
// NewCrowAuthServer creates a new instance of CrowAuthServer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewCrowAuthServer(t interface {
mock.TestingT
Cleanup(func())
}) *CrowAuthServer {
mock := &CrowAuthServer{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,439 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
context "context"
grpc "google.golang.org/grpc"
mock "github.com/stretchr/testify/mock"
proto "codeberg.org/crowci/crow/v3/pipeline/rpc/proto"
)
// CrowClient is an autogenerated mock type for the CrowClient type
type CrowClient struct {
mock.Mock
}
// Done provides a mock function with given fields: ctx, in, opts
func (_m *CrowClient) Done(ctx context.Context, in *proto.DoneRequest, opts ...grpc.CallOption) (*proto.Empty, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Done")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.DoneRequest, ...grpc.CallOption) (*proto.Empty, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.DoneRequest, ...grpc.CallOption) *proto.Empty); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.DoneRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Extend provides a mock function with given fields: ctx, in, opts
func (_m *CrowClient) Extend(ctx context.Context, in *proto.ExtendRequest, opts ...grpc.CallOption) (*proto.Empty, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Extend")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.ExtendRequest, ...grpc.CallOption) (*proto.Empty, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.ExtendRequest, ...grpc.CallOption) *proto.Empty); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.ExtendRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Init provides a mock function with given fields: ctx, in, opts
func (_m *CrowClient) Init(ctx context.Context, in *proto.InitRequest, opts ...grpc.CallOption) (*proto.Empty, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Init")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.InitRequest, ...grpc.CallOption) (*proto.Empty, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.InitRequest, ...grpc.CallOption) *proto.Empty); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.InitRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Log provides a mock function with given fields: ctx, in, opts
func (_m *CrowClient) Log(ctx context.Context, in *proto.LogRequest, opts ...grpc.CallOption) (*proto.Empty, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Log")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.LogRequest, ...grpc.CallOption) (*proto.Empty, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.LogRequest, ...grpc.CallOption) *proto.Empty); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.LogRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Next provides a mock function with given fields: ctx, in, opts
func (_m *CrowClient) Next(ctx context.Context, in *proto.NextRequest, opts ...grpc.CallOption) (*proto.NextResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Next")
}
var r0 *proto.NextResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.NextRequest, ...grpc.CallOption) (*proto.NextResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.NextRequest, ...grpc.CallOption) *proto.NextResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.NextResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.NextRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// RegisterAgent provides a mock function with given fields: ctx, in, opts
func (_m *CrowClient) RegisterAgent(ctx context.Context, in *proto.RegisterAgentRequest, opts ...grpc.CallOption) (*proto.RegisterAgentResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for RegisterAgent")
}
var r0 *proto.RegisterAgentResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.RegisterAgentRequest, ...grpc.CallOption) (*proto.RegisterAgentResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.RegisterAgentRequest, ...grpc.CallOption) *proto.RegisterAgentResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.RegisterAgentResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.RegisterAgentRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ReportHealth provides a mock function with given fields: ctx, in, opts
func (_m *CrowClient) ReportHealth(ctx context.Context, in *proto.ReportHealthRequest, opts ...grpc.CallOption) (*proto.Empty, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for ReportHealth")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.ReportHealthRequest, ...grpc.CallOption) (*proto.Empty, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.ReportHealthRequest, ...grpc.CallOption) *proto.Empty); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.ReportHealthRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UnregisterAgent provides a mock function with given fields: ctx, in, opts
func (_m *CrowClient) UnregisterAgent(ctx context.Context, in *proto.Empty, opts ...grpc.CallOption) (*proto.Empty, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for UnregisterAgent")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.Empty, ...grpc.CallOption) (*proto.Empty, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.Empty, ...grpc.CallOption) *proto.Empty); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.Empty, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Update provides a mock function with given fields: ctx, in, opts
func (_m *CrowClient) Update(ctx context.Context, in *proto.UpdateRequest, opts ...grpc.CallOption) (*proto.Empty, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Update")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.UpdateRequest, ...grpc.CallOption) (*proto.Empty, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.UpdateRequest, ...grpc.CallOption) *proto.Empty); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.UpdateRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Version provides a mock function with given fields: ctx, in, opts
func (_m *CrowClient) Version(ctx context.Context, in *proto.Empty, opts ...grpc.CallOption) (*proto.VersionResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Version")
}
var r0 *proto.VersionResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.Empty, ...grpc.CallOption) (*proto.VersionResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.Empty, ...grpc.CallOption) *proto.VersionResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.VersionResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.Empty, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Wait provides a mock function with given fields: ctx, in, opts
func (_m *CrowClient) Wait(ctx context.Context, in *proto.WaitRequest, opts ...grpc.CallOption) (*proto.Empty, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Wait")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.WaitRequest, ...grpc.CallOption) (*proto.Empty, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.WaitRequest, ...grpc.CallOption) *proto.Empty); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.WaitRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewCrowClient creates a new instance of CrowClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewCrowClient(t interface {
mock.TestingT
Cleanup(func())
}) *CrowClient {
mock := &CrowClient{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,364 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
context "context"
proto "codeberg.org/crowci/crow/v3/pipeline/rpc/proto"
mock "github.com/stretchr/testify/mock"
)
// CrowServer is an autogenerated mock type for the CrowServer type
type CrowServer struct {
mock.Mock
}
// Done provides a mock function with given fields: _a0, _a1
func (_m *CrowServer) Done(_a0 context.Context, _a1 *proto.DoneRequest) (*proto.Empty, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Done")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.DoneRequest) (*proto.Empty, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.DoneRequest) *proto.Empty); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.DoneRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Extend provides a mock function with given fields: _a0, _a1
func (_m *CrowServer) Extend(_a0 context.Context, _a1 *proto.ExtendRequest) (*proto.Empty, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Extend")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.ExtendRequest) (*proto.Empty, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.ExtendRequest) *proto.Empty); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.ExtendRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Init provides a mock function with given fields: _a0, _a1
func (_m *CrowServer) Init(_a0 context.Context, _a1 *proto.InitRequest) (*proto.Empty, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Init")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.InitRequest) (*proto.Empty, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.InitRequest) *proto.Empty); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.InitRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Log provides a mock function with given fields: _a0, _a1
func (_m *CrowServer) Log(_a0 context.Context, _a1 *proto.LogRequest) (*proto.Empty, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Log")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.LogRequest) (*proto.Empty, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.LogRequest) *proto.Empty); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.LogRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Next provides a mock function with given fields: _a0, _a1
func (_m *CrowServer) Next(_a0 context.Context, _a1 *proto.NextRequest) (*proto.NextResponse, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Next")
}
var r0 *proto.NextResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.NextRequest) (*proto.NextResponse, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.NextRequest) *proto.NextResponse); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.NextResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.NextRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// RegisterAgent provides a mock function with given fields: _a0, _a1
func (_m *CrowServer) RegisterAgent(_a0 context.Context, _a1 *proto.RegisterAgentRequest) (*proto.RegisterAgentResponse, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for RegisterAgent")
}
var r0 *proto.RegisterAgentResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.RegisterAgentRequest) (*proto.RegisterAgentResponse, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.RegisterAgentRequest) *proto.RegisterAgentResponse); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.RegisterAgentResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.RegisterAgentRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ReportHealth provides a mock function with given fields: _a0, _a1
func (_m *CrowServer) ReportHealth(_a0 context.Context, _a1 *proto.ReportHealthRequest) (*proto.Empty, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for ReportHealth")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.ReportHealthRequest) (*proto.Empty, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.ReportHealthRequest) *proto.Empty); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.ReportHealthRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UnregisterAgent provides a mock function with given fields: _a0, _a1
func (_m *CrowServer) UnregisterAgent(_a0 context.Context, _a1 *proto.Empty) (*proto.Empty, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for UnregisterAgent")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.Empty) (*proto.Empty, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.Empty) *proto.Empty); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.Empty) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Update provides a mock function with given fields: _a0, _a1
func (_m *CrowServer) Update(_a0 context.Context, _a1 *proto.UpdateRequest) (*proto.Empty, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Update")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.UpdateRequest) (*proto.Empty, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.UpdateRequest) *proto.Empty); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.UpdateRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Version provides a mock function with given fields: _a0, _a1
func (_m *CrowServer) Version(_a0 context.Context, _a1 *proto.Empty) (*proto.VersionResponse, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Version")
}
var r0 *proto.VersionResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.Empty) (*proto.VersionResponse, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.Empty) *proto.VersionResponse); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.VersionResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.Empty) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Wait provides a mock function with given fields: _a0, _a1
func (_m *CrowServer) Wait(_a0 context.Context, _a1 *proto.WaitRequest) (*proto.Empty, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Wait")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.WaitRequest) (*proto.Empty, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.WaitRequest) *proto.Empty); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.WaitRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// mustEmbedUnimplementedCrowServer provides a mock function with given fields:
func (_m *CrowServer) mustEmbedUnimplementedCrowServer() {
_m.Called()
}
// NewCrowServer creates a new instance of CrowServer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewCrowServer(t interface {
mock.TestingT
Cleanup(func())
}) *CrowServer {
mock := &CrowServer{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,29 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import mock "github.com/stretchr/testify/mock"
// UnsafeCrowAuthServer is an autogenerated mock type for the UnsafeCrowAuthServer type
type UnsafeCrowAuthServer struct {
mock.Mock
}
// mustEmbedUnimplementedCrowAuthServer provides a mock function with given fields:
func (_m *UnsafeCrowAuthServer) mustEmbedUnimplementedCrowAuthServer() {
_m.Called()
}
// NewUnsafeCrowAuthServer creates a new instance of UnsafeCrowAuthServer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewUnsafeCrowAuthServer(t interface {
mock.TestingT
Cleanup(func())
}) *UnsafeCrowAuthServer {
mock := &UnsafeCrowAuthServer{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,29 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import mock "github.com/stretchr/testify/mock"
// UnsafeCrowServer is an autogenerated mock type for the UnsafeCrowServer type
type UnsafeCrowServer struct {
mock.Mock
}
// mustEmbedUnimplementedCrowServer provides a mock function with given fields:
func (_m *UnsafeCrowServer) mustEmbedUnimplementedCrowServer() {
_m.Called()
}
// NewUnsafeCrowServer creates a new instance of UnsafeCrowServer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewUnsafeCrowServer(t interface {
mock.TestingT
Cleanup(func())
}) *UnsafeCrowServer {
mock := &UnsafeCrowServer{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,574 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package rpc
import (
context "context"
rpc "codeberg.org/crowci/crow/v3/pipeline/rpc"
mock "github.com/stretchr/testify/mock"
)
// MockPeer is an autogenerated mock type for the Peer type
type MockPeer struct {
mock.Mock
}
type MockPeer_Expecter struct {
mock *mock.Mock
}
func (_m *MockPeer) EXPECT() *MockPeer_Expecter {
return &MockPeer_Expecter{mock: &_m.Mock}
}
// Done provides a mock function with given fields: c, workflowID, state
func (_m *MockPeer) Done(c context.Context, workflowID string, state rpc.WorkflowState) error {
ret := _m.Called(c, workflowID, state)
if len(ret) == 0 {
panic("no return value specified for Done")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, rpc.WorkflowState) error); ok {
r0 = rf(c, workflowID, state)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockPeer_Done_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Done'
type MockPeer_Done_Call struct {
*mock.Call
}
// Done is a helper method to define mock.On call
// - c context.Context
// - workflowID string
// - state rpc.WorkflowState
func (_e *MockPeer_Expecter) Done(c interface{}, workflowID interface{}, state interface{}) *MockPeer_Done_Call {
return &MockPeer_Done_Call{Call: _e.mock.On("Done", c, workflowID, state)}
}
func (_c *MockPeer_Done_Call) Run(run func(c context.Context, workflowID string, state rpc.WorkflowState)) *MockPeer_Done_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(rpc.WorkflowState))
})
return _c
}
func (_c *MockPeer_Done_Call) Return(_a0 error) *MockPeer_Done_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockPeer_Done_Call) RunAndReturn(run func(context.Context, string, rpc.WorkflowState) error) *MockPeer_Done_Call {
_c.Call.Return(run)
return _c
}
// EnqueueLog provides a mock function with given fields: logEntry
func (_m *MockPeer) EnqueueLog(logEntry *rpc.LogEntry) {
_m.Called(logEntry)
}
// MockPeer_EnqueueLog_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnqueueLog'
type MockPeer_EnqueueLog_Call struct {
*mock.Call
}
// EnqueueLog is a helper method to define mock.On call
// - logEntry *rpc.LogEntry
func (_e *MockPeer_Expecter) EnqueueLog(logEntry interface{}) *MockPeer_EnqueueLog_Call {
return &MockPeer_EnqueueLog_Call{Call: _e.mock.On("EnqueueLog", logEntry)}
}
func (_c *MockPeer_EnqueueLog_Call) Run(run func(logEntry *rpc.LogEntry)) *MockPeer_EnqueueLog_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*rpc.LogEntry))
})
return _c
}
func (_c *MockPeer_EnqueueLog_Call) Return() *MockPeer_EnqueueLog_Call {
_c.Call.Return()
return _c
}
func (_c *MockPeer_EnqueueLog_Call) RunAndReturn(run func(*rpc.LogEntry)) *MockPeer_EnqueueLog_Call {
_c.Run(run)
return _c
}
// Extend provides a mock function with given fields: c, workflowID
func (_m *MockPeer) Extend(c context.Context, workflowID string) error {
ret := _m.Called(c, workflowID)
if len(ret) == 0 {
panic("no return value specified for Extend")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = rf(c, workflowID)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockPeer_Extend_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Extend'
type MockPeer_Extend_Call struct {
*mock.Call
}
// Extend is a helper method to define mock.On call
// - c context.Context
// - workflowID string
func (_e *MockPeer_Expecter) Extend(c interface{}, workflowID interface{}) *MockPeer_Extend_Call {
return &MockPeer_Extend_Call{Call: _e.mock.On("Extend", c, workflowID)}
}
func (_c *MockPeer_Extend_Call) Run(run func(c context.Context, workflowID string)) *MockPeer_Extend_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *MockPeer_Extend_Call) Return(_a0 error) *MockPeer_Extend_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockPeer_Extend_Call) RunAndReturn(run func(context.Context, string) error) *MockPeer_Extend_Call {
_c.Call.Return(run)
return _c
}
// Init provides a mock function with given fields: c, workflowID, state
func (_m *MockPeer) Init(c context.Context, workflowID string, state rpc.WorkflowState) error {
ret := _m.Called(c, workflowID, state)
if len(ret) == 0 {
panic("no return value specified for Init")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, rpc.WorkflowState) error); ok {
r0 = rf(c, workflowID, state)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockPeer_Init_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Init'
type MockPeer_Init_Call struct {
*mock.Call
}
// Init is a helper method to define mock.On call
// - c context.Context
// - workflowID string
// - state rpc.WorkflowState
func (_e *MockPeer_Expecter) Init(c interface{}, workflowID interface{}, state interface{}) *MockPeer_Init_Call {
return &MockPeer_Init_Call{Call: _e.mock.On("Init", c, workflowID, state)}
}
func (_c *MockPeer_Init_Call) Run(run func(c context.Context, workflowID string, state rpc.WorkflowState)) *MockPeer_Init_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(rpc.WorkflowState))
})
return _c
}
func (_c *MockPeer_Init_Call) Return(_a0 error) *MockPeer_Init_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockPeer_Init_Call) RunAndReturn(run func(context.Context, string, rpc.WorkflowState) error) *MockPeer_Init_Call {
_c.Call.Return(run)
return _c
}
// Next provides a mock function with given fields: c, f
func (_m *MockPeer) Next(c context.Context, f rpc.Filter) (*rpc.Workflow, error) {
ret := _m.Called(c, f)
if len(ret) == 0 {
panic("no return value specified for Next")
}
var r0 *rpc.Workflow
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, rpc.Filter) (*rpc.Workflow, error)); ok {
return rf(c, f)
}
if rf, ok := ret.Get(0).(func(context.Context, rpc.Filter) *rpc.Workflow); ok {
r0 = rf(c, f)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*rpc.Workflow)
}
}
if rf, ok := ret.Get(1).(func(context.Context, rpc.Filter) error); ok {
r1 = rf(c, f)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockPeer_Next_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Next'
type MockPeer_Next_Call struct {
*mock.Call
}
// Next is a helper method to define mock.On call
// - c context.Context
// - f rpc.Filter
func (_e *MockPeer_Expecter) Next(c interface{}, f interface{}) *MockPeer_Next_Call {
return &MockPeer_Next_Call{Call: _e.mock.On("Next", c, f)}
}
func (_c *MockPeer_Next_Call) Run(run func(c context.Context, f rpc.Filter)) *MockPeer_Next_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(rpc.Filter))
})
return _c
}
func (_c *MockPeer_Next_Call) Return(_a0 *rpc.Workflow, _a1 error) *MockPeer_Next_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockPeer_Next_Call) RunAndReturn(run func(context.Context, rpc.Filter) (*rpc.Workflow, error)) *MockPeer_Next_Call {
_c.Call.Return(run)
return _c
}
// RegisterAgent provides a mock function with given fields: ctx, info
func (_m *MockPeer) RegisterAgent(ctx context.Context, info rpc.AgentInfo) (int64, error) {
ret := _m.Called(ctx, info)
if len(ret) == 0 {
panic("no return value specified for RegisterAgent")
}
var r0 int64
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, rpc.AgentInfo) (int64, error)); ok {
return rf(ctx, info)
}
if rf, ok := ret.Get(0).(func(context.Context, rpc.AgentInfo) int64); ok {
r0 = rf(ctx, info)
} else {
r0 = ret.Get(0).(int64)
}
if rf, ok := ret.Get(1).(func(context.Context, rpc.AgentInfo) error); ok {
r1 = rf(ctx, info)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockPeer_RegisterAgent_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegisterAgent'
type MockPeer_RegisterAgent_Call struct {
*mock.Call
}
// RegisterAgent is a helper method to define mock.On call
// - ctx context.Context
// - info rpc.AgentInfo
func (_e *MockPeer_Expecter) RegisterAgent(ctx interface{}, info interface{}) *MockPeer_RegisterAgent_Call {
return &MockPeer_RegisterAgent_Call{Call: _e.mock.On("RegisterAgent", ctx, info)}
}
func (_c *MockPeer_RegisterAgent_Call) Run(run func(ctx context.Context, info rpc.AgentInfo)) *MockPeer_RegisterAgent_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(rpc.AgentInfo))
})
return _c
}
func (_c *MockPeer_RegisterAgent_Call) Return(_a0 int64, _a1 error) *MockPeer_RegisterAgent_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockPeer_RegisterAgent_Call) RunAndReturn(run func(context.Context, rpc.AgentInfo) (int64, error)) *MockPeer_RegisterAgent_Call {
_c.Call.Return(run)
return _c
}
// ReportHealth provides a mock function with given fields: c
func (_m *MockPeer) ReportHealth(c context.Context) error {
ret := _m.Called(c)
if len(ret) == 0 {
panic("no return value specified for ReportHealth")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context) error); ok {
r0 = rf(c)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockPeer_ReportHealth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReportHealth'
type MockPeer_ReportHealth_Call struct {
*mock.Call
}
// ReportHealth is a helper method to define mock.On call
// - c context.Context
func (_e *MockPeer_Expecter) ReportHealth(c interface{}) *MockPeer_ReportHealth_Call {
return &MockPeer_ReportHealth_Call{Call: _e.mock.On("ReportHealth", c)}
}
func (_c *MockPeer_ReportHealth_Call) Run(run func(c context.Context)) *MockPeer_ReportHealth_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *MockPeer_ReportHealth_Call) Return(_a0 error) *MockPeer_ReportHealth_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockPeer_ReportHealth_Call) RunAndReturn(run func(context.Context) error) *MockPeer_ReportHealth_Call {
_c.Call.Return(run)
return _c
}
// UnregisterAgent provides a mock function with given fields: ctx
func (_m *MockPeer) UnregisterAgent(ctx context.Context) error {
ret := _m.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for UnregisterAgent")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context) error); ok {
r0 = rf(ctx)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockPeer_UnregisterAgent_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnregisterAgent'
type MockPeer_UnregisterAgent_Call struct {
*mock.Call
}
// UnregisterAgent is a helper method to define mock.On call
// - ctx context.Context
func (_e *MockPeer_Expecter) UnregisterAgent(ctx interface{}) *MockPeer_UnregisterAgent_Call {
return &MockPeer_UnregisterAgent_Call{Call: _e.mock.On("UnregisterAgent", ctx)}
}
func (_c *MockPeer_UnregisterAgent_Call) Run(run func(ctx context.Context)) *MockPeer_UnregisterAgent_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *MockPeer_UnregisterAgent_Call) Return(_a0 error) *MockPeer_UnregisterAgent_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockPeer_UnregisterAgent_Call) RunAndReturn(run func(context.Context) error) *MockPeer_UnregisterAgent_Call {
_c.Call.Return(run)
return _c
}
// Update provides a mock function with given fields: c, workflowID, state
func (_m *MockPeer) Update(c context.Context, workflowID string, state rpc.StepState) error {
ret := _m.Called(c, workflowID, state)
if len(ret) == 0 {
panic("no return value specified for Update")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, rpc.StepState) error); ok {
r0 = rf(c, workflowID, state)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockPeer_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update'
type MockPeer_Update_Call struct {
*mock.Call
}
// Update is a helper method to define mock.On call
// - c context.Context
// - workflowID string
// - state rpc.StepState
func (_e *MockPeer_Expecter) Update(c interface{}, workflowID interface{}, state interface{}) *MockPeer_Update_Call {
return &MockPeer_Update_Call{Call: _e.mock.On("Update", c, workflowID, state)}
}
func (_c *MockPeer_Update_Call) Run(run func(c context.Context, workflowID string, state rpc.StepState)) *MockPeer_Update_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(rpc.StepState))
})
return _c
}
func (_c *MockPeer_Update_Call) Return(_a0 error) *MockPeer_Update_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockPeer_Update_Call) RunAndReturn(run func(context.Context, string, rpc.StepState) error) *MockPeer_Update_Call {
_c.Call.Return(run)
return _c
}
// Version provides a mock function with given fields: c
func (_m *MockPeer) Version(c context.Context) (*rpc.Version, error) {
ret := _m.Called(c)
if len(ret) == 0 {
panic("no return value specified for Version")
}
var r0 *rpc.Version
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) (*rpc.Version, error)); ok {
return rf(c)
}
if rf, ok := ret.Get(0).(func(context.Context) *rpc.Version); ok {
r0 = rf(c)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*rpc.Version)
}
}
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
r1 = rf(c)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockPeer_Version_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Version'
type MockPeer_Version_Call struct {
*mock.Call
}
// Version is a helper method to define mock.On call
// - c context.Context
func (_e *MockPeer_Expecter) Version(c interface{}) *MockPeer_Version_Call {
return &MockPeer_Version_Call{Call: _e.mock.On("Version", c)}
}
func (_c *MockPeer_Version_Call) Run(run func(c context.Context)) *MockPeer_Version_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *MockPeer_Version_Call) Return(_a0 *rpc.Version, _a1 error) *MockPeer_Version_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockPeer_Version_Call) RunAndReturn(run func(context.Context) (*rpc.Version, error)) *MockPeer_Version_Call {
_c.Call.Return(run)
return _c
}
// Wait provides a mock function with given fields: c, workflowID
func (_m *MockPeer) Wait(c context.Context, workflowID string) error {
ret := _m.Called(c, workflowID)
if len(ret) == 0 {
panic("no return value specified for Wait")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = rf(c, workflowID)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockPeer_Wait_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Wait'
type MockPeer_Wait_Call struct {
*mock.Call
}
// Wait is a helper method to define mock.On call
// - c context.Context
// - workflowID string
func (_e *MockPeer_Expecter) Wait(c interface{}, workflowID interface{}) *MockPeer_Wait_Call {
return &MockPeer_Wait_Call{Call: _e.mock.On("Wait", c, workflowID)}
}
func (_c *MockPeer_Wait_Call) Run(run func(c context.Context, workflowID string)) *MockPeer_Wait_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *MockPeer_Wait_Call) Return(_a0 error) *MockPeer_Wait_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockPeer_Wait_Call) RunAndReturn(run func(context.Context, string) error) *MockPeer_Wait_Call {
_c.Call.Return(run)
return _c
}
// NewMockPeer creates a new instance of MockPeer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockPeer(t interface {
mock.TestingT
Cleanup(func())
}) *MockPeer {
mock := &MockPeer{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,251 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
//go:build test
// +build test
package mocks
import (
context "context"
rpc "codeberg.org/crowci/crow/v3/pipeline/rpc"
mock "github.com/stretchr/testify/mock"
)
// Peer is an autogenerated mock type for the Peer type
type Peer struct {
mock.Mock
}
// Done provides a mock function with given fields: c, workflowID, state
func (_m *Peer) Done(c context.Context, workflowID string, state rpc.WorkflowState) error {
ret := _m.Called(c, workflowID, state)
if len(ret) == 0 {
panic("no return value specified for Done")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, rpc.WorkflowState) error); ok {
r0 = rf(c, workflowID, state)
} else {
r0 = ret.Error(0)
}
return r0
}
// EnqueueLog provides a mock function with given fields: logEntry
func (_m *Peer) EnqueueLog(logEntry *rpc.LogEntry) {
_m.Called(logEntry)
}
// Extend provides a mock function with given fields: c, workflowID
func (_m *Peer) Extend(c context.Context, workflowID string) error {
ret := _m.Called(c, workflowID)
if len(ret) == 0 {
panic("no return value specified for Extend")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = rf(c, workflowID)
} else {
r0 = ret.Error(0)
}
return r0
}
// Init provides a mock function with given fields: c, workflowID, state
func (_m *Peer) Init(c context.Context, workflowID string, state rpc.WorkflowState) error {
ret := _m.Called(c, workflowID, state)
if len(ret) == 0 {
panic("no return value specified for Init")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, rpc.WorkflowState) error); ok {
r0 = rf(c, workflowID, state)
} else {
r0 = ret.Error(0)
}
return r0
}
// Next provides a mock function with given fields: c, f
func (_m *Peer) Next(c context.Context, f rpc.Filter) (*rpc.Workflow, error) {
ret := _m.Called(c, f)
if len(ret) == 0 {
panic("no return value specified for Next")
}
var r0 *rpc.Workflow
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, rpc.Filter) (*rpc.Workflow, error)); ok {
return rf(c, f)
}
if rf, ok := ret.Get(0).(func(context.Context, rpc.Filter) *rpc.Workflow); ok {
r0 = rf(c, f)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*rpc.Workflow)
}
}
if rf, ok := ret.Get(1).(func(context.Context, rpc.Filter) error); ok {
r1 = rf(c, f)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// RegisterAgent provides a mock function with given fields: ctx, info
func (_m *Peer) RegisterAgent(ctx context.Context, info rpc.AgentInfo) (int64, error) {
ret := _m.Called(ctx, info)
if len(ret) == 0 {
panic("no return value specified for RegisterAgent")
}
var r0 int64
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, rpc.AgentInfo) (int64, error)); ok {
return rf(ctx, info)
}
if rf, ok := ret.Get(0).(func(context.Context, rpc.AgentInfo) int64); ok {
r0 = rf(ctx, info)
} else {
r0 = ret.Get(0).(int64)
}
if rf, ok := ret.Get(1).(func(context.Context, rpc.AgentInfo) error); ok {
r1 = rf(ctx, info)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ReportHealth provides a mock function with given fields: c
func (_m *Peer) ReportHealth(c context.Context) error {
ret := _m.Called(c)
if len(ret) == 0 {
panic("no return value specified for ReportHealth")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context) error); ok {
r0 = rf(c)
} else {
r0 = ret.Error(0)
}
return r0
}
// UnregisterAgent provides a mock function with given fields: ctx
func (_m *Peer) UnregisterAgent(ctx context.Context) error {
ret := _m.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for UnregisterAgent")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context) error); ok {
r0 = rf(ctx)
} else {
r0 = ret.Error(0)
}
return r0
}
// Update provides a mock function with given fields: c, workflowID, state
func (_m *Peer) Update(c context.Context, workflowID string, state rpc.StepState) error {
ret := _m.Called(c, workflowID, state)
if len(ret) == 0 {
panic("no return value specified for Update")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, rpc.StepState) error); ok {
r0 = rf(c, workflowID, state)
} else {
r0 = ret.Error(0)
}
return r0
}
// Version provides a mock function with given fields: c
func (_m *Peer) Version(c context.Context) (*rpc.Version, error) {
ret := _m.Called(c)
if len(ret) == 0 {
panic("no return value specified for Version")
}
var r0 *rpc.Version
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) (*rpc.Version, error)); ok {
return rf(c)
}
if rf, ok := ret.Get(0).(func(context.Context) *rpc.Version); ok {
r0 = rf(c)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*rpc.Version)
}
}
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
r1 = rf(c)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Wait provides a mock function with given fields: c, workflowID
func (_m *Peer) Wait(c context.Context, workflowID string) error {
ret := _m.Called(c, workflowID)
if len(ret) == 0 {
panic("no return value specified for Wait")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = rf(c, workflowID)
} else {
r0 = ret.Error(0)
}
return r0
}
// NewPeer creates a new instance of Peer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewPeer(t interface {
mock.TestingT
Cleanup(func())
}) *Peer {
mock := &Peer{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,114 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package proto
import (
context "context"
grpc "google.golang.org/grpc"
mock "github.com/stretchr/testify/mock"
proto "codeberg.org/crowci/crow/v3/pipeline/rpc/proto"
)
// MockCrowAuthClient is an autogenerated mock type for the CrowAuthClient type
type MockCrowAuthClient struct {
mock.Mock
}
type MockCrowAuthClient_Expecter struct {
mock *mock.Mock
}
func (_m *MockCrowAuthClient) EXPECT() *MockCrowAuthClient_Expecter {
return &MockCrowAuthClient_Expecter{mock: &_m.Mock}
}
// Auth provides a mock function with given fields: ctx, in, opts
func (_m *MockCrowAuthClient) Auth(ctx context.Context, in *proto.AuthRequest, opts ...grpc.CallOption) (*proto.AuthResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Auth")
}
var r0 *proto.AuthResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.AuthRequest, ...grpc.CallOption) (*proto.AuthResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.AuthRequest, ...grpc.CallOption) *proto.AuthResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.AuthResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.AuthRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowAuthClient_Auth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Auth'
type MockCrowAuthClient_Auth_Call struct {
*mock.Call
}
// Auth is a helper method to define mock.On call
// - ctx context.Context
// - in *proto.AuthRequest
// - opts ...grpc.CallOption
func (_e *MockCrowAuthClient_Expecter) Auth(ctx interface{}, in interface{}, opts ...interface{}) *MockCrowAuthClient_Auth_Call {
return &MockCrowAuthClient_Auth_Call{Call: _e.mock.On("Auth",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *MockCrowAuthClient_Auth_Call) Run(run func(ctx context.Context, in *proto.AuthRequest, opts ...grpc.CallOption)) *MockCrowAuthClient_Auth_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]grpc.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(grpc.CallOption)
}
}
run(args[0].(context.Context), args[1].(*proto.AuthRequest), variadicArgs...)
})
return _c
}
func (_c *MockCrowAuthClient_Auth_Call) Return(_a0 *proto.AuthResponse, _a1 error) *MockCrowAuthClient_Auth_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowAuthClient_Auth_Call) RunAndReturn(run func(context.Context, *proto.AuthRequest, ...grpc.CallOption) (*proto.AuthResponse, error)) *MockCrowAuthClient_Auth_Call {
_c.Call.Return(run)
return _c
}
// NewMockCrowAuthClient creates a new instance of MockCrowAuthClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockCrowAuthClient(t interface {
mock.TestingT
Cleanup(func())
}) *MockCrowAuthClient {
mock := &MockCrowAuthClient{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,128 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package proto
import (
context "context"
proto "codeberg.org/crowci/crow/v3/pipeline/rpc/proto"
mock "github.com/stretchr/testify/mock"
)
// MockCrowAuthServer is an autogenerated mock type for the CrowAuthServer type
type MockCrowAuthServer struct {
mock.Mock
}
type MockCrowAuthServer_Expecter struct {
mock *mock.Mock
}
func (_m *MockCrowAuthServer) EXPECT() *MockCrowAuthServer_Expecter {
return &MockCrowAuthServer_Expecter{mock: &_m.Mock}
}
// Auth provides a mock function with given fields: _a0, _a1
func (_m *MockCrowAuthServer) Auth(_a0 context.Context, _a1 *proto.AuthRequest) (*proto.AuthResponse, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Auth")
}
var r0 *proto.AuthResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.AuthRequest) (*proto.AuthResponse, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.AuthRequest) *proto.AuthResponse); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.AuthResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.AuthRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowAuthServer_Auth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Auth'
type MockCrowAuthServer_Auth_Call struct {
*mock.Call
}
// Auth is a helper method to define mock.On call
// - _a0 context.Context
// - _a1 *proto.AuthRequest
func (_e *MockCrowAuthServer_Expecter) Auth(_a0 interface{}, _a1 interface{}) *MockCrowAuthServer_Auth_Call {
return &MockCrowAuthServer_Auth_Call{Call: _e.mock.On("Auth", _a0, _a1)}
}
func (_c *MockCrowAuthServer_Auth_Call) Run(run func(_a0 context.Context, _a1 *proto.AuthRequest)) *MockCrowAuthServer_Auth_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*proto.AuthRequest))
})
return _c
}
func (_c *MockCrowAuthServer_Auth_Call) Return(_a0 *proto.AuthResponse, _a1 error) *MockCrowAuthServer_Auth_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowAuthServer_Auth_Call) RunAndReturn(run func(context.Context, *proto.AuthRequest) (*proto.AuthResponse, error)) *MockCrowAuthServer_Auth_Call {
_c.Call.Return(run)
return _c
}
// mustEmbedUnimplementedCrowAuthServer provides a mock function with no fields
func (_m *MockCrowAuthServer) mustEmbedUnimplementedCrowAuthServer() {
_m.Called()
}
// MockCrowAuthServer_mustEmbedUnimplementedCrowAuthServer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'mustEmbedUnimplementedCrowAuthServer'
type MockCrowAuthServer_mustEmbedUnimplementedCrowAuthServer_Call struct {
*mock.Call
}
// mustEmbedUnimplementedCrowAuthServer is a helper method to define mock.On call
func (_e *MockCrowAuthServer_Expecter) mustEmbedUnimplementedCrowAuthServer() *MockCrowAuthServer_mustEmbedUnimplementedCrowAuthServer_Call {
return &MockCrowAuthServer_mustEmbedUnimplementedCrowAuthServer_Call{Call: _e.mock.On("mustEmbedUnimplementedCrowAuthServer")}
}
func (_c *MockCrowAuthServer_mustEmbedUnimplementedCrowAuthServer_Call) Run(run func()) *MockCrowAuthServer_mustEmbedUnimplementedCrowAuthServer_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockCrowAuthServer_mustEmbedUnimplementedCrowAuthServer_Call) Return() *MockCrowAuthServer_mustEmbedUnimplementedCrowAuthServer_Call {
_c.Call.Return()
return _c
}
func (_c *MockCrowAuthServer_mustEmbedUnimplementedCrowAuthServer_Call) RunAndReturn(run func()) *MockCrowAuthServer_mustEmbedUnimplementedCrowAuthServer_Call {
_c.Run(run)
return _c
}
// NewMockCrowAuthServer creates a new instance of MockCrowAuthServer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockCrowAuthServer(t interface {
mock.TestingT
Cleanup(func())
}) *MockCrowAuthServer {
mock := &MockCrowAuthServer{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,854 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package proto
import (
context "context"
grpc "google.golang.org/grpc"
mock "github.com/stretchr/testify/mock"
proto "codeberg.org/crowci/crow/v3/pipeline/rpc/proto"
)
// MockCrowClient is an autogenerated mock type for the CrowClient type
type MockCrowClient struct {
mock.Mock
}
type MockCrowClient_Expecter struct {
mock *mock.Mock
}
func (_m *MockCrowClient) EXPECT() *MockCrowClient_Expecter {
return &MockCrowClient_Expecter{mock: &_m.Mock}
}
// Done provides a mock function with given fields: ctx, in, opts
func (_m *MockCrowClient) Done(ctx context.Context, in *proto.DoneRequest, opts ...grpc.CallOption) (*proto.Empty, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Done")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.DoneRequest, ...grpc.CallOption) (*proto.Empty, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.DoneRequest, ...grpc.CallOption) *proto.Empty); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.DoneRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowClient_Done_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Done'
type MockCrowClient_Done_Call struct {
*mock.Call
}
// Done is a helper method to define mock.On call
// - ctx context.Context
// - in *proto.DoneRequest
// - opts ...grpc.CallOption
func (_e *MockCrowClient_Expecter) Done(ctx interface{}, in interface{}, opts ...interface{}) *MockCrowClient_Done_Call {
return &MockCrowClient_Done_Call{Call: _e.mock.On("Done",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *MockCrowClient_Done_Call) Run(run func(ctx context.Context, in *proto.DoneRequest, opts ...grpc.CallOption)) *MockCrowClient_Done_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]grpc.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(grpc.CallOption)
}
}
run(args[0].(context.Context), args[1].(*proto.DoneRequest), variadicArgs...)
})
return _c
}
func (_c *MockCrowClient_Done_Call) Return(_a0 *proto.Empty, _a1 error) *MockCrowClient_Done_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowClient_Done_Call) RunAndReturn(run func(context.Context, *proto.DoneRequest, ...grpc.CallOption) (*proto.Empty, error)) *MockCrowClient_Done_Call {
_c.Call.Return(run)
return _c
}
// Extend provides a mock function with given fields: ctx, in, opts
func (_m *MockCrowClient) Extend(ctx context.Context, in *proto.ExtendRequest, opts ...grpc.CallOption) (*proto.Empty, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Extend")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.ExtendRequest, ...grpc.CallOption) (*proto.Empty, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.ExtendRequest, ...grpc.CallOption) *proto.Empty); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.ExtendRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowClient_Extend_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Extend'
type MockCrowClient_Extend_Call struct {
*mock.Call
}
// Extend is a helper method to define mock.On call
// - ctx context.Context
// - in *proto.ExtendRequest
// - opts ...grpc.CallOption
func (_e *MockCrowClient_Expecter) Extend(ctx interface{}, in interface{}, opts ...interface{}) *MockCrowClient_Extend_Call {
return &MockCrowClient_Extend_Call{Call: _e.mock.On("Extend",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *MockCrowClient_Extend_Call) Run(run func(ctx context.Context, in *proto.ExtendRequest, opts ...grpc.CallOption)) *MockCrowClient_Extend_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]grpc.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(grpc.CallOption)
}
}
run(args[0].(context.Context), args[1].(*proto.ExtendRequest), variadicArgs...)
})
return _c
}
func (_c *MockCrowClient_Extend_Call) Return(_a0 *proto.Empty, _a1 error) *MockCrowClient_Extend_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowClient_Extend_Call) RunAndReturn(run func(context.Context, *proto.ExtendRequest, ...grpc.CallOption) (*proto.Empty, error)) *MockCrowClient_Extend_Call {
_c.Call.Return(run)
return _c
}
// Init provides a mock function with given fields: ctx, in, opts
func (_m *MockCrowClient) Init(ctx context.Context, in *proto.InitRequest, opts ...grpc.CallOption) (*proto.Empty, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Init")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.InitRequest, ...grpc.CallOption) (*proto.Empty, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.InitRequest, ...grpc.CallOption) *proto.Empty); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.InitRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowClient_Init_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Init'
type MockCrowClient_Init_Call struct {
*mock.Call
}
// Init is a helper method to define mock.On call
// - ctx context.Context
// - in *proto.InitRequest
// - opts ...grpc.CallOption
func (_e *MockCrowClient_Expecter) Init(ctx interface{}, in interface{}, opts ...interface{}) *MockCrowClient_Init_Call {
return &MockCrowClient_Init_Call{Call: _e.mock.On("Init",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *MockCrowClient_Init_Call) Run(run func(ctx context.Context, in *proto.InitRequest, opts ...grpc.CallOption)) *MockCrowClient_Init_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]grpc.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(grpc.CallOption)
}
}
run(args[0].(context.Context), args[1].(*proto.InitRequest), variadicArgs...)
})
return _c
}
func (_c *MockCrowClient_Init_Call) Return(_a0 *proto.Empty, _a1 error) *MockCrowClient_Init_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowClient_Init_Call) RunAndReturn(run func(context.Context, *proto.InitRequest, ...grpc.CallOption) (*proto.Empty, error)) *MockCrowClient_Init_Call {
_c.Call.Return(run)
return _c
}
// Log provides a mock function with given fields: ctx, in, opts
func (_m *MockCrowClient) Log(ctx context.Context, in *proto.LogRequest, opts ...grpc.CallOption) (*proto.Empty, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Log")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.LogRequest, ...grpc.CallOption) (*proto.Empty, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.LogRequest, ...grpc.CallOption) *proto.Empty); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.LogRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowClient_Log_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Log'
type MockCrowClient_Log_Call struct {
*mock.Call
}
// Log is a helper method to define mock.On call
// - ctx context.Context
// - in *proto.LogRequest
// - opts ...grpc.CallOption
func (_e *MockCrowClient_Expecter) Log(ctx interface{}, in interface{}, opts ...interface{}) *MockCrowClient_Log_Call {
return &MockCrowClient_Log_Call{Call: _e.mock.On("Log",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *MockCrowClient_Log_Call) Run(run func(ctx context.Context, in *proto.LogRequest, opts ...grpc.CallOption)) *MockCrowClient_Log_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]grpc.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(grpc.CallOption)
}
}
run(args[0].(context.Context), args[1].(*proto.LogRequest), variadicArgs...)
})
return _c
}
func (_c *MockCrowClient_Log_Call) Return(_a0 *proto.Empty, _a1 error) *MockCrowClient_Log_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowClient_Log_Call) RunAndReturn(run func(context.Context, *proto.LogRequest, ...grpc.CallOption) (*proto.Empty, error)) *MockCrowClient_Log_Call {
_c.Call.Return(run)
return _c
}
// Next provides a mock function with given fields: ctx, in, opts
func (_m *MockCrowClient) Next(ctx context.Context, in *proto.NextRequest, opts ...grpc.CallOption) (*proto.NextResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Next")
}
var r0 *proto.NextResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.NextRequest, ...grpc.CallOption) (*proto.NextResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.NextRequest, ...grpc.CallOption) *proto.NextResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.NextResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.NextRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowClient_Next_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Next'
type MockCrowClient_Next_Call struct {
*mock.Call
}
// Next is a helper method to define mock.On call
// - ctx context.Context
// - in *proto.NextRequest
// - opts ...grpc.CallOption
func (_e *MockCrowClient_Expecter) Next(ctx interface{}, in interface{}, opts ...interface{}) *MockCrowClient_Next_Call {
return &MockCrowClient_Next_Call{Call: _e.mock.On("Next",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *MockCrowClient_Next_Call) Run(run func(ctx context.Context, in *proto.NextRequest, opts ...grpc.CallOption)) *MockCrowClient_Next_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]grpc.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(grpc.CallOption)
}
}
run(args[0].(context.Context), args[1].(*proto.NextRequest), variadicArgs...)
})
return _c
}
func (_c *MockCrowClient_Next_Call) Return(_a0 *proto.NextResponse, _a1 error) *MockCrowClient_Next_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowClient_Next_Call) RunAndReturn(run func(context.Context, *proto.NextRequest, ...grpc.CallOption) (*proto.NextResponse, error)) *MockCrowClient_Next_Call {
_c.Call.Return(run)
return _c
}
// RegisterAgent provides a mock function with given fields: ctx, in, opts
func (_m *MockCrowClient) RegisterAgent(ctx context.Context, in *proto.RegisterAgentRequest, opts ...grpc.CallOption) (*proto.RegisterAgentResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for RegisterAgent")
}
var r0 *proto.RegisterAgentResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.RegisterAgentRequest, ...grpc.CallOption) (*proto.RegisterAgentResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.RegisterAgentRequest, ...grpc.CallOption) *proto.RegisterAgentResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.RegisterAgentResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.RegisterAgentRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowClient_RegisterAgent_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegisterAgent'
type MockCrowClient_RegisterAgent_Call struct {
*mock.Call
}
// RegisterAgent is a helper method to define mock.On call
// - ctx context.Context
// - in *proto.RegisterAgentRequest
// - opts ...grpc.CallOption
func (_e *MockCrowClient_Expecter) RegisterAgent(ctx interface{}, in interface{}, opts ...interface{}) *MockCrowClient_RegisterAgent_Call {
return &MockCrowClient_RegisterAgent_Call{Call: _e.mock.On("RegisterAgent",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *MockCrowClient_RegisterAgent_Call) Run(run func(ctx context.Context, in *proto.RegisterAgentRequest, opts ...grpc.CallOption)) *MockCrowClient_RegisterAgent_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]grpc.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(grpc.CallOption)
}
}
run(args[0].(context.Context), args[1].(*proto.RegisterAgentRequest), variadicArgs...)
})
return _c
}
func (_c *MockCrowClient_RegisterAgent_Call) Return(_a0 *proto.RegisterAgentResponse, _a1 error) *MockCrowClient_RegisterAgent_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowClient_RegisterAgent_Call) RunAndReturn(run func(context.Context, *proto.RegisterAgentRequest, ...grpc.CallOption) (*proto.RegisterAgentResponse, error)) *MockCrowClient_RegisterAgent_Call {
_c.Call.Return(run)
return _c
}
// ReportHealth provides a mock function with given fields: ctx, in, opts
func (_m *MockCrowClient) ReportHealth(ctx context.Context, in *proto.ReportHealthRequest, opts ...grpc.CallOption) (*proto.Empty, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for ReportHealth")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.ReportHealthRequest, ...grpc.CallOption) (*proto.Empty, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.ReportHealthRequest, ...grpc.CallOption) *proto.Empty); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.ReportHealthRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowClient_ReportHealth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReportHealth'
type MockCrowClient_ReportHealth_Call struct {
*mock.Call
}
// ReportHealth is a helper method to define mock.On call
// - ctx context.Context
// - in *proto.ReportHealthRequest
// - opts ...grpc.CallOption
func (_e *MockCrowClient_Expecter) ReportHealth(ctx interface{}, in interface{}, opts ...interface{}) *MockCrowClient_ReportHealth_Call {
return &MockCrowClient_ReportHealth_Call{Call: _e.mock.On("ReportHealth",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *MockCrowClient_ReportHealth_Call) Run(run func(ctx context.Context, in *proto.ReportHealthRequest, opts ...grpc.CallOption)) *MockCrowClient_ReportHealth_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]grpc.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(grpc.CallOption)
}
}
run(args[0].(context.Context), args[1].(*proto.ReportHealthRequest), variadicArgs...)
})
return _c
}
func (_c *MockCrowClient_ReportHealth_Call) Return(_a0 *proto.Empty, _a1 error) *MockCrowClient_ReportHealth_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowClient_ReportHealth_Call) RunAndReturn(run func(context.Context, *proto.ReportHealthRequest, ...grpc.CallOption) (*proto.Empty, error)) *MockCrowClient_ReportHealth_Call {
_c.Call.Return(run)
return _c
}
// UnregisterAgent provides a mock function with given fields: ctx, in, opts
func (_m *MockCrowClient) UnregisterAgent(ctx context.Context, in *proto.Empty, opts ...grpc.CallOption) (*proto.Empty, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for UnregisterAgent")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.Empty, ...grpc.CallOption) (*proto.Empty, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.Empty, ...grpc.CallOption) *proto.Empty); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.Empty, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowClient_UnregisterAgent_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnregisterAgent'
type MockCrowClient_UnregisterAgent_Call struct {
*mock.Call
}
// UnregisterAgent is a helper method to define mock.On call
// - ctx context.Context
// - in *proto.Empty
// - opts ...grpc.CallOption
func (_e *MockCrowClient_Expecter) UnregisterAgent(ctx interface{}, in interface{}, opts ...interface{}) *MockCrowClient_UnregisterAgent_Call {
return &MockCrowClient_UnregisterAgent_Call{Call: _e.mock.On("UnregisterAgent",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *MockCrowClient_UnregisterAgent_Call) Run(run func(ctx context.Context, in *proto.Empty, opts ...grpc.CallOption)) *MockCrowClient_UnregisterAgent_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]grpc.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(grpc.CallOption)
}
}
run(args[0].(context.Context), args[1].(*proto.Empty), variadicArgs...)
})
return _c
}
func (_c *MockCrowClient_UnregisterAgent_Call) Return(_a0 *proto.Empty, _a1 error) *MockCrowClient_UnregisterAgent_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowClient_UnregisterAgent_Call) RunAndReturn(run func(context.Context, *proto.Empty, ...grpc.CallOption) (*proto.Empty, error)) *MockCrowClient_UnregisterAgent_Call {
_c.Call.Return(run)
return _c
}
// Update provides a mock function with given fields: ctx, in, opts
func (_m *MockCrowClient) Update(ctx context.Context, in *proto.UpdateRequest, opts ...grpc.CallOption) (*proto.Empty, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Update")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.UpdateRequest, ...grpc.CallOption) (*proto.Empty, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.UpdateRequest, ...grpc.CallOption) *proto.Empty); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.UpdateRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowClient_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update'
type MockCrowClient_Update_Call struct {
*mock.Call
}
// Update is a helper method to define mock.On call
// - ctx context.Context
// - in *proto.UpdateRequest
// - opts ...grpc.CallOption
func (_e *MockCrowClient_Expecter) Update(ctx interface{}, in interface{}, opts ...interface{}) *MockCrowClient_Update_Call {
return &MockCrowClient_Update_Call{Call: _e.mock.On("Update",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *MockCrowClient_Update_Call) Run(run func(ctx context.Context, in *proto.UpdateRequest, opts ...grpc.CallOption)) *MockCrowClient_Update_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]grpc.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(grpc.CallOption)
}
}
run(args[0].(context.Context), args[1].(*proto.UpdateRequest), variadicArgs...)
})
return _c
}
func (_c *MockCrowClient_Update_Call) Return(_a0 *proto.Empty, _a1 error) *MockCrowClient_Update_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowClient_Update_Call) RunAndReturn(run func(context.Context, *proto.UpdateRequest, ...grpc.CallOption) (*proto.Empty, error)) *MockCrowClient_Update_Call {
_c.Call.Return(run)
return _c
}
// Version provides a mock function with given fields: ctx, in, opts
func (_m *MockCrowClient) Version(ctx context.Context, in *proto.Empty, opts ...grpc.CallOption) (*proto.VersionResponse, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Version")
}
var r0 *proto.VersionResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.Empty, ...grpc.CallOption) (*proto.VersionResponse, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.Empty, ...grpc.CallOption) *proto.VersionResponse); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.VersionResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.Empty, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowClient_Version_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Version'
type MockCrowClient_Version_Call struct {
*mock.Call
}
// Version is a helper method to define mock.On call
// - ctx context.Context
// - in *proto.Empty
// - opts ...grpc.CallOption
func (_e *MockCrowClient_Expecter) Version(ctx interface{}, in interface{}, opts ...interface{}) *MockCrowClient_Version_Call {
return &MockCrowClient_Version_Call{Call: _e.mock.On("Version",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *MockCrowClient_Version_Call) Run(run func(ctx context.Context, in *proto.Empty, opts ...grpc.CallOption)) *MockCrowClient_Version_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]grpc.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(grpc.CallOption)
}
}
run(args[0].(context.Context), args[1].(*proto.Empty), variadicArgs...)
})
return _c
}
func (_c *MockCrowClient_Version_Call) Return(_a0 *proto.VersionResponse, _a1 error) *MockCrowClient_Version_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowClient_Version_Call) RunAndReturn(run func(context.Context, *proto.Empty, ...grpc.CallOption) (*proto.VersionResponse, error)) *MockCrowClient_Version_Call {
_c.Call.Return(run)
return _c
}
// Wait provides a mock function with given fields: ctx, in, opts
func (_m *MockCrowClient) Wait(ctx context.Context, in *proto.WaitRequest, opts ...grpc.CallOption) (*proto.Empty, error) {
_va := make([]interface{}, len(opts))
for _i := range opts {
_va[_i] = opts[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, in)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Wait")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.WaitRequest, ...grpc.CallOption) (*proto.Empty, error)); ok {
return rf(ctx, in, opts...)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.WaitRequest, ...grpc.CallOption) *proto.Empty); ok {
r0 = rf(ctx, in, opts...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.WaitRequest, ...grpc.CallOption) error); ok {
r1 = rf(ctx, in, opts...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowClient_Wait_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Wait'
type MockCrowClient_Wait_Call struct {
*mock.Call
}
// Wait is a helper method to define mock.On call
// - ctx context.Context
// - in *proto.WaitRequest
// - opts ...grpc.CallOption
func (_e *MockCrowClient_Expecter) Wait(ctx interface{}, in interface{}, opts ...interface{}) *MockCrowClient_Wait_Call {
return &MockCrowClient_Wait_Call{Call: _e.mock.On("Wait",
append([]interface{}{ctx, in}, opts...)...)}
}
func (_c *MockCrowClient_Wait_Call) Run(run func(ctx context.Context, in *proto.WaitRequest, opts ...grpc.CallOption)) *MockCrowClient_Wait_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]grpc.CallOption, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(grpc.CallOption)
}
}
run(args[0].(context.Context), args[1].(*proto.WaitRequest), variadicArgs...)
})
return _c
}
func (_c *MockCrowClient_Wait_Call) Return(_a0 *proto.Empty, _a1 error) *MockCrowClient_Wait_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowClient_Wait_Call) RunAndReturn(run func(context.Context, *proto.WaitRequest, ...grpc.CallOption) (*proto.Empty, error)) *MockCrowClient_Wait_Call {
_c.Call.Return(run)
return _c
}
// NewMockCrowClient creates a new instance of MockCrowClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockCrowClient(t interface {
mock.TestingT
Cleanup(func())
}) *MockCrowClient {
mock := &MockCrowClient{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,718 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package proto
import (
context "context"
proto "codeberg.org/crowci/crow/v3/pipeline/rpc/proto"
mock "github.com/stretchr/testify/mock"
)
// MockCrowServer is an autogenerated mock type for the CrowServer type
type MockCrowServer struct {
mock.Mock
}
type MockCrowServer_Expecter struct {
mock *mock.Mock
}
func (_m *MockCrowServer) EXPECT() *MockCrowServer_Expecter {
return &MockCrowServer_Expecter{mock: &_m.Mock}
}
// Done provides a mock function with given fields: _a0, _a1
func (_m *MockCrowServer) Done(_a0 context.Context, _a1 *proto.DoneRequest) (*proto.Empty, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Done")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.DoneRequest) (*proto.Empty, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.DoneRequest) *proto.Empty); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.DoneRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowServer_Done_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Done'
type MockCrowServer_Done_Call struct {
*mock.Call
}
// Done is a helper method to define mock.On call
// - _a0 context.Context
// - _a1 *proto.DoneRequest
func (_e *MockCrowServer_Expecter) Done(_a0 interface{}, _a1 interface{}) *MockCrowServer_Done_Call {
return &MockCrowServer_Done_Call{Call: _e.mock.On("Done", _a0, _a1)}
}
func (_c *MockCrowServer_Done_Call) Run(run func(_a0 context.Context, _a1 *proto.DoneRequest)) *MockCrowServer_Done_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*proto.DoneRequest))
})
return _c
}
func (_c *MockCrowServer_Done_Call) Return(_a0 *proto.Empty, _a1 error) *MockCrowServer_Done_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowServer_Done_Call) RunAndReturn(run func(context.Context, *proto.DoneRequest) (*proto.Empty, error)) *MockCrowServer_Done_Call {
_c.Call.Return(run)
return _c
}
// Extend provides a mock function with given fields: _a0, _a1
func (_m *MockCrowServer) Extend(_a0 context.Context, _a1 *proto.ExtendRequest) (*proto.Empty, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Extend")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.ExtendRequest) (*proto.Empty, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.ExtendRequest) *proto.Empty); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.ExtendRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowServer_Extend_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Extend'
type MockCrowServer_Extend_Call struct {
*mock.Call
}
// Extend is a helper method to define mock.On call
// - _a0 context.Context
// - _a1 *proto.ExtendRequest
func (_e *MockCrowServer_Expecter) Extend(_a0 interface{}, _a1 interface{}) *MockCrowServer_Extend_Call {
return &MockCrowServer_Extend_Call{Call: _e.mock.On("Extend", _a0, _a1)}
}
func (_c *MockCrowServer_Extend_Call) Run(run func(_a0 context.Context, _a1 *proto.ExtendRequest)) *MockCrowServer_Extend_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*proto.ExtendRequest))
})
return _c
}
func (_c *MockCrowServer_Extend_Call) Return(_a0 *proto.Empty, _a1 error) *MockCrowServer_Extend_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowServer_Extend_Call) RunAndReturn(run func(context.Context, *proto.ExtendRequest) (*proto.Empty, error)) *MockCrowServer_Extend_Call {
_c.Call.Return(run)
return _c
}
// Init provides a mock function with given fields: _a0, _a1
func (_m *MockCrowServer) Init(_a0 context.Context, _a1 *proto.InitRequest) (*proto.Empty, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Init")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.InitRequest) (*proto.Empty, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.InitRequest) *proto.Empty); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.InitRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowServer_Init_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Init'
type MockCrowServer_Init_Call struct {
*mock.Call
}
// Init is a helper method to define mock.On call
// - _a0 context.Context
// - _a1 *proto.InitRequest
func (_e *MockCrowServer_Expecter) Init(_a0 interface{}, _a1 interface{}) *MockCrowServer_Init_Call {
return &MockCrowServer_Init_Call{Call: _e.mock.On("Init", _a0, _a1)}
}
func (_c *MockCrowServer_Init_Call) Run(run func(_a0 context.Context, _a1 *proto.InitRequest)) *MockCrowServer_Init_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*proto.InitRequest))
})
return _c
}
func (_c *MockCrowServer_Init_Call) Return(_a0 *proto.Empty, _a1 error) *MockCrowServer_Init_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowServer_Init_Call) RunAndReturn(run func(context.Context, *proto.InitRequest) (*proto.Empty, error)) *MockCrowServer_Init_Call {
_c.Call.Return(run)
return _c
}
// Log provides a mock function with given fields: _a0, _a1
func (_m *MockCrowServer) Log(_a0 context.Context, _a1 *proto.LogRequest) (*proto.Empty, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Log")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.LogRequest) (*proto.Empty, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.LogRequest) *proto.Empty); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.LogRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowServer_Log_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Log'
type MockCrowServer_Log_Call struct {
*mock.Call
}
// Log is a helper method to define mock.On call
// - _a0 context.Context
// - _a1 *proto.LogRequest
func (_e *MockCrowServer_Expecter) Log(_a0 interface{}, _a1 interface{}) *MockCrowServer_Log_Call {
return &MockCrowServer_Log_Call{Call: _e.mock.On("Log", _a0, _a1)}
}
func (_c *MockCrowServer_Log_Call) Run(run func(_a0 context.Context, _a1 *proto.LogRequest)) *MockCrowServer_Log_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*proto.LogRequest))
})
return _c
}
func (_c *MockCrowServer_Log_Call) Return(_a0 *proto.Empty, _a1 error) *MockCrowServer_Log_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowServer_Log_Call) RunAndReturn(run func(context.Context, *proto.LogRequest) (*proto.Empty, error)) *MockCrowServer_Log_Call {
_c.Call.Return(run)
return _c
}
// Next provides a mock function with given fields: _a0, _a1
func (_m *MockCrowServer) Next(_a0 context.Context, _a1 *proto.NextRequest) (*proto.NextResponse, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Next")
}
var r0 *proto.NextResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.NextRequest) (*proto.NextResponse, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.NextRequest) *proto.NextResponse); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.NextResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.NextRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowServer_Next_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Next'
type MockCrowServer_Next_Call struct {
*mock.Call
}
// Next is a helper method to define mock.On call
// - _a0 context.Context
// - _a1 *proto.NextRequest
func (_e *MockCrowServer_Expecter) Next(_a0 interface{}, _a1 interface{}) *MockCrowServer_Next_Call {
return &MockCrowServer_Next_Call{Call: _e.mock.On("Next", _a0, _a1)}
}
func (_c *MockCrowServer_Next_Call) Run(run func(_a0 context.Context, _a1 *proto.NextRequest)) *MockCrowServer_Next_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*proto.NextRequest))
})
return _c
}
func (_c *MockCrowServer_Next_Call) Return(_a0 *proto.NextResponse, _a1 error) *MockCrowServer_Next_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowServer_Next_Call) RunAndReturn(run func(context.Context, *proto.NextRequest) (*proto.NextResponse, error)) *MockCrowServer_Next_Call {
_c.Call.Return(run)
return _c
}
// RegisterAgent provides a mock function with given fields: _a0, _a1
func (_m *MockCrowServer) RegisterAgent(_a0 context.Context, _a1 *proto.RegisterAgentRequest) (*proto.RegisterAgentResponse, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for RegisterAgent")
}
var r0 *proto.RegisterAgentResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.RegisterAgentRequest) (*proto.RegisterAgentResponse, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.RegisterAgentRequest) *proto.RegisterAgentResponse); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.RegisterAgentResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.RegisterAgentRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowServer_RegisterAgent_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegisterAgent'
type MockCrowServer_RegisterAgent_Call struct {
*mock.Call
}
// RegisterAgent is a helper method to define mock.On call
// - _a0 context.Context
// - _a1 *proto.RegisterAgentRequest
func (_e *MockCrowServer_Expecter) RegisterAgent(_a0 interface{}, _a1 interface{}) *MockCrowServer_RegisterAgent_Call {
return &MockCrowServer_RegisterAgent_Call{Call: _e.mock.On("RegisterAgent", _a0, _a1)}
}
func (_c *MockCrowServer_RegisterAgent_Call) Run(run func(_a0 context.Context, _a1 *proto.RegisterAgentRequest)) *MockCrowServer_RegisterAgent_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*proto.RegisterAgentRequest))
})
return _c
}
func (_c *MockCrowServer_RegisterAgent_Call) Return(_a0 *proto.RegisterAgentResponse, _a1 error) *MockCrowServer_RegisterAgent_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowServer_RegisterAgent_Call) RunAndReturn(run func(context.Context, *proto.RegisterAgentRequest) (*proto.RegisterAgentResponse, error)) *MockCrowServer_RegisterAgent_Call {
_c.Call.Return(run)
return _c
}
// ReportHealth provides a mock function with given fields: _a0, _a1
func (_m *MockCrowServer) ReportHealth(_a0 context.Context, _a1 *proto.ReportHealthRequest) (*proto.Empty, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for ReportHealth")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.ReportHealthRequest) (*proto.Empty, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.ReportHealthRequest) *proto.Empty); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.ReportHealthRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowServer_ReportHealth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReportHealth'
type MockCrowServer_ReportHealth_Call struct {
*mock.Call
}
// ReportHealth is a helper method to define mock.On call
// - _a0 context.Context
// - _a1 *proto.ReportHealthRequest
func (_e *MockCrowServer_Expecter) ReportHealth(_a0 interface{}, _a1 interface{}) *MockCrowServer_ReportHealth_Call {
return &MockCrowServer_ReportHealth_Call{Call: _e.mock.On("ReportHealth", _a0, _a1)}
}
func (_c *MockCrowServer_ReportHealth_Call) Run(run func(_a0 context.Context, _a1 *proto.ReportHealthRequest)) *MockCrowServer_ReportHealth_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*proto.ReportHealthRequest))
})
return _c
}
func (_c *MockCrowServer_ReportHealth_Call) Return(_a0 *proto.Empty, _a1 error) *MockCrowServer_ReportHealth_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowServer_ReportHealth_Call) RunAndReturn(run func(context.Context, *proto.ReportHealthRequest) (*proto.Empty, error)) *MockCrowServer_ReportHealth_Call {
_c.Call.Return(run)
return _c
}
// UnregisterAgent provides a mock function with given fields: _a0, _a1
func (_m *MockCrowServer) UnregisterAgent(_a0 context.Context, _a1 *proto.Empty) (*proto.Empty, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for UnregisterAgent")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.Empty) (*proto.Empty, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.Empty) *proto.Empty); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.Empty) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowServer_UnregisterAgent_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnregisterAgent'
type MockCrowServer_UnregisterAgent_Call struct {
*mock.Call
}
// UnregisterAgent is a helper method to define mock.On call
// - _a0 context.Context
// - _a1 *proto.Empty
func (_e *MockCrowServer_Expecter) UnregisterAgent(_a0 interface{}, _a1 interface{}) *MockCrowServer_UnregisterAgent_Call {
return &MockCrowServer_UnregisterAgent_Call{Call: _e.mock.On("UnregisterAgent", _a0, _a1)}
}
func (_c *MockCrowServer_UnregisterAgent_Call) Run(run func(_a0 context.Context, _a1 *proto.Empty)) *MockCrowServer_UnregisterAgent_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*proto.Empty))
})
return _c
}
func (_c *MockCrowServer_UnregisterAgent_Call) Return(_a0 *proto.Empty, _a1 error) *MockCrowServer_UnregisterAgent_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowServer_UnregisterAgent_Call) RunAndReturn(run func(context.Context, *proto.Empty) (*proto.Empty, error)) *MockCrowServer_UnregisterAgent_Call {
_c.Call.Return(run)
return _c
}
// Update provides a mock function with given fields: _a0, _a1
func (_m *MockCrowServer) Update(_a0 context.Context, _a1 *proto.UpdateRequest) (*proto.Empty, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Update")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.UpdateRequest) (*proto.Empty, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.UpdateRequest) *proto.Empty); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.UpdateRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowServer_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update'
type MockCrowServer_Update_Call struct {
*mock.Call
}
// Update is a helper method to define mock.On call
// - _a0 context.Context
// - _a1 *proto.UpdateRequest
func (_e *MockCrowServer_Expecter) Update(_a0 interface{}, _a1 interface{}) *MockCrowServer_Update_Call {
return &MockCrowServer_Update_Call{Call: _e.mock.On("Update", _a0, _a1)}
}
func (_c *MockCrowServer_Update_Call) Run(run func(_a0 context.Context, _a1 *proto.UpdateRequest)) *MockCrowServer_Update_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*proto.UpdateRequest))
})
return _c
}
func (_c *MockCrowServer_Update_Call) Return(_a0 *proto.Empty, _a1 error) *MockCrowServer_Update_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowServer_Update_Call) RunAndReturn(run func(context.Context, *proto.UpdateRequest) (*proto.Empty, error)) *MockCrowServer_Update_Call {
_c.Call.Return(run)
return _c
}
// Version provides a mock function with given fields: _a0, _a1
func (_m *MockCrowServer) Version(_a0 context.Context, _a1 *proto.Empty) (*proto.VersionResponse, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Version")
}
var r0 *proto.VersionResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.Empty) (*proto.VersionResponse, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.Empty) *proto.VersionResponse); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.VersionResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.Empty) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowServer_Version_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Version'
type MockCrowServer_Version_Call struct {
*mock.Call
}
// Version is a helper method to define mock.On call
// - _a0 context.Context
// - _a1 *proto.Empty
func (_e *MockCrowServer_Expecter) Version(_a0 interface{}, _a1 interface{}) *MockCrowServer_Version_Call {
return &MockCrowServer_Version_Call{Call: _e.mock.On("Version", _a0, _a1)}
}
func (_c *MockCrowServer_Version_Call) Run(run func(_a0 context.Context, _a1 *proto.Empty)) *MockCrowServer_Version_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*proto.Empty))
})
return _c
}
func (_c *MockCrowServer_Version_Call) Return(_a0 *proto.VersionResponse, _a1 error) *MockCrowServer_Version_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowServer_Version_Call) RunAndReturn(run func(context.Context, *proto.Empty) (*proto.VersionResponse, error)) *MockCrowServer_Version_Call {
_c.Call.Return(run)
return _c
}
// Wait provides a mock function with given fields: _a0, _a1
func (_m *MockCrowServer) Wait(_a0 context.Context, _a1 *proto.WaitRequest) (*proto.Empty, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Wait")
}
var r0 *proto.Empty
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *proto.WaitRequest) (*proto.Empty, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *proto.WaitRequest) *proto.Empty); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*proto.Empty)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *proto.WaitRequest) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockCrowServer_Wait_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Wait'
type MockCrowServer_Wait_Call struct {
*mock.Call
}
// Wait is a helper method to define mock.On call
// - _a0 context.Context
// - _a1 *proto.WaitRequest
func (_e *MockCrowServer_Expecter) Wait(_a0 interface{}, _a1 interface{}) *MockCrowServer_Wait_Call {
return &MockCrowServer_Wait_Call{Call: _e.mock.On("Wait", _a0, _a1)}
}
func (_c *MockCrowServer_Wait_Call) Run(run func(_a0 context.Context, _a1 *proto.WaitRequest)) *MockCrowServer_Wait_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*proto.WaitRequest))
})
return _c
}
func (_c *MockCrowServer_Wait_Call) Return(_a0 *proto.Empty, _a1 error) *MockCrowServer_Wait_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockCrowServer_Wait_Call) RunAndReturn(run func(context.Context, *proto.WaitRequest) (*proto.Empty, error)) *MockCrowServer_Wait_Call {
_c.Call.Return(run)
return _c
}
// mustEmbedUnimplementedCrowServer provides a mock function with no fields
func (_m *MockCrowServer) mustEmbedUnimplementedCrowServer() {
_m.Called()
}
// MockCrowServer_mustEmbedUnimplementedCrowServer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'mustEmbedUnimplementedCrowServer'
type MockCrowServer_mustEmbedUnimplementedCrowServer_Call struct {
*mock.Call
}
// mustEmbedUnimplementedCrowServer is a helper method to define mock.On call
func (_e *MockCrowServer_Expecter) mustEmbedUnimplementedCrowServer() *MockCrowServer_mustEmbedUnimplementedCrowServer_Call {
return &MockCrowServer_mustEmbedUnimplementedCrowServer_Call{Call: _e.mock.On("mustEmbedUnimplementedCrowServer")}
}
func (_c *MockCrowServer_mustEmbedUnimplementedCrowServer_Call) Run(run func()) *MockCrowServer_mustEmbedUnimplementedCrowServer_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockCrowServer_mustEmbedUnimplementedCrowServer_Call) Return() *MockCrowServer_mustEmbedUnimplementedCrowServer_Call {
_c.Call.Return()
return _c
}
func (_c *MockCrowServer_mustEmbedUnimplementedCrowServer_Call) RunAndReturn(run func()) *MockCrowServer_mustEmbedUnimplementedCrowServer_Call {
_c.Run(run)
return _c
}
// NewMockCrowServer creates a new instance of MockCrowServer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockCrowServer(t interface {
mock.TestingT
Cleanup(func())
}) *MockCrowServer {
mock := &MockCrowServer{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,64 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package proto
import mock "github.com/stretchr/testify/mock"
// MockUnsafeCrowAuthServer is an autogenerated mock type for the UnsafeCrowAuthServer type
type MockUnsafeCrowAuthServer struct {
mock.Mock
}
type MockUnsafeCrowAuthServer_Expecter struct {
mock *mock.Mock
}
func (_m *MockUnsafeCrowAuthServer) EXPECT() *MockUnsafeCrowAuthServer_Expecter {
return &MockUnsafeCrowAuthServer_Expecter{mock: &_m.Mock}
}
// mustEmbedUnimplementedCrowAuthServer provides a mock function with no fields
func (_m *MockUnsafeCrowAuthServer) mustEmbedUnimplementedCrowAuthServer() {
_m.Called()
}
// MockUnsafeCrowAuthServer_mustEmbedUnimplementedCrowAuthServer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'mustEmbedUnimplementedCrowAuthServer'
type MockUnsafeCrowAuthServer_mustEmbedUnimplementedCrowAuthServer_Call struct {
*mock.Call
}
// mustEmbedUnimplementedCrowAuthServer is a helper method to define mock.On call
func (_e *MockUnsafeCrowAuthServer_Expecter) mustEmbedUnimplementedCrowAuthServer() *MockUnsafeCrowAuthServer_mustEmbedUnimplementedCrowAuthServer_Call {
return &MockUnsafeCrowAuthServer_mustEmbedUnimplementedCrowAuthServer_Call{Call: _e.mock.On("mustEmbedUnimplementedCrowAuthServer")}
}
func (_c *MockUnsafeCrowAuthServer_mustEmbedUnimplementedCrowAuthServer_Call) Run(run func()) *MockUnsafeCrowAuthServer_mustEmbedUnimplementedCrowAuthServer_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockUnsafeCrowAuthServer_mustEmbedUnimplementedCrowAuthServer_Call) Return() *MockUnsafeCrowAuthServer_mustEmbedUnimplementedCrowAuthServer_Call {
_c.Call.Return()
return _c
}
func (_c *MockUnsafeCrowAuthServer_mustEmbedUnimplementedCrowAuthServer_Call) RunAndReturn(run func()) *MockUnsafeCrowAuthServer_mustEmbedUnimplementedCrowAuthServer_Call {
_c.Run(run)
return _c
}
// NewMockUnsafeCrowAuthServer creates a new instance of MockUnsafeCrowAuthServer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockUnsafeCrowAuthServer(t interface {
mock.TestingT
Cleanup(func())
}) *MockUnsafeCrowAuthServer {
mock := &MockUnsafeCrowAuthServer{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,64 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package proto
import mock "github.com/stretchr/testify/mock"
// MockUnsafeCrowServer is an autogenerated mock type for the UnsafeCrowServer type
type MockUnsafeCrowServer struct {
mock.Mock
}
type MockUnsafeCrowServer_Expecter struct {
mock *mock.Mock
}
func (_m *MockUnsafeCrowServer) EXPECT() *MockUnsafeCrowServer_Expecter {
return &MockUnsafeCrowServer_Expecter{mock: &_m.Mock}
}
// mustEmbedUnimplementedCrowServer provides a mock function with no fields
func (_m *MockUnsafeCrowServer) mustEmbedUnimplementedCrowServer() {
_m.Called()
}
// MockUnsafeCrowServer_mustEmbedUnimplementedCrowServer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'mustEmbedUnimplementedCrowServer'
type MockUnsafeCrowServer_mustEmbedUnimplementedCrowServer_Call struct {
*mock.Call
}
// mustEmbedUnimplementedCrowServer is a helper method to define mock.On call
func (_e *MockUnsafeCrowServer_Expecter) mustEmbedUnimplementedCrowServer() *MockUnsafeCrowServer_mustEmbedUnimplementedCrowServer_Call {
return &MockUnsafeCrowServer_mustEmbedUnimplementedCrowServer_Call{Call: _e.mock.On("mustEmbedUnimplementedCrowServer")}
}
func (_c *MockUnsafeCrowServer_mustEmbedUnimplementedCrowServer_Call) Run(run func()) *MockUnsafeCrowServer_mustEmbedUnimplementedCrowServer_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockUnsafeCrowServer_mustEmbedUnimplementedCrowServer_Call) Return() *MockUnsafeCrowServer_mustEmbedUnimplementedCrowServer_Call {
_c.Call.Return()
return _c
}
func (_c *MockUnsafeCrowServer_mustEmbedUnimplementedCrowServer_Call) RunAndReturn(run func()) *MockUnsafeCrowServer_mustEmbedUnimplementedCrowServer_Call {
_c.Run(run)
return _c
}
// NewMockUnsafeCrowServer creates a new instance of MockUnsafeCrowServer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockUnsafeCrowServer(t interface {
mock.TestingT
Cleanup(func())
}) *MockUnsafeCrowServer {
mock := &MockUnsafeCrowServer{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -47,7 +47,8 @@ func TestGetAgents(t *testing.T) {
t.Run("should get agents", func(t *testing.T) {
agents := []*model.Agent{fakeAgent}
mockStore := store_mocks.NewStore(t)
// mockStore := new(store_mocks.MockStore)
mockStore := new(store_mocks.MockStore)
mockStore.On("AgentList", mock.Anything).Return(agents, nil)
w := httptest.NewRecorder()
@ -71,7 +72,7 @@ func TestGetAgent(t *testing.T) {
gin.SetMode(gin.TestMode)
t.Run("should get agent", func(t *testing.T) {
mockStore := store_mocks.NewStore(t)
mockStore := new(store_mocks.MockStore)
mockStore.On("AgentFind", int64(1)).Return(fakeAgent, nil)
w := httptest.NewRecorder()
@ -103,7 +104,7 @@ func TestGetAgent(t *testing.T) {
})
t.Run("should return not found for non-existent agent", func(t *testing.T) {
mockStore := store_mocks.NewStore(t)
mockStore := new(store_mocks.MockStore)
mockStore.On("AgentFind", int64(2)).Return((*model.Agent)(nil), types.RecordNotExist)
w := httptest.NewRecorder()
@ -125,11 +126,12 @@ func TestPatchAgent(t *testing.T) {
updatedAgent := *fakeAgent
updatedAgent.Name = "updated-agent"
mockStore := store_mocks.NewStore(t)
mockStore := new(store_mocks.MockStore)
mockStore.On("AgentFind", int64(1)).Return(fakeAgent, nil)
mockStore.On("AgentUpdate", mock.AnythingOfType("*model.Agent")).Return(nil)
mockManager := mocks_manager.NewManager(t)
// mockManager := new(mocks_manager.MockManager)
mockManager := new(mocks_manager.MockManager)
server.Config.Services.Manager = mockManager
w := httptest.NewRecorder()
@ -162,7 +164,7 @@ func TestPostAgent(t *testing.T) {
NoSchedule: false,
}
mockStore := store_mocks.NewStore(t)
mockStore := new(store_mocks.MockStore)
mockStore.On("AgentCreate", mock.AnythingOfType("*model.Agent")).Return(nil)
w := httptest.NewRecorder()
@ -190,14 +192,15 @@ func TestDeleteAgent(t *testing.T) {
gin.SetMode(gin.TestMode)
t.Run("should delete agent", func(t *testing.T) {
mockStore := store_mocks.NewStore(t)
mockStore := new(store_mocks.MockStore)
mockStore.On("AgentFind", int64(1)).Return(fakeAgent, nil)
mockStore.On("AgentDelete", mock.AnythingOfType("*model.Agent")).Return(nil)
mockManager := mocks_manager.NewManager(t)
mockManager := new(mocks_manager.MockManager)
server.Config.Services.Manager = mockManager
mockQueue := queue_mocks.NewQueue(t)
// mockQueue := queue_mocks.NewQueue(t)
mockQueue := new(queue_mocks.MockQueue)
mockQueue.On("Info", mock.Anything).Return(queue.InfoT{})
mockQueue.On("KickAgentWorkers", int64(1)).Return()
server.Config.Services.Queue = mockQueue
@ -217,13 +220,13 @@ func TestDeleteAgent(t *testing.T) {
})
t.Run("should not delete agent with running tasks", func(t *testing.T) {
mockStore := store_mocks.NewStore(t)
mockStore := new(store_mocks.MockStore)
mockStore.On("AgentFind", int64(1)).Return(fakeAgent, nil)
mockManager := mocks_manager.NewManager(t)
mockManager := new(mocks_manager.MockManager)
server.Config.Services.Manager = mockManager
mockQueue := queue_mocks.NewQueue(t)
mockQueue := new(queue_mocks.MockQueue)
mockQueue.On("Info", mock.Anything).Return(queue.InfoT{
Running: []*model.Task{{AgentID: 1}},
})
@ -247,7 +250,7 @@ func TestPostOrgAgent(t *testing.T) {
gin.SetMode(gin.TestMode)
t.Run("create org agent should succeed", func(t *testing.T) {
mockStore := store_mocks.NewStore(t)
mockStore := new(store_mocks.MockStore)
mockStore.On("AgentCreate", mock.AnythingOfType("*model.Agent")).Return(nil)
w := httptest.NewRecorder()

View File

@ -13,26 +13,30 @@ import (
"codeberg.org/crowci/crow/v3/server"
"codeberg.org/crowci/crow/v3/server/api"
mocks_forge "codeberg.org/crowci/crow/v3/server/forge/mocks"
forge_mocks "codeberg.org/crowci/crow/v3/server/forge/mocks"
"codeberg.org/crowci/crow/v3/server/model"
mocks_config_service "codeberg.org/crowci/crow/v3/server/services/config/mocks"
mocks_services "codeberg.org/crowci/crow/v3/server/services/mocks"
"codeberg.org/crowci/crow/v3/server/services/permissions"
mocks_registry_service "codeberg.org/crowci/crow/v3/server/services/registry/mocks"
mocks_secret_service "codeberg.org/crowci/crow/v3/server/services/secret/mocks"
mocks_store "codeberg.org/crowci/crow/v3/server/store/mocks"
store_mocks "codeberg.org/crowci/crow/v3/server/store/mocks"
"codeberg.org/crowci/crow/v3/shared/token"
)
func TestHook(t *testing.T) {
gin.SetMode(gin.TestMode)
_manager := mocks_services.NewManager(t)
_forge := mocks_forge.NewForge(t)
_store := mocks_store.NewStore(t)
_configService := mocks_config_service.NewService(t)
_secretService := mocks_secret_service.NewService(t)
_registryService := mocks_registry_service.NewService(t)
// _manager := new(mocks_services.MockManager)
_manager := new(mocks_services.MockManager)
_forge := new(forge_mocks.MockForge)
_store := new(store_mocks.MockStore)
// _configService := mocks_config_service.NewService(t)
_configService := new(mocks_config_service.MockService)
// _secretService := mocks_secret_service.NewService(t)
_secretService := new(mocks_secret_service.MockService)
// _registryService := mocks_registry_service.NewService(t)
_registryService := new(mocks_registry_service.MockService)
server.Config.Services.Manager = _manager
server.Config.Permissions.Open = true
server.Config.Permissions.Orgs = permissions.NewOrgs(nil)

View File

@ -15,12 +15,12 @@ import (
"codeberg.org/crowci/crow/v3/server"
"codeberg.org/crowci/crow/v3/server/api"
mocks_forge "codeberg.org/crowci/crow/v3/server/forge/mocks"
forge_mocks "codeberg.org/crowci/crow/v3/server/forge/mocks"
forge_types "codeberg.org/crowci/crow/v3/server/forge/types"
"codeberg.org/crowci/crow/v3/server/model"
mocks_services "codeberg.org/crowci/crow/v3/server/services/mocks"
"codeberg.org/crowci/crow/v3/server/services/permissions"
mocks_store "codeberg.org/crowci/crow/v3/server/store/mocks"
store_mocks "codeberg.org/crowci/crow/v3/server/store/mocks"
"codeberg.org/crowci/crow/v3/server/store/types"
"codeberg.org/crowci/crow/v3/shared/token"
)
@ -70,8 +70,8 @@ func TestHandleAuth(t *testing.T) {
})
t.Run("should fail if the state is wrong", func(t *testing.T) {
_manager := mocks_services.NewManager(t)
_store := mocks_store.NewStore(t)
_manager := new(mocks_services.MockManager)
_store := new(store_mocks.MockStore)
server.Config.Services.Manager = _manager
server.Config.Permissions.Open = true
server.Config.Permissions.Orgs = permissions.NewOrgs(nil)
@ -103,9 +103,10 @@ func TestHandleAuth(t *testing.T) {
})
t.Run("should redirect to forge login page", func(t *testing.T) {
_manager := mocks_services.NewManager(t)
_forge := mocks_forge.NewForge(t)
_store := mocks_store.NewStore(t)
// _manager := new(mocks_services.MockManager)
_manager := new(mocks_services.MockManager)
_forge := new(forge_mocks.MockForge)
_store := new(store_mocks.MockStore)
server.Config.Services.Manager = _manager
server.Config.Permissions.Open = true
server.Config.Permissions.Orgs = permissions.NewOrgs(nil)
@ -139,9 +140,9 @@ func TestHandleAuth(t *testing.T) {
})
t.Run("should register a new user", func(t *testing.T) {
_manager := mocks_services.NewManager(t)
_forge := mocks_forge.NewForge(t)
_store := mocks_store.NewStore(t)
_manager := new(mocks_services.MockManager)
_forge := new(forge_mocks.MockForge)
_store := new(store_mocks.MockStore)
server.Config.Services.Manager = _manager
server.Config.Permissions.Open = true
server.Config.Permissions.Orgs = permissions.NewOrgs(nil)
@ -173,9 +174,9 @@ func TestHandleAuth(t *testing.T) {
})
t.Run("should login an existing user", func(t *testing.T) {
_manager := mocks_services.NewManager(t)
_forge := mocks_forge.NewForge(t)
_store := mocks_store.NewStore(t)
_manager := new(mocks_services.MockManager)
_forge := new(forge_mocks.MockForge)
_store := new(store_mocks.MockStore)
server.Config.Services.Manager = _manager
server.Config.Permissions.Open = true
server.Config.Permissions.Orgs = permissions.NewOrgs(nil)
@ -205,9 +206,9 @@ func TestHandleAuth(t *testing.T) {
})
t.Run("should deny a new user if registration is closed", func(t *testing.T) {
_manager := mocks_services.NewManager(t)
_forge := mocks_forge.NewForge(t)
_store := mocks_store.NewStore(t)
_manager := new(mocks_services.MockManager)
_forge := new(forge_mocks.MockForge)
_store := new(store_mocks.MockStore)
server.Config.Services.Manager = _manager
server.Config.Permissions.Open = false
server.Config.Permissions.Orgs = permissions.NewOrgs(nil)
@ -233,9 +234,9 @@ func TestHandleAuth(t *testing.T) {
})
t.Run("should deny a user with missing org access", func(t *testing.T) {
_manager := mocks_services.NewManager(t)
_forge := mocks_forge.NewForge(t)
_store := mocks_store.NewStore(t)
_manager := new(mocks_services.MockManager)
_forge := new(forge_mocks.MockForge)
_store := new(store_mocks.MockStore)
server.Config.Services.Manager = _manager
server.Config.Permissions.Open = true
server.Config.Permissions.Orgs = permissions.NewOrgs([]string{"org1"})
@ -265,9 +266,9 @@ func TestHandleAuth(t *testing.T) {
})
t.Run("User org should be created if it does not exists", func(t *testing.T) {
_manager := mocks_services.NewManager(t)
_forge := mocks_forge.NewForge(t)
_store := mocks_store.NewStore(t)
_manager := new(mocks_services.MockManager)
_forge := new(forge_mocks.MockForge)
_store := new(store_mocks.MockStore)
server.Config.Services.Manager = _manager
server.Config.Permissions.Open = true
server.Config.Permissions.Orgs = permissions.NewOrgs(nil)
@ -299,9 +300,9 @@ func TestHandleAuth(t *testing.T) {
})
t.Run("User org should be linked if it has the same name as the user", func(t *testing.T) {
_manager := mocks_services.NewManager(t)
_forge := mocks_forge.NewForge(t)
_store := mocks_store.NewStore(t)
_manager := new(mocks_services.MockManager)
_forge := new(forge_mocks.MockForge)
_store := new(store_mocks.MockStore)
server.Config.Services.Manager = _manager
server.Config.Permissions.Open = true
server.Config.Permissions.Orgs = permissions.NewOrgs(nil)
@ -333,9 +334,9 @@ func TestHandleAuth(t *testing.T) {
})
t.Run("User org should be updated if the user name was changed", func(t *testing.T) {
_manager := mocks_services.NewManager(t)
_forge := mocks_forge.NewForge(t)
_store := mocks_store.NewStore(t)
_manager := new(mocks_services.MockManager)
_forge := new(forge_mocks.MockForge)
_store := new(store_mocks.MockStore)
server.Config.Services.Manager = _manager
server.Config.Permissions.Open = true
server.Config.Permissions.Orgs = permissions.NewOrgs(nil)

View File

@ -45,7 +45,7 @@ func TestGetPipelines(t *testing.T) {
t.Run("should get pipelines", func(t *testing.T) {
pipelines := []*model.Pipeline{fakePipeline}
mockStore := store_mocks.NewStore(t)
mockStore := new(store_mocks.MockStore)
mockStore.On("GetPipelineList", mock.Anything, mock.Anything, mock.Anything).Return(pipelines, nil)
w := httptest.NewRecorder()
@ -70,7 +70,7 @@ func TestGetPipelines(t *testing.T) {
t.Run("should parse pipeline filter", func(t *testing.T) {
pipelines := []*model.Pipeline{fakePipeline}
mockStore := store_mocks.NewStore(t)
mockStore := new(store_mocks.MockStore)
mockStore.On("GetPipelineList", mock.Anything, mock.Anything, mock.Anything).Return(pipelines, nil)
c, _ := gin.CreateTestContext(httptest.NewRecorder())
@ -85,7 +85,7 @@ func TestGetPipelines(t *testing.T) {
t.Run("should parse pipeline filter with tz offset", func(t *testing.T) {
pipelines := []*model.Pipeline{fakePipeline}
mockStore := store_mocks.NewStore(t)
mockStore := new(store_mocks.MockStore)
mockStore.On("GetPipelineList", mock.Anything, mock.Anything, mock.Anything).Return(pipelines, nil)
c, _ := gin.CreateTestContext(httptest.NewRecorder())
@ -99,7 +99,7 @@ func TestGetPipelines(t *testing.T) {
t.Run("should filter pipelines by events", func(t *testing.T) {
pipelines := []*model.Pipeline{fakePipeline}
mockStore := store_mocks.NewStore(t)
mockStore := new(store_mocks.MockStore)
mockStore.On("GetPipelineList", mock.Anything, mock.Anything, mock.Anything).Return(pipelines, nil)
w := httptest.NewRecorder()
@ -120,7 +120,7 @@ func TestDeletePipeline(t *testing.T) {
gin.SetMode(gin.TestMode)
t.Run("should delete pipeline", func(t *testing.T) {
mockStore := store_mocks.NewStore(t)
mockStore := new(store_mocks.MockStore)
mockStore.On("GetPipelineNumber", mock.Anything, mock.Anything).Return(fakePipeline, nil)
mockStore.On("DeletePipeline", mock.Anything).Return(nil)
@ -147,7 +147,7 @@ func TestDeletePipeline(t *testing.T) {
fakePipeline := *fakePipeline
fakePipeline.Status = model.StatusPending
mockStore := store_mocks.NewStore(t)
mockStore := new(store_mocks.MockStore)
mockStore.On("GetPipelineNumber", mock.Anything, mock.Anything).Return(&fakePipeline, nil)
c, _ := gin.CreateTestContext(httptest.NewRecorder())
@ -173,15 +173,16 @@ func TestGetPipelineMetadata(t *testing.T) {
fakeRepo := &model.Repo{ID: 1}
mockForge := forge_mocks.NewForge(t)
// mockForge := forge_new(forge_mocks.MockForge)
mockForge := new(forge_mocks.MockForge)
mockForge.On("Name").Return("mock")
mockForge.On("URL").Return("https://codeberg.org")
mockManager := mocks_manager.NewManager(t)
mockManager := new(mocks_manager.MockManager)
mockManager.On("ForgeFromRepo", fakeRepo).Return(mockForge, nil)
server.Config.Services.Manager = mockManager
mockStore := store_mocks.NewStore(t)
mockStore := new(store_mocks.MockStore)
mockStore.On("GetPipelineNumber", mock.Anything, int64(2)).Return(fakePipeline, nil)
mockStore.On("GetPipelineLastBefore", mock.Anything, mock.Anything, int64(2)).Return(prevPipeline, nil)
@ -218,7 +219,7 @@ func TestGetPipelineMetadata(t *testing.T) {
})
t.Run("should return not found for non-existent pipeline", func(t *testing.T) {
mockStore := store_mocks.NewStore(t)
mockStore := new(store_mocks.MockStore)
mockStore.On("GetPipelineNumber", mock.Anything, int64(3)).Return((*model.Pipeline)(nil), types.RecordNotExist)
w := httptest.NewRecorder()

View File

@ -0,0 +1,100 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package cache
import (
context "context"
forge "codeberg.org/crowci/crow/v3/server/forge"
mock "github.com/stretchr/testify/mock"
model "codeberg.org/crowci/crow/v3/server/model"
)
// MockMembershipService is an autogenerated mock type for the MembershipService type
type MockMembershipService struct {
mock.Mock
}
type MockMembershipService_Expecter struct {
mock *mock.Mock
}
func (_m *MockMembershipService) EXPECT() *MockMembershipService_Expecter {
return &MockMembershipService_Expecter{mock: &_m.Mock}
}
// Get provides a mock function with given fields: ctx, _forge, u, org
func (_m *MockMembershipService) Get(ctx context.Context, _forge forge.Forge, u *model.User, org string) (*model.OrgPerm, error) {
ret := _m.Called(ctx, _forge, u, org)
if len(ret) == 0 {
panic("no return value specified for Get")
}
var r0 *model.OrgPerm
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, forge.Forge, *model.User, string) (*model.OrgPerm, error)); ok {
return rf(ctx, _forge, u, org)
}
if rf, ok := ret.Get(0).(func(context.Context, forge.Forge, *model.User, string) *model.OrgPerm); ok {
r0 = rf(ctx, _forge, u, org)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.OrgPerm)
}
}
if rf, ok := ret.Get(1).(func(context.Context, forge.Forge, *model.User, string) error); ok {
r1 = rf(ctx, _forge, u, org)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockMembershipService_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
type MockMembershipService_Get_Call struct {
*mock.Call
}
// Get is a helper method to define mock.On call
// - ctx context.Context
// - _forge forge.Forge
// - u *model.User
// - org string
func (_e *MockMembershipService_Expecter) Get(ctx interface{}, _forge interface{}, u interface{}, org interface{}) *MockMembershipService_Get_Call {
return &MockMembershipService_Get_Call{Call: _e.mock.On("Get", ctx, _forge, u, org)}
}
func (_c *MockMembershipService_Get_Call) Run(run func(ctx context.Context, _forge forge.Forge, u *model.User, org string)) *MockMembershipService_Get_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(forge.Forge), args[2].(*model.User), args[3].(string))
})
return _c
}
func (_c *MockMembershipService_Get_Call) Return(_a0 *model.OrgPerm, _a1 error) *MockMembershipService_Get_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockMembershipService_Get_Call) RunAndReturn(run func(context.Context, forge.Forge, *model.User, string) (*model.OrgPerm, error)) *MockMembershipService_Get_Call {
_c.Call.Return(run)
return _c
}
// NewMockMembershipService creates a new instance of MockMembershipService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockMembershipService(t interface {
mock.TestingT
Cleanup(func())
}) *MockMembershipService {
mock := &MockMembershipService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -23,16 +23,16 @@ import (
"github.com/stretchr/testify/mock"
"codeberg.org/crowci/crow/v3/server"
mocks_forge "codeberg.org/crowci/crow/v3/server/forge/mocks"
forge_mocks "codeberg.org/crowci/crow/v3/server/forge/mocks"
"codeberg.org/crowci/crow/v3/server/model"
mocks_manager "codeberg.org/crowci/crow/v3/server/services/mocks"
mocks_store "codeberg.org/crowci/crow/v3/server/store/mocks"
store_mocks "codeberg.org/crowci/crow/v3/server/store/mocks"
)
func TestCreatePipeline(t *testing.T) {
_manager := mocks_manager.NewManager(t)
_forge := mocks_forge.NewForge(t)
store := mocks_store.NewStore(t)
_manager := new(mocks_manager.MockManager)
_forge := new(forge_mocks.MockForge)
store := new(store_mocks.MockStore)
ctx := context.Background()
creator := &model.User{

View File

@ -28,7 +28,7 @@ import (
"codeberg.org/crowci/crow/v3/server/forge/forgejo/fixtures"
"codeberg.org/crowci/crow/v3/server/model"
"codeberg.org/crowci/crow/v3/server/store"
mocks_store "codeberg.org/crowci/crow/v3/server/store/mocks"
store_mocks "codeberg.org/crowci/crow/v3/server/store/mocks"
)
func TestNew(t *testing.T) {
@ -52,7 +52,7 @@ func Test_forgejo(t *testing.T) {
SkipVerify: true,
})
mockStore := mocks_store.NewStore(t)
mockStore := new(store_mocks.MockStore)
ctx := store.InjectToContext(context.Background(), mockStore)
t.Run("netrc with user token", func(t *testing.T) {

View File

@ -29,7 +29,7 @@ import (
"codeberg.org/crowci/crow/v3/server/forge/gitea/fixtures"
"codeberg.org/crowci/crow/v3/server/model"
"codeberg.org/crowci/crow/v3/server/store"
mocks_store "codeberg.org/crowci/crow/v3/server/store/mocks"
store_mocks "codeberg.org/crowci/crow/v3/server/store/mocks"
)
func TestNew(t *testing.T) {
@ -53,7 +53,7 @@ func Test_gitea(t *testing.T) {
SkipVerify: true,
})
mockStore := mocks_store.NewStore(t)
mockStore := new(store_mocks.MockStore)
ctx := store.InjectToContext(context.Background(), mockStore)
t.Run("netrc with user token", func(t *testing.T) {

View File

@ -1,58 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
context "context"
mock "github.com/stretchr/testify/mock"
model "codeberg.org/crowci/crow/v3/server/model"
)
// Refresher is an autogenerated mock type for the Refresher type
type Refresher struct {
mock.Mock
}
// Refresh provides a mock function with given fields: _a0, _a1
func (_m *Refresher) Refresh(_a0 context.Context, _a1 *model.User) (bool, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Refresh")
}
var r0 bool
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User) (bool, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User) bool); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewRefresher creates a new instance of Refresher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewRefresher(t interface {
mock.TestingT
Cleanup(func())
}) *Refresher {
mock := &Refresher{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,561 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
//go:build test
// +build test
package mocks
import (
context "context"
http "net/http"
mock "github.com/stretchr/testify/mock"
model "codeberg.org/crowci/crow/v3/server/model"
types "codeberg.org/crowci/crow/v3/server/forge/types"
)
// Forge is an autogenerated mock type for the Forge type
type Forge struct {
mock.Mock
}
// Activate provides a mock function with given fields: ctx, u, r, link
func (_m *Forge) Activate(ctx context.Context, u *model.User, r *model.Repo, link string) error {
ret := _m.Called(ctx, u, r, link)
if len(ret) == 0 {
panic("no return value specified for Activate")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, string) error); ok {
r0 = rf(ctx, u, r, link)
} else {
r0 = ret.Error(0)
}
return r0
}
// Auth provides a mock function with given fields: ctx, token, secret
func (_m *Forge) Auth(ctx context.Context, token string, secret string) (string, error) {
ret := _m.Called(ctx, token, secret)
if len(ret) == 0 {
panic("no return value specified for Auth")
}
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) (string, error)); ok {
return rf(ctx, token, secret)
}
if rf, ok := ret.Get(0).(func(context.Context, string, string) string); ok {
r0 = rf(ctx, token, secret)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
r1 = rf(ctx, token, secret)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// BranchHead provides a mock function with given fields: ctx, u, r, branch
func (_m *Forge) BranchHead(ctx context.Context, u *model.User, r *model.Repo, branch string) (*model.Commit, error) {
ret := _m.Called(ctx, u, r, branch)
if len(ret) == 0 {
panic("no return value specified for BranchHead")
}
var r0 *model.Commit
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, string) (*model.Commit, error)); ok {
return rf(ctx, u, r, branch)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, string) *model.Commit); ok {
r0 = rf(ctx, u, r, branch)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Commit)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User, *model.Repo, string) error); ok {
r1 = rf(ctx, u, r, branch)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Branches provides a mock function with given fields: ctx, u, r, p
func (_m *Forge) Branches(ctx context.Context, u *model.User, r *model.Repo, p *model.ListOptions) ([]string, error) {
ret := _m.Called(ctx, u, r, p)
if len(ret) == 0 {
panic("no return value specified for Branches")
}
var r0 []string
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.ListOptions) ([]string, error)); ok {
return rf(ctx, u, r, p)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.ListOptions) []string); ok {
r0 = rf(ctx, u, r, p)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]string)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User, *model.Repo, *model.ListOptions) error); ok {
r1 = rf(ctx, u, r, p)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Deactivate provides a mock function with given fields: ctx, u, r, link
func (_m *Forge) Deactivate(ctx context.Context, u *model.User, r *model.Repo, link string) error {
ret := _m.Called(ctx, u, r, link)
if len(ret) == 0 {
panic("no return value specified for Deactivate")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, string) error); ok {
r0 = rf(ctx, u, r, link)
} else {
r0 = ret.Error(0)
}
return r0
}
// Dir provides a mock function with given fields: ctx, u, r, b, f
func (_m *Forge) Dir(ctx context.Context, u *model.User, r *model.Repo, b *model.Pipeline, f string) ([]*types.FileMeta, error) {
ret := _m.Called(ctx, u, r, b, f)
if len(ret) == 0 {
panic("no return value specified for Dir")
}
var r0 []*types.FileMeta
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) ([]*types.FileMeta, error)); ok {
return rf(ctx, u, r, b, f)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) []*types.FileMeta); ok {
r0 = rf(ctx, u, r, b, f)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*types.FileMeta)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) error); ok {
r1 = rf(ctx, u, r, b, f)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// File provides a mock function with given fields: ctx, u, r, b, f
func (_m *Forge) File(ctx context.Context, u *model.User, r *model.Repo, b *model.Pipeline, f string) ([]byte, error) {
ret := _m.Called(ctx, u, r, b, f)
if len(ret) == 0 {
panic("no return value specified for File")
}
var r0 []byte
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) ([]byte, error)); ok {
return rf(ctx, u, r, b, f)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) []byte); ok {
r0 = rf(ctx, u, r, b, f)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]byte)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) error); ok {
r1 = rf(ctx, u, r, b, f)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Hook provides a mock function with given fields: ctx, r
func (_m *Forge) Hook(ctx context.Context, r *http.Request) (*model.Repo, *model.Pipeline, error) {
ret := _m.Called(ctx, r)
if len(ret) == 0 {
panic("no return value specified for Hook")
}
var r0 *model.Repo
var r1 *model.Pipeline
var r2 error
if rf, ok := ret.Get(0).(func(context.Context, *http.Request) (*model.Repo, *model.Pipeline, error)); ok {
return rf(ctx, r)
}
if rf, ok := ret.Get(0).(func(context.Context, *http.Request) *model.Repo); ok {
r0 = rf(ctx, r)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Repo)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *http.Request) *model.Pipeline); ok {
r1 = rf(ctx, r)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.Pipeline)
}
}
if rf, ok := ret.Get(2).(func(context.Context, *http.Request) error); ok {
r2 = rf(ctx, r)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// Login provides a mock function with given fields: ctx, r
func (_m *Forge) Login(ctx context.Context, r *types.OAuthRequest) (*model.User, string, error) {
ret := _m.Called(ctx, r)
if len(ret) == 0 {
panic("no return value specified for Login")
}
var r0 *model.User
var r1 string
var r2 error
if rf, ok := ret.Get(0).(func(context.Context, *types.OAuthRequest) (*model.User, string, error)); ok {
return rf(ctx, r)
}
if rf, ok := ret.Get(0).(func(context.Context, *types.OAuthRequest) *model.User); ok {
r0 = rf(ctx, r)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.User)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *types.OAuthRequest) string); ok {
r1 = rf(ctx, r)
} else {
r1 = ret.Get(1).(string)
}
if rf, ok := ret.Get(2).(func(context.Context, *types.OAuthRequest) error); ok {
r2 = rf(ctx, r)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// Name provides a mock function with given fields:
func (_m *Forge) Name() string {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Name")
}
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// Netrc provides a mock function with given fields: u, r
func (_m *Forge) Netrc(u *model.User, r *model.Repo) (*model.Netrc, error) {
ret := _m.Called(u, r)
if len(ret) == 0 {
panic("no return value specified for Netrc")
}
var r0 *model.Netrc
var r1 error
if rf, ok := ret.Get(0).(func(*model.User, *model.Repo) (*model.Netrc, error)); ok {
return rf(u, r)
}
if rf, ok := ret.Get(0).(func(*model.User, *model.Repo) *model.Netrc); ok {
r0 = rf(u, r)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Netrc)
}
}
if rf, ok := ret.Get(1).(func(*model.User, *model.Repo) error); ok {
r1 = rf(u, r)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Org provides a mock function with given fields: ctx, u, org
func (_m *Forge) Org(ctx context.Context, u *model.User, org string) (*model.Org, error) {
ret := _m.Called(ctx, u, org)
if len(ret) == 0 {
panic("no return value specified for Org")
}
var r0 *model.Org
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, string) (*model.Org, error)); ok {
return rf(ctx, u, org)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, string) *model.Org); ok {
r0 = rf(ctx, u, org)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Org)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User, string) error); ok {
r1 = rf(ctx, u, org)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// OrgMembership provides a mock function with given fields: ctx, u, org
func (_m *Forge) OrgMembership(ctx context.Context, u *model.User, org string) (*model.OrgPerm, error) {
ret := _m.Called(ctx, u, org)
if len(ret) == 0 {
panic("no return value specified for OrgMembership")
}
var r0 *model.OrgPerm
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, string) (*model.OrgPerm, error)); ok {
return rf(ctx, u, org)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, string) *model.OrgPerm); ok {
r0 = rf(ctx, u, org)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.OrgPerm)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User, string) error); ok {
r1 = rf(ctx, u, org)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// PullRequests provides a mock function with given fields: ctx, u, r, p
func (_m *Forge) PullRequests(ctx context.Context, u *model.User, r *model.Repo, p *model.ListOptions) ([]*model.PullRequest, error) {
ret := _m.Called(ctx, u, r, p)
if len(ret) == 0 {
panic("no return value specified for PullRequests")
}
var r0 []*model.PullRequest
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.ListOptions) ([]*model.PullRequest, error)); ok {
return rf(ctx, u, r, p)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.ListOptions) []*model.PullRequest); ok {
r0 = rf(ctx, u, r, p)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.PullRequest)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User, *model.Repo, *model.ListOptions) error); ok {
r1 = rf(ctx, u, r, p)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Repo provides a mock function with given fields: ctx, u, remoteID, owner, name
func (_m *Forge) Repo(ctx context.Context, u *model.User, remoteID model.ForgeRemoteID, owner string, name string) (*model.Repo, error) {
ret := _m.Called(ctx, u, remoteID, owner, name)
if len(ret) == 0 {
panic("no return value specified for Repo")
}
var r0 *model.Repo
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, model.ForgeRemoteID, string, string) (*model.Repo, error)); ok {
return rf(ctx, u, remoteID, owner, name)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, model.ForgeRemoteID, string, string) *model.Repo); ok {
r0 = rf(ctx, u, remoteID, owner, name)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Repo)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User, model.ForgeRemoteID, string, string) error); ok {
r1 = rf(ctx, u, remoteID, owner, name)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Repos provides a mock function with given fields: ctx, u
func (_m *Forge) Repos(ctx context.Context, u *model.User) ([]*model.Repo, error) {
ret := _m.Called(ctx, u)
if len(ret) == 0 {
panic("no return value specified for Repos")
}
var r0 []*model.Repo
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User) ([]*model.Repo, error)); ok {
return rf(ctx, u)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User) []*model.Repo); ok {
r0 = rf(ctx, u)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Repo)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User) error); ok {
r1 = rf(ctx, u)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Status provides a mock function with given fields: ctx, u, r, b, p
func (_m *Forge) Status(ctx context.Context, u *model.User, r *model.Repo, b *model.Pipeline, p *model.Workflow) error {
ret := _m.Called(ctx, u, r, b, p)
if len(ret) == 0 {
panic("no return value specified for Status")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, *model.Workflow) error); ok {
r0 = rf(ctx, u, r, b, p)
} else {
r0 = ret.Error(0)
}
return r0
}
// Teams provides a mock function with given fields: ctx, u
func (_m *Forge) Teams(ctx context.Context, u *model.User) ([]*model.Team, error) {
ret := _m.Called(ctx, u)
if len(ret) == 0 {
panic("no return value specified for Teams")
}
var r0 []*model.Team
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User) ([]*model.Team, error)); ok {
return rf(ctx, u)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User) []*model.Team); ok {
r0 = rf(ctx, u)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Team)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User) error); ok {
r1 = rf(ctx, u)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// URL provides a mock function with given fields:
func (_m *Forge) URL() string {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for URL")
}
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// NewForge creates a new instance of Forge. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewForge(t interface {
mock.TestingT
Cleanup(func())
}) *Forge {
mock := &Forge{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,95 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package forge
import (
context "context"
mock "github.com/stretchr/testify/mock"
model "codeberg.org/crowci/crow/v3/server/model"
)
// MockRefresher is an autogenerated mock type for the Refresher type
type MockRefresher struct {
mock.Mock
}
type MockRefresher_Expecter struct {
mock *mock.Mock
}
func (_m *MockRefresher) EXPECT() *MockRefresher_Expecter {
return &MockRefresher_Expecter{mock: &_m.Mock}
}
// Refresh provides a mock function with given fields: _a0, _a1
func (_m *MockRefresher) Refresh(_a0 context.Context, _a1 *model.User) (bool, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Refresh")
}
var r0 bool
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User) (bool, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User) bool); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockRefresher_Refresh_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Refresh'
type MockRefresher_Refresh_Call struct {
*mock.Call
}
// Refresh is a helper method to define mock.On call
// - _a0 context.Context
// - _a1 *model.User
func (_e *MockRefresher_Expecter) Refresh(_a0 interface{}, _a1 interface{}) *MockRefresher_Refresh_Call {
return &MockRefresher_Refresh_Call{Call: _e.mock.On("Refresh", _a0, _a1)}
}
func (_c *MockRefresher_Refresh_Call) Run(run func(_a0 context.Context, _a1 *model.User)) *MockRefresher_Refresh_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*model.User))
})
return _c
}
func (_c *MockRefresher_Refresh_Call) Return(_a0 bool, _a1 error) *MockRefresher_Refresh_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockRefresher_Refresh_Call) RunAndReturn(run func(context.Context, *model.User) (bool, error)) *MockRefresher_Refresh_Call {
_c.Call.Return(run)
return _c
}
// NewMockRefresher creates a new instance of MockRefresher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockRefresher(t interface {
mock.TestingT
Cleanup(func())
}) *MockRefresher {
mock := &MockRefresher{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,335 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package grpc
import (
context "context"
metadata "google.golang.org/grpc/metadata"
mock "github.com/stretchr/testify/mock"
)
// MockStreamContextWrapper is an autogenerated mock type for the StreamContextWrapper type
type MockStreamContextWrapper struct {
mock.Mock
}
type MockStreamContextWrapper_Expecter struct {
mock *mock.Mock
}
func (_m *MockStreamContextWrapper) EXPECT() *MockStreamContextWrapper_Expecter {
return &MockStreamContextWrapper_Expecter{mock: &_m.Mock}
}
// Context provides a mock function with no fields
func (_m *MockStreamContextWrapper) Context() context.Context {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Context")
}
var r0 context.Context
if rf, ok := ret.Get(0).(func() context.Context); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(context.Context)
}
}
return r0
}
// MockStreamContextWrapper_Context_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Context'
type MockStreamContextWrapper_Context_Call struct {
*mock.Call
}
// Context is a helper method to define mock.On call
func (_e *MockStreamContextWrapper_Expecter) Context() *MockStreamContextWrapper_Context_Call {
return &MockStreamContextWrapper_Context_Call{Call: _e.mock.On("Context")}
}
func (_c *MockStreamContextWrapper_Context_Call) Run(run func()) *MockStreamContextWrapper_Context_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockStreamContextWrapper_Context_Call) Return(_a0 context.Context) *MockStreamContextWrapper_Context_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockStreamContextWrapper_Context_Call) RunAndReturn(run func() context.Context) *MockStreamContextWrapper_Context_Call {
_c.Call.Return(run)
return _c
}
// RecvMsg provides a mock function with given fields: m
func (_m *MockStreamContextWrapper) RecvMsg(m any) error {
ret := _m.Called(m)
if len(ret) == 0 {
panic("no return value specified for RecvMsg")
}
var r0 error
if rf, ok := ret.Get(0).(func(any) error); ok {
r0 = rf(m)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockStreamContextWrapper_RecvMsg_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RecvMsg'
type MockStreamContextWrapper_RecvMsg_Call struct {
*mock.Call
}
// RecvMsg is a helper method to define mock.On call
// - m any
func (_e *MockStreamContextWrapper_Expecter) RecvMsg(m interface{}) *MockStreamContextWrapper_RecvMsg_Call {
return &MockStreamContextWrapper_RecvMsg_Call{Call: _e.mock.On("RecvMsg", m)}
}
func (_c *MockStreamContextWrapper_RecvMsg_Call) Run(run func(m any)) *MockStreamContextWrapper_RecvMsg_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(any))
})
return _c
}
func (_c *MockStreamContextWrapper_RecvMsg_Call) Return(_a0 error) *MockStreamContextWrapper_RecvMsg_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockStreamContextWrapper_RecvMsg_Call) RunAndReturn(run func(any) error) *MockStreamContextWrapper_RecvMsg_Call {
_c.Call.Return(run)
return _c
}
// SendHeader provides a mock function with given fields: _a0
func (_m *MockStreamContextWrapper) SendHeader(_a0 metadata.MD) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for SendHeader")
}
var r0 error
if rf, ok := ret.Get(0).(func(metadata.MD) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockStreamContextWrapper_SendHeader_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SendHeader'
type MockStreamContextWrapper_SendHeader_Call struct {
*mock.Call
}
// SendHeader is a helper method to define mock.On call
// - _a0 metadata.MD
func (_e *MockStreamContextWrapper_Expecter) SendHeader(_a0 interface{}) *MockStreamContextWrapper_SendHeader_Call {
return &MockStreamContextWrapper_SendHeader_Call{Call: _e.mock.On("SendHeader", _a0)}
}
func (_c *MockStreamContextWrapper_SendHeader_Call) Run(run func(_a0 metadata.MD)) *MockStreamContextWrapper_SendHeader_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(metadata.MD))
})
return _c
}
func (_c *MockStreamContextWrapper_SendHeader_Call) Return(_a0 error) *MockStreamContextWrapper_SendHeader_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockStreamContextWrapper_SendHeader_Call) RunAndReturn(run func(metadata.MD) error) *MockStreamContextWrapper_SendHeader_Call {
_c.Call.Return(run)
return _c
}
// SendMsg provides a mock function with given fields: m
func (_m *MockStreamContextWrapper) SendMsg(m any) error {
ret := _m.Called(m)
if len(ret) == 0 {
panic("no return value specified for SendMsg")
}
var r0 error
if rf, ok := ret.Get(0).(func(any) error); ok {
r0 = rf(m)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockStreamContextWrapper_SendMsg_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SendMsg'
type MockStreamContextWrapper_SendMsg_Call struct {
*mock.Call
}
// SendMsg is a helper method to define mock.On call
// - m any
func (_e *MockStreamContextWrapper_Expecter) SendMsg(m interface{}) *MockStreamContextWrapper_SendMsg_Call {
return &MockStreamContextWrapper_SendMsg_Call{Call: _e.mock.On("SendMsg", m)}
}
func (_c *MockStreamContextWrapper_SendMsg_Call) Run(run func(m any)) *MockStreamContextWrapper_SendMsg_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(any))
})
return _c
}
func (_c *MockStreamContextWrapper_SendMsg_Call) Return(_a0 error) *MockStreamContextWrapper_SendMsg_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockStreamContextWrapper_SendMsg_Call) RunAndReturn(run func(any) error) *MockStreamContextWrapper_SendMsg_Call {
_c.Call.Return(run)
return _c
}
// SetContext provides a mock function with given fields: _a0
func (_m *MockStreamContextWrapper) SetContext(_a0 context.Context) {
_m.Called(_a0)
}
// MockStreamContextWrapper_SetContext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetContext'
type MockStreamContextWrapper_SetContext_Call struct {
*mock.Call
}
// SetContext is a helper method to define mock.On call
// - _a0 context.Context
func (_e *MockStreamContextWrapper_Expecter) SetContext(_a0 interface{}) *MockStreamContextWrapper_SetContext_Call {
return &MockStreamContextWrapper_SetContext_Call{Call: _e.mock.On("SetContext", _a0)}
}
func (_c *MockStreamContextWrapper_SetContext_Call) Run(run func(_a0 context.Context)) *MockStreamContextWrapper_SetContext_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *MockStreamContextWrapper_SetContext_Call) Return() *MockStreamContextWrapper_SetContext_Call {
_c.Call.Return()
return _c
}
func (_c *MockStreamContextWrapper_SetContext_Call) RunAndReturn(run func(context.Context)) *MockStreamContextWrapper_SetContext_Call {
_c.Run(run)
return _c
}
// SetHeader provides a mock function with given fields: _a0
func (_m *MockStreamContextWrapper) SetHeader(_a0 metadata.MD) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for SetHeader")
}
var r0 error
if rf, ok := ret.Get(0).(func(metadata.MD) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockStreamContextWrapper_SetHeader_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetHeader'
type MockStreamContextWrapper_SetHeader_Call struct {
*mock.Call
}
// SetHeader is a helper method to define mock.On call
// - _a0 metadata.MD
func (_e *MockStreamContextWrapper_Expecter) SetHeader(_a0 interface{}) *MockStreamContextWrapper_SetHeader_Call {
return &MockStreamContextWrapper_SetHeader_Call{Call: _e.mock.On("SetHeader", _a0)}
}
func (_c *MockStreamContextWrapper_SetHeader_Call) Run(run func(_a0 metadata.MD)) *MockStreamContextWrapper_SetHeader_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(metadata.MD))
})
return _c
}
func (_c *MockStreamContextWrapper_SetHeader_Call) Return(_a0 error) *MockStreamContextWrapper_SetHeader_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockStreamContextWrapper_SetHeader_Call) RunAndReturn(run func(metadata.MD) error) *MockStreamContextWrapper_SetHeader_Call {
_c.Call.Return(run)
return _c
}
// SetTrailer provides a mock function with given fields: _a0
func (_m *MockStreamContextWrapper) SetTrailer(_a0 metadata.MD) {
_m.Called(_a0)
}
// MockStreamContextWrapper_SetTrailer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetTrailer'
type MockStreamContextWrapper_SetTrailer_Call struct {
*mock.Call
}
// SetTrailer is a helper method to define mock.On call
// - _a0 metadata.MD
func (_e *MockStreamContextWrapper_Expecter) SetTrailer(_a0 interface{}) *MockStreamContextWrapper_SetTrailer_Call {
return &MockStreamContextWrapper_SetTrailer_Call{Call: _e.mock.On("SetTrailer", _a0)}
}
func (_c *MockStreamContextWrapper_SetTrailer_Call) Run(run func(_a0 metadata.MD)) *MockStreamContextWrapper_SetTrailer_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(metadata.MD))
})
return _c
}
func (_c *MockStreamContextWrapper_SetTrailer_Call) Return() *MockStreamContextWrapper_SetTrailer_Call {
_c.Call.Return()
return _c
}
func (_c *MockStreamContextWrapper_SetTrailer_Call) RunAndReturn(run func(metadata.MD)) *MockStreamContextWrapper_SetTrailer_Call {
_c.Run(run)
return _c
}
// NewMockStreamContextWrapper creates a new instance of MockStreamContextWrapper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockStreamContextWrapper(t interface {
mock.TestingT
Cleanup(func())
}) *MockStreamContextWrapper {
mock := &MockStreamContextWrapper{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -25,12 +25,12 @@ import (
"codeberg.org/crowci/crow/v3/pipeline/rpc"
"codeberg.org/crowci/crow/v3/server/model"
mocks_store "codeberg.org/crowci/crow/v3/server/store/mocks"
store_mocks "codeberg.org/crowci/crow/v3/server/store/mocks"
)
func TestRegisterAgent(t *testing.T) {
t.Run("When existing agent Name is empty it should update Name with hostname from metadata", func(t *testing.T) {
store := mocks_store.NewStore(t)
store := new(store_mocks.MockStore)
storeAgent := new(model.Agent)
storeAgent.ID = 1337
updatedAgent := model.Agent{
@ -71,7 +71,7 @@ func TestRegisterAgent(t *testing.T) {
})
t.Run("When existing agent hostname is present it should not update the hostname", func(t *testing.T) {
store := mocks_store.NewStore(t)
store := new(store_mocks.MockStore)
storeAgent := new(model.Agent)
storeAgent.ID = 1337
storeAgent.Name = "originalHostname"
@ -118,7 +118,7 @@ func TestUpdateAgentLastWork(t *testing.T) {
agent := model.Agent{
LastWork: 0,
}
store := mocks_store.NewStore(t)
store := new(store_mocks.MockStore)
rpc := RPC{
store: store,
}
@ -135,7 +135,7 @@ func TestUpdateAgentLastWork(t *testing.T) {
agent := model.Agent{
LastWork: lastWork,
}
store := mocks_store.NewStore(t)
store := new(store_mocks.MockStore)
rpc := RPC{
store: store,
}

View File

@ -0,0 +1,229 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package logging
import (
context "context"
logging "codeberg.org/crowci/crow/v3/server/logging"
mock "github.com/stretchr/testify/mock"
model "codeberg.org/crowci/crow/v3/server/model"
)
// MockLog is an autogenerated mock type for the Log type
type MockLog struct {
mock.Mock
}
type MockLog_Expecter struct {
mock *mock.Mock
}
func (_m *MockLog) EXPECT() *MockLog_Expecter {
return &MockLog_Expecter{mock: &_m.Mock}
}
// Close provides a mock function with given fields: c, stepID
func (_m *MockLog) Close(c context.Context, stepID int64) error {
ret := _m.Called(c, stepID)
if len(ret) == 0 {
panic("no return value specified for Close")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, int64) error); ok {
r0 = rf(c, stepID)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockLog_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
type MockLog_Close_Call struct {
*mock.Call
}
// Close is a helper method to define mock.On call
// - c context.Context
// - stepID int64
func (_e *MockLog_Expecter) Close(c interface{}, stepID interface{}) *MockLog_Close_Call {
return &MockLog_Close_Call{Call: _e.mock.On("Close", c, stepID)}
}
func (_c *MockLog_Close_Call) Run(run func(c context.Context, stepID int64)) *MockLog_Close_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(int64))
})
return _c
}
func (_c *MockLog_Close_Call) Return(_a0 error) *MockLog_Close_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockLog_Close_Call) RunAndReturn(run func(context.Context, int64) error) *MockLog_Close_Call {
_c.Call.Return(run)
return _c
}
// Open provides a mock function with given fields: c, stepID
func (_m *MockLog) Open(c context.Context, stepID int64) error {
ret := _m.Called(c, stepID)
if len(ret) == 0 {
panic("no return value specified for Open")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, int64) error); ok {
r0 = rf(c, stepID)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockLog_Open_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Open'
type MockLog_Open_Call struct {
*mock.Call
}
// Open is a helper method to define mock.On call
// - c context.Context
// - stepID int64
func (_e *MockLog_Expecter) Open(c interface{}, stepID interface{}) *MockLog_Open_Call {
return &MockLog_Open_Call{Call: _e.mock.On("Open", c, stepID)}
}
func (_c *MockLog_Open_Call) Run(run func(c context.Context, stepID int64)) *MockLog_Open_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(int64))
})
return _c
}
func (_c *MockLog_Open_Call) Return(_a0 error) *MockLog_Open_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockLog_Open_Call) RunAndReturn(run func(context.Context, int64) error) *MockLog_Open_Call {
_c.Call.Return(run)
return _c
}
// Tail provides a mock function with given fields: c, stepID, handler
func (_m *MockLog) Tail(c context.Context, stepID int64, handler logging.LogChan) error {
ret := _m.Called(c, stepID, handler)
if len(ret) == 0 {
panic("no return value specified for Tail")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, int64, logging.LogChan) error); ok {
r0 = rf(c, stepID, handler)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockLog_Tail_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Tail'
type MockLog_Tail_Call struct {
*mock.Call
}
// Tail is a helper method to define mock.On call
// - c context.Context
// - stepID int64
// - handler logging.LogChan
func (_e *MockLog_Expecter) Tail(c interface{}, stepID interface{}, handler interface{}) *MockLog_Tail_Call {
return &MockLog_Tail_Call{Call: _e.mock.On("Tail", c, stepID, handler)}
}
func (_c *MockLog_Tail_Call) Run(run func(c context.Context, stepID int64, handler logging.LogChan)) *MockLog_Tail_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(int64), args[2].(logging.LogChan))
})
return _c
}
func (_c *MockLog_Tail_Call) Return(_a0 error) *MockLog_Tail_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockLog_Tail_Call) RunAndReturn(run func(context.Context, int64, logging.LogChan) error) *MockLog_Tail_Call {
_c.Call.Return(run)
return _c
}
// Write provides a mock function with given fields: c, stepID, entries
func (_m *MockLog) Write(c context.Context, stepID int64, entries []*model.LogEntry) error {
ret := _m.Called(c, stepID, entries)
if len(ret) == 0 {
panic("no return value specified for Write")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, int64, []*model.LogEntry) error); ok {
r0 = rf(c, stepID, entries)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockLog_Write_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Write'
type MockLog_Write_Call struct {
*mock.Call
}
// Write is a helper method to define mock.On call
// - c context.Context
// - stepID int64
// - entries []*model.LogEntry
func (_e *MockLog_Expecter) Write(c interface{}, stepID interface{}, entries interface{}) *MockLog_Write_Call {
return &MockLog_Write_Call{Call: _e.mock.On("Write", c, stepID, entries)}
}
func (_c *MockLog_Write_Call) Run(run func(c context.Context, stepID int64, entries []*model.LogEntry)) *MockLog_Write_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(int64), args[2].([]*model.LogEntry))
})
return _c
}
func (_c *MockLog_Write_Call) Return(_a0 error) *MockLog_Write_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockLog_Write_Call) RunAndReturn(run func(context.Context, int64, []*model.LogEntry) error) *MockLog_Write_Call {
_c.Call.Return(run)
return _c
}
// NewMockLog creates a new instance of MockLog. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockLog(t interface {
mock.TestingT
Cleanup(func())
}) *MockLog {
mock := &MockLog{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,65 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
types "codeberg.org/crowci/crow/v3/server/services/encryption/types"
mock "github.com/stretchr/testify/mock"
)
// EncryptionBuilder is an autogenerated mock type for the EncryptionBuilder type
type EncryptionBuilder struct {
mock.Mock
}
// Build provides a mock function with given fields:
func (_m *EncryptionBuilder) Build() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Build")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// WithClient provides a mock function with given fields: client
func (_m *EncryptionBuilder) WithClient(client types.EncryptionClient) types.EncryptionBuilder {
ret := _m.Called(client)
if len(ret) == 0 {
panic("no return value specified for WithClient")
}
var r0 types.EncryptionBuilder
if rf, ok := ret.Get(0).(func(types.EncryptionClient) types.EncryptionBuilder); ok {
r0 = rf(client)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(types.EncryptionBuilder)
}
}
return r0
}
// NewEncryptionBuilder creates a new instance of EncryptionBuilder. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewEncryptionBuilder(t interface {
mock.TestingT
Cleanup(func())
}) *EncryptionBuilder {
mock := &EncryptionBuilder{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,81 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
types "codeberg.org/crowci/crow/v3/server/services/encryption/types"
mock "github.com/stretchr/testify/mock"
)
// EncryptionClient is an autogenerated mock type for the EncryptionClient type
type EncryptionClient struct {
mock.Mock
}
// EnableEncryption provides a mock function with given fields:
func (_m *EncryptionClient) EnableEncryption() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for EnableEncryption")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// MigrateEncryption provides a mock function with given fields: newEncryption
func (_m *EncryptionClient) MigrateEncryption(newEncryption types.EncryptionService) error {
ret := _m.Called(newEncryption)
if len(ret) == 0 {
panic("no return value specified for MigrateEncryption")
}
var r0 error
if rf, ok := ret.Get(0).(func(types.EncryptionService) error); ok {
r0 = rf(newEncryption)
} else {
r0 = ret.Error(0)
}
return r0
}
// SetEncryptionService provides a mock function with given fields: encryption
func (_m *EncryptionClient) SetEncryptionService(encryption types.EncryptionService) error {
ret := _m.Called(encryption)
if len(ret) == 0 {
panic("no return value specified for SetEncryptionService")
}
var r0 error
if rf, ok := ret.Get(0).(func(types.EncryptionService) error); ok {
r0 = rf(encryption)
} else {
r0 = ret.Error(0)
}
return r0
}
// NewEncryptionClient creates a new instance of EncryptionClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewEncryptionClient(t interface {
mock.TestingT
Cleanup(func())
}) *EncryptionClient {
mock := &EncryptionClient{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,98 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import mock "github.com/stretchr/testify/mock"
// EncryptionService is an autogenerated mock type for the EncryptionService type
type EncryptionService struct {
mock.Mock
}
// Decrypt provides a mock function with given fields: ciphertext, associatedData
func (_m *EncryptionService) Decrypt(ciphertext string, associatedData string) (string, error) {
ret := _m.Called(ciphertext, associatedData)
if len(ret) == 0 {
panic("no return value specified for Decrypt")
}
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(string, string) (string, error)); ok {
return rf(ciphertext, associatedData)
}
if rf, ok := ret.Get(0).(func(string, string) string); ok {
r0 = rf(ciphertext, associatedData)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(string, string) error); ok {
r1 = rf(ciphertext, associatedData)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Disable provides a mock function with given fields:
func (_m *EncryptionService) Disable() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Disable")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// Encrypt provides a mock function with given fields: plaintext, associatedData
func (_m *EncryptionService) Encrypt(plaintext string, associatedData string) (string, error) {
ret := _m.Called(plaintext, associatedData)
if len(ret) == 0 {
panic("no return value specified for Encrypt")
}
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(string, string) (string, error)); ok {
return rf(plaintext, associatedData)
}
if rf, ok := ret.Get(0).(func(string, string) string); ok {
r0 = rf(plaintext, associatedData)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(string, string) error); ok {
r1 = rf(plaintext, associatedData)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewEncryptionService creates a new instance of EncryptionService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewEncryptionService(t interface {
mock.TestingT
Cleanup(func())
}) *EncryptionService {
mock := &EncryptionService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,77 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
types "codeberg.org/crowci/crow/v3/server/services/encryption/types"
mock "github.com/stretchr/testify/mock"
)
// EncryptionServiceBuilder is an autogenerated mock type for the EncryptionServiceBuilder type
type EncryptionServiceBuilder struct {
mock.Mock
}
// Build provides a mock function with given fields:
func (_m *EncryptionServiceBuilder) Build() (types.EncryptionService, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Build")
}
var r0 types.EncryptionService
var r1 error
if rf, ok := ret.Get(0).(func() (types.EncryptionService, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() types.EncryptionService); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(types.EncryptionService)
}
}
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// WithClients provides a mock function with given fields: clients
func (_m *EncryptionServiceBuilder) WithClients(clients []types.EncryptionClient) types.EncryptionServiceBuilder {
ret := _m.Called(clients)
if len(ret) == 0 {
panic("no return value specified for WithClients")
}
var r0 types.EncryptionServiceBuilder
if rf, ok := ret.Get(0).(func([]types.EncryptionClient) types.EncryptionServiceBuilder); ok {
r0 = rf(clients)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(types.EncryptionServiceBuilder)
}
}
return r0
}
// NewEncryptionServiceBuilder creates a new instance of EncryptionServiceBuilder. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewEncryptionServiceBuilder(t interface {
mock.TestingT
Cleanup(func())
}) *EncryptionServiceBuilder {
mock := &EncryptionServiceBuilder{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,55 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
model "codeberg.org/crowci/crow/v3/server/model"
mock "github.com/stretchr/testify/mock"
)
// FilterFn is an autogenerated mock type for the FilterFn type
type FilterFn struct {
mock.Mock
}
// Execute provides a mock function with given fields: _a0
func (_m *FilterFn) Execute(_a0 *model.Task) (bool, int) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for Execute")
}
var r0 bool
var r1 int
if rf, ok := ret.Get(0).(func(*model.Task) (bool, int)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.Task) bool); ok {
r0 = rf(_a0)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(*model.Task) int); ok {
r1 = rf(_a0)
} else {
r1 = ret.Get(1).(int)
}
return r0, r1
}
// NewFilterFn creates a new instance of FilterFn. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewFilterFn(t interface {
mock.TestingT
Cleanup(func())
}) *FilterFn {
mock := &FilterFn{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,558 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
context "context"
http "net/http"
mock "github.com/stretchr/testify/mock"
model "codeberg.org/crowci/crow/v3/server/model"
types "codeberg.org/crowci/crow/v3/server/forge/types"
)
// Forge is an autogenerated mock type for the Forge type
type Forge struct {
mock.Mock
}
// Activate provides a mock function with given fields: ctx, u, r, link
func (_m *Forge) Activate(ctx context.Context, u *model.User, r *model.Repo, link string) error {
ret := _m.Called(ctx, u, r, link)
if len(ret) == 0 {
panic("no return value specified for Activate")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, string) error); ok {
r0 = rf(ctx, u, r, link)
} else {
r0 = ret.Error(0)
}
return r0
}
// Auth provides a mock function with given fields: ctx, token, secret
func (_m *Forge) Auth(ctx context.Context, token string, secret string) (string, error) {
ret := _m.Called(ctx, token, secret)
if len(ret) == 0 {
panic("no return value specified for Auth")
}
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) (string, error)); ok {
return rf(ctx, token, secret)
}
if rf, ok := ret.Get(0).(func(context.Context, string, string) string); ok {
r0 = rf(ctx, token, secret)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
r1 = rf(ctx, token, secret)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// BranchHead provides a mock function with given fields: ctx, u, r, branch
func (_m *Forge) BranchHead(ctx context.Context, u *model.User, r *model.Repo, branch string) (*model.Commit, error) {
ret := _m.Called(ctx, u, r, branch)
if len(ret) == 0 {
panic("no return value specified for BranchHead")
}
var r0 *model.Commit
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, string) (*model.Commit, error)); ok {
return rf(ctx, u, r, branch)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, string) *model.Commit); ok {
r0 = rf(ctx, u, r, branch)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Commit)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User, *model.Repo, string) error); ok {
r1 = rf(ctx, u, r, branch)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Branches provides a mock function with given fields: ctx, u, r, p
func (_m *Forge) Branches(ctx context.Context, u *model.User, r *model.Repo, p *model.ListOptions) ([]string, error) {
ret := _m.Called(ctx, u, r, p)
if len(ret) == 0 {
panic("no return value specified for Branches")
}
var r0 []string
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.ListOptions) ([]string, error)); ok {
return rf(ctx, u, r, p)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.ListOptions) []string); ok {
r0 = rf(ctx, u, r, p)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]string)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User, *model.Repo, *model.ListOptions) error); ok {
r1 = rf(ctx, u, r, p)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Deactivate provides a mock function with given fields: ctx, u, r, link
func (_m *Forge) Deactivate(ctx context.Context, u *model.User, r *model.Repo, link string) error {
ret := _m.Called(ctx, u, r, link)
if len(ret) == 0 {
panic("no return value specified for Deactivate")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, string) error); ok {
r0 = rf(ctx, u, r, link)
} else {
r0 = ret.Error(0)
}
return r0
}
// Dir provides a mock function with given fields: ctx, u, r, b, f
func (_m *Forge) Dir(ctx context.Context, u *model.User, r *model.Repo, b *model.Pipeline, f string) ([]*types.FileMeta, error) {
ret := _m.Called(ctx, u, r, b, f)
if len(ret) == 0 {
panic("no return value specified for Dir")
}
var r0 []*types.FileMeta
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) ([]*types.FileMeta, error)); ok {
return rf(ctx, u, r, b, f)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) []*types.FileMeta); ok {
r0 = rf(ctx, u, r, b, f)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*types.FileMeta)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) error); ok {
r1 = rf(ctx, u, r, b, f)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// File provides a mock function with given fields: ctx, u, r, b, f
func (_m *Forge) File(ctx context.Context, u *model.User, r *model.Repo, b *model.Pipeline, f string) ([]byte, error) {
ret := _m.Called(ctx, u, r, b, f)
if len(ret) == 0 {
panic("no return value specified for File")
}
var r0 []byte
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) ([]byte, error)); ok {
return rf(ctx, u, r, b, f)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) []byte); ok {
r0 = rf(ctx, u, r, b, f)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]byte)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, string) error); ok {
r1 = rf(ctx, u, r, b, f)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Hook provides a mock function with given fields: ctx, r
func (_m *Forge) Hook(ctx context.Context, r *http.Request) (*model.Repo, *model.Pipeline, error) {
ret := _m.Called(ctx, r)
if len(ret) == 0 {
panic("no return value specified for Hook")
}
var r0 *model.Repo
var r1 *model.Pipeline
var r2 error
if rf, ok := ret.Get(0).(func(context.Context, *http.Request) (*model.Repo, *model.Pipeline, error)); ok {
return rf(ctx, r)
}
if rf, ok := ret.Get(0).(func(context.Context, *http.Request) *model.Repo); ok {
r0 = rf(ctx, r)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Repo)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *http.Request) *model.Pipeline); ok {
r1 = rf(ctx, r)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.Pipeline)
}
}
if rf, ok := ret.Get(2).(func(context.Context, *http.Request) error); ok {
r2 = rf(ctx, r)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// Login provides a mock function with given fields: ctx, r
func (_m *Forge) Login(ctx context.Context, r *types.OAuthRequest) (*model.User, string, error) {
ret := _m.Called(ctx, r)
if len(ret) == 0 {
panic("no return value specified for Login")
}
var r0 *model.User
var r1 string
var r2 error
if rf, ok := ret.Get(0).(func(context.Context, *types.OAuthRequest) (*model.User, string, error)); ok {
return rf(ctx, r)
}
if rf, ok := ret.Get(0).(func(context.Context, *types.OAuthRequest) *model.User); ok {
r0 = rf(ctx, r)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.User)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *types.OAuthRequest) string); ok {
r1 = rf(ctx, r)
} else {
r1 = ret.Get(1).(string)
}
if rf, ok := ret.Get(2).(func(context.Context, *types.OAuthRequest) error); ok {
r2 = rf(ctx, r)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// Name provides a mock function with given fields:
func (_m *Forge) Name() string {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Name")
}
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// Netrc provides a mock function with given fields: u, r
func (_m *Forge) Netrc(u *model.User, r *model.Repo) (*model.Netrc, error) {
ret := _m.Called(u, r)
if len(ret) == 0 {
panic("no return value specified for Netrc")
}
var r0 *model.Netrc
var r1 error
if rf, ok := ret.Get(0).(func(*model.User, *model.Repo) (*model.Netrc, error)); ok {
return rf(u, r)
}
if rf, ok := ret.Get(0).(func(*model.User, *model.Repo) *model.Netrc); ok {
r0 = rf(u, r)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Netrc)
}
}
if rf, ok := ret.Get(1).(func(*model.User, *model.Repo) error); ok {
r1 = rf(u, r)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Org provides a mock function with given fields: ctx, u, org
func (_m *Forge) Org(ctx context.Context, u *model.User, org string) (*model.Org, error) {
ret := _m.Called(ctx, u, org)
if len(ret) == 0 {
panic("no return value specified for Org")
}
var r0 *model.Org
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, string) (*model.Org, error)); ok {
return rf(ctx, u, org)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, string) *model.Org); ok {
r0 = rf(ctx, u, org)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Org)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User, string) error); ok {
r1 = rf(ctx, u, org)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// OrgMembership provides a mock function with given fields: ctx, u, org
func (_m *Forge) OrgMembership(ctx context.Context, u *model.User, org string) (*model.OrgPerm, error) {
ret := _m.Called(ctx, u, org)
if len(ret) == 0 {
panic("no return value specified for OrgMembership")
}
var r0 *model.OrgPerm
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, string) (*model.OrgPerm, error)); ok {
return rf(ctx, u, org)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, string) *model.OrgPerm); ok {
r0 = rf(ctx, u, org)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.OrgPerm)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User, string) error); ok {
r1 = rf(ctx, u, org)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// PullRequests provides a mock function with given fields: ctx, u, r, p
func (_m *Forge) PullRequests(ctx context.Context, u *model.User, r *model.Repo, p *model.ListOptions) ([]*model.PullRequest, error) {
ret := _m.Called(ctx, u, r, p)
if len(ret) == 0 {
panic("no return value specified for PullRequests")
}
var r0 []*model.PullRequest
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.ListOptions) ([]*model.PullRequest, error)); ok {
return rf(ctx, u, r, p)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.ListOptions) []*model.PullRequest); ok {
r0 = rf(ctx, u, r, p)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.PullRequest)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User, *model.Repo, *model.ListOptions) error); ok {
r1 = rf(ctx, u, r, p)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Repo provides a mock function with given fields: ctx, u, remoteID, owner, name
func (_m *Forge) Repo(ctx context.Context, u *model.User, remoteID model.ForgeRemoteID, owner string, name string) (*model.Repo, error) {
ret := _m.Called(ctx, u, remoteID, owner, name)
if len(ret) == 0 {
panic("no return value specified for Repo")
}
var r0 *model.Repo
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, model.ForgeRemoteID, string, string) (*model.Repo, error)); ok {
return rf(ctx, u, remoteID, owner, name)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User, model.ForgeRemoteID, string, string) *model.Repo); ok {
r0 = rf(ctx, u, remoteID, owner, name)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Repo)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User, model.ForgeRemoteID, string, string) error); ok {
r1 = rf(ctx, u, remoteID, owner, name)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Repos provides a mock function with given fields: ctx, u
func (_m *Forge) Repos(ctx context.Context, u *model.User) ([]*model.Repo, error) {
ret := _m.Called(ctx, u)
if len(ret) == 0 {
panic("no return value specified for Repos")
}
var r0 []*model.Repo
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User) ([]*model.Repo, error)); ok {
return rf(ctx, u)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User) []*model.Repo); ok {
r0 = rf(ctx, u)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Repo)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User) error); ok {
r1 = rf(ctx, u)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Status provides a mock function with given fields: ctx, u, r, b, p
func (_m *Forge) Status(ctx context.Context, u *model.User, r *model.Repo, b *model.Pipeline, p *model.Workflow) error {
ret := _m.Called(ctx, u, r, b, p)
if len(ret) == 0 {
panic("no return value specified for Status")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User, *model.Repo, *model.Pipeline, *model.Workflow) error); ok {
r0 = rf(ctx, u, r, b, p)
} else {
r0 = ret.Error(0)
}
return r0
}
// Teams provides a mock function with given fields: ctx, u
func (_m *Forge) Teams(ctx context.Context, u *model.User) ([]*model.Team, error) {
ret := _m.Called(ctx, u)
if len(ret) == 0 {
panic("no return value specified for Teams")
}
var r0 []*model.Team
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User) ([]*model.Team, error)); ok {
return rf(ctx, u)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User) []*model.Team); ok {
r0 = rf(ctx, u)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Team)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User) error); ok {
r1 = rf(ctx, u)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// URL provides a mock function with given fields:
func (_m *Forge) URL() string {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for URL")
}
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// NewForge creates a new instance of Forge. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewForge(t interface {
mock.TestingT
Cleanup(func())
}) *Forge {
mock := &Forge{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,103 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
context "context"
logging "codeberg.org/crowci/crow/v3/server/logging"
mock "github.com/stretchr/testify/mock"
model "codeberg.org/crowci/crow/v3/server/model"
)
// Log is an autogenerated mock type for the Log type
type Log struct {
mock.Mock
}
// Close provides a mock function with given fields: c, stepID
func (_m *Log) Close(c context.Context, stepID int64) error {
ret := _m.Called(c, stepID)
if len(ret) == 0 {
panic("no return value specified for Close")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, int64) error); ok {
r0 = rf(c, stepID)
} else {
r0 = ret.Error(0)
}
return r0
}
// Open provides a mock function with given fields: c, stepID
func (_m *Log) Open(c context.Context, stepID int64) error {
ret := _m.Called(c, stepID)
if len(ret) == 0 {
panic("no return value specified for Open")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, int64) error); ok {
r0 = rf(c, stepID)
} else {
r0 = ret.Error(0)
}
return r0
}
// Tail provides a mock function with given fields: c, stepID, handler
func (_m *Log) Tail(c context.Context, stepID int64, handler logging.LogChan) error {
ret := _m.Called(c, stepID, handler)
if len(ret) == 0 {
panic("no return value specified for Tail")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, int64, logging.LogChan) error); ok {
r0 = rf(c, stepID, handler)
} else {
r0 = ret.Error(0)
}
return r0
}
// Write provides a mock function with given fields: c, stepID, entries
func (_m *Log) Write(c context.Context, stepID int64, entries []*model.LogEntry) error {
ret := _m.Called(c, stepID, entries)
if len(ret) == 0 {
panic("no return value specified for Write")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, int64, []*model.LogEntry) error); ok {
r0 = rf(c, stepID, entries)
} else {
r0 = ret.Error(0)
}
return r0
}
// NewLog creates a new instance of Log. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewLog(t interface {
mock.TestingT
Cleanup(func())
}) *Log {
mock := &Log{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,270 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
crypto "crypto"
config "codeberg.org/crowci/crow/v3/server/services/config"
environment "codeberg.org/crowci/crow/v3/server/services/environment"
forge "codeberg.org/crowci/crow/v3/server/forge"
mock "github.com/stretchr/testify/mock"
model "codeberg.org/crowci/crow/v3/server/model"
registry "codeberg.org/crowci/crow/v3/server/services/registry"
secret "codeberg.org/crowci/crow/v3/server/services/secret"
)
// Manager is an autogenerated mock type for the Manager type
type Manager struct {
mock.Mock
}
// ConfigServiceFromRepo provides a mock function with given fields: repo
func (_m *Manager) ConfigServiceFromRepo(repo *model.Repo) config.Service {
ret := _m.Called(repo)
if len(ret) == 0 {
panic("no return value specified for ConfigServiceFromRepo")
}
var r0 config.Service
if rf, ok := ret.Get(0).(func(*model.Repo) config.Service); ok {
r0 = rf(repo)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(config.Service)
}
}
return r0
}
// EnvironmentService provides a mock function with given fields:
func (_m *Manager) EnvironmentService() environment.Service {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for EnvironmentService")
}
var r0 environment.Service
if rf, ok := ret.Get(0).(func() environment.Service); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(environment.Service)
}
}
return r0
}
// ForgeByID provides a mock function with given fields: forgeID
func (_m *Manager) ForgeByID(forgeID int64) (forge.Forge, error) {
ret := _m.Called(forgeID)
if len(ret) == 0 {
panic("no return value specified for ForgeByID")
}
var r0 forge.Forge
var r1 error
if rf, ok := ret.Get(0).(func(int64) (forge.Forge, error)); ok {
return rf(forgeID)
}
if rf, ok := ret.Get(0).(func(int64) forge.Forge); ok {
r0 = rf(forgeID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(forge.Forge)
}
}
if rf, ok := ret.Get(1).(func(int64) error); ok {
r1 = rf(forgeID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ForgeFromRepo provides a mock function with given fields: repo
func (_m *Manager) ForgeFromRepo(repo *model.Repo) (forge.Forge, error) {
ret := _m.Called(repo)
if len(ret) == 0 {
panic("no return value specified for ForgeFromRepo")
}
var r0 forge.Forge
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo) (forge.Forge, error)); ok {
return rf(repo)
}
if rf, ok := ret.Get(0).(func(*model.Repo) forge.Forge); ok {
r0 = rf(repo)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(forge.Forge)
}
}
if rf, ok := ret.Get(1).(func(*model.Repo) error); ok {
r1 = rf(repo)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ForgeFromUser provides a mock function with given fields: user
func (_m *Manager) ForgeFromUser(user *model.User) (forge.Forge, error) {
ret := _m.Called(user)
if len(ret) == 0 {
panic("no return value specified for ForgeFromUser")
}
var r0 forge.Forge
var r1 error
if rf, ok := ret.Get(0).(func(*model.User) (forge.Forge, error)); ok {
return rf(user)
}
if rf, ok := ret.Get(0).(func(*model.User) forge.Forge); ok {
r0 = rf(user)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(forge.Forge)
}
}
if rf, ok := ret.Get(1).(func(*model.User) error); ok {
r1 = rf(user)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// RegistryService provides a mock function with given fields:
func (_m *Manager) RegistryService() registry.Service {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for RegistryService")
}
var r0 registry.Service
if rf, ok := ret.Get(0).(func() registry.Service); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(registry.Service)
}
}
return r0
}
// RegistryServiceFromRepo provides a mock function with given fields: repo
func (_m *Manager) RegistryServiceFromRepo(repo *model.Repo) registry.Service {
ret := _m.Called(repo)
if len(ret) == 0 {
panic("no return value specified for RegistryServiceFromRepo")
}
var r0 registry.Service
if rf, ok := ret.Get(0).(func(*model.Repo) registry.Service); ok {
r0 = rf(repo)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(registry.Service)
}
}
return r0
}
// SecretService provides a mock function with given fields:
func (_m *Manager) SecretService() secret.Service {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for SecretService")
}
var r0 secret.Service
if rf, ok := ret.Get(0).(func() secret.Service); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(secret.Service)
}
}
return r0
}
// SecretServiceFromRepo provides a mock function with given fields: repo
func (_m *Manager) SecretServiceFromRepo(repo *model.Repo) secret.Service {
ret := _m.Called(repo)
if len(ret) == 0 {
panic("no return value specified for SecretServiceFromRepo")
}
var r0 secret.Service
if rf, ok := ret.Get(0).(func(*model.Repo) secret.Service); ok {
r0 = rf(repo)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(secret.Service)
}
}
return r0
}
// SignaturePublicKey provides a mock function with given fields:
func (_m *Manager) SignaturePublicKey() crypto.PublicKey {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for SignaturePublicKey")
}
var r0 crypto.PublicKey
if rf, ok := ret.Get(0).(func() crypto.PublicKey); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(crypto.PublicKey)
}
}
return r0
}
// NewManager creates a new instance of Manager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewManager(t interface {
mock.TestingT
Cleanup(func())
}) *Manager {
mock := &Manager{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,61 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
context "context"
forge "codeberg.org/crowci/crow/v3/server/forge"
mock "github.com/stretchr/testify/mock"
model "codeberg.org/crowci/crow/v3/server/model"
)
// MembershipService is an autogenerated mock type for the MembershipService type
type MembershipService struct {
mock.Mock
}
// Get provides a mock function with given fields: ctx, _forge, u, org
func (_m *MembershipService) Get(ctx context.Context, _forge forge.Forge, u *model.User, org string) (*model.OrgPerm, error) {
ret := _m.Called(ctx, _forge, u, org)
if len(ret) == 0 {
panic("no return value specified for Get")
}
var r0 *model.OrgPerm
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, forge.Forge, *model.User, string) (*model.OrgPerm, error)); ok {
return rf(ctx, _forge, u, org)
}
if rf, ok := ret.Get(0).(func(context.Context, forge.Forge, *model.User, string) *model.OrgPerm); ok {
r0 = rf(ctx, _forge, u, org)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.OrgPerm)
}
}
if rf, ok := ret.Get(1).(func(context.Context, forge.Forge, *model.User, string) error); ok {
r1 = rf(ctx, _forge, u, org)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewMembershipService creates a new instance of MembershipService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMembershipService(t interface {
mock.TestingT
Cleanup(func())
}) *MembershipService {
mock := &MembershipService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,256 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
context "context"
model "codeberg.org/crowci/crow/v3/server/model"
mock "github.com/stretchr/testify/mock"
queue "codeberg.org/crowci/crow/v3/server/queue"
)
// Queue is an autogenerated mock type for the Queue type
type Queue struct {
mock.Mock
}
// Done provides a mock function with given fields: c, id, exitStatus
func (_m *Queue) Done(c context.Context, id string, exitStatus model.StatusValue) error {
ret := _m.Called(c, id, exitStatus)
if len(ret) == 0 {
panic("no return value specified for Done")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, model.StatusValue) error); ok {
r0 = rf(c, id, exitStatus)
} else {
r0 = ret.Error(0)
}
return r0
}
// Error provides a mock function with given fields: c, id, err
func (_m *Queue) Error(c context.Context, id string, err error) error {
ret := _m.Called(c, id, err)
if len(ret) == 0 {
panic("no return value specified for Error")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, error) error); ok {
r0 = rf(c, id, err)
} else {
r0 = ret.Error(0)
}
return r0
}
// ErrorAtOnce provides a mock function with given fields: c, ids, err
func (_m *Queue) ErrorAtOnce(c context.Context, ids []string, err error) error {
ret := _m.Called(c, ids, err)
if len(ret) == 0 {
panic("no return value specified for ErrorAtOnce")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, []string, error) error); ok {
r0 = rf(c, ids, err)
} else {
r0 = ret.Error(0)
}
return r0
}
// Evict provides a mock function with given fields: c, id
func (_m *Queue) Evict(c context.Context, id string) error {
ret := _m.Called(c, id)
if len(ret) == 0 {
panic("no return value specified for Evict")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = rf(c, id)
} else {
r0 = ret.Error(0)
}
return r0
}
// EvictAtOnce provides a mock function with given fields: c, ids
func (_m *Queue) EvictAtOnce(c context.Context, ids []string) error {
ret := _m.Called(c, ids)
if len(ret) == 0 {
panic("no return value specified for EvictAtOnce")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, []string) error); ok {
r0 = rf(c, ids)
} else {
r0 = ret.Error(0)
}
return r0
}
// Extend provides a mock function with given fields: c, agentID, workflowID
func (_m *Queue) Extend(c context.Context, agentID int64, workflowID string) error {
ret := _m.Called(c, agentID, workflowID)
if len(ret) == 0 {
panic("no return value specified for Extend")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, int64, string) error); ok {
r0 = rf(c, agentID, workflowID)
} else {
r0 = ret.Error(0)
}
return r0
}
// Info provides a mock function with given fields: c
func (_m *Queue) Info(c context.Context) queue.InfoT {
ret := _m.Called(c)
if len(ret) == 0 {
panic("no return value specified for Info")
}
var r0 queue.InfoT
if rf, ok := ret.Get(0).(func(context.Context) queue.InfoT); ok {
r0 = rf(c)
} else {
r0 = ret.Get(0).(queue.InfoT)
}
return r0
}
// KickAgentWorkers provides a mock function with given fields: agentID
func (_m *Queue) KickAgentWorkers(agentID int64) {
_m.Called(agentID)
}
// Pause provides a mock function with given fields:
func (_m *Queue) Pause() {
_m.Called()
}
// Poll provides a mock function with given fields: c, agentID, f
func (_m *Queue) Poll(c context.Context, agentID int64, f queue.FilterFn) (*model.Task, error) {
ret := _m.Called(c, agentID, f)
if len(ret) == 0 {
panic("no return value specified for Poll")
}
var r0 *model.Task
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, int64, queue.FilterFn) (*model.Task, error)); ok {
return rf(c, agentID, f)
}
if rf, ok := ret.Get(0).(func(context.Context, int64, queue.FilterFn) *model.Task); ok {
r0 = rf(c, agentID, f)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Task)
}
}
if rf, ok := ret.Get(1).(func(context.Context, int64, queue.FilterFn) error); ok {
r1 = rf(c, agentID, f)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Push provides a mock function with given fields: c, task
func (_m *Queue) Push(c context.Context, task *model.Task) error {
ret := _m.Called(c, task)
if len(ret) == 0 {
panic("no return value specified for Push")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *model.Task) error); ok {
r0 = rf(c, task)
} else {
r0 = ret.Error(0)
}
return r0
}
// PushAtOnce provides a mock function with given fields: c, tasks
func (_m *Queue) PushAtOnce(c context.Context, tasks []*model.Task) error {
ret := _m.Called(c, tasks)
if len(ret) == 0 {
panic("no return value specified for PushAtOnce")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, []*model.Task) error); ok {
r0 = rf(c, tasks)
} else {
r0 = ret.Error(0)
}
return r0
}
// Resume provides a mock function with given fields:
func (_m *Queue) Resume() {
_m.Called()
}
// Wait provides a mock function with given fields: c, id
func (_m *Queue) Wait(c context.Context, id string) error {
ret := _m.Called(c, id)
if len(ret) == 0 {
panic("no return value specified for Wait")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = rf(c, id)
} else {
r0 = ret.Error(0)
}
return r0
}
// NewQueue creates a new instance of Queue. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewQueue(t interface {
mock.TestingT
Cleanup(func())
}) *Queue {
mock := &Queue{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,87 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
model "codeberg.org/crowci/crow/v3/server/model"
mock "github.com/stretchr/testify/mock"
)
// ReadOnlyService is an autogenerated mock type for the ReadOnlyService type
type ReadOnlyService struct {
mock.Mock
}
// GlobalRegistryFind provides a mock function with given fields: _a0
func (_m *ReadOnlyService) GlobalRegistryFind(_a0 string) (*model.Registry, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalRegistryFind")
}
var r0 *model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.Registry, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(string) *model.Registry); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Registry)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GlobalRegistryList provides a mock function with given fields: _a0
func (_m *ReadOnlyService) GlobalRegistryList(_a0 *model.ListOptions) ([]*model.Registry, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalRegistryList")
}
var r0 []*model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(*model.ListOptions) ([]*model.Registry, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.ListOptions) []*model.Registry); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Registry)
}
}
if rf, ok := ret.Get(1).(func(*model.ListOptions) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewReadOnlyService creates a new instance of ReadOnlyService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewReadOnlyService(t interface {
mock.TestingT
Cleanup(func())
}) *ReadOnlyService {
mock := &ReadOnlyService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,32 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
pubsub "codeberg.org/crowci/crow/v3/server/pubsub"
mock "github.com/stretchr/testify/mock"
)
// Receiver is an autogenerated mock type for the Receiver type
type Receiver struct {
mock.Mock
}
// Execute provides a mock function with given fields: _a0
func (_m *Receiver) Execute(_a0 pubsub.Message) {
_m.Called(_a0)
}
// NewReceiver creates a new instance of Receiver. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewReceiver(t interface {
mock.TestingT
Cleanup(func())
}) *Receiver {
mock := &Receiver{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,58 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
context "context"
mock "github.com/stretchr/testify/mock"
model "codeberg.org/crowci/crow/v3/server/model"
)
// Refresher is an autogenerated mock type for the Refresher type
type Refresher struct {
mock.Mock
}
// Refresh provides a mock function with given fields: _a0, _a1
func (_m *Refresher) Refresh(_a0 context.Context, _a1 *model.User) (bool, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Refresh")
}
var r0 bool
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *model.User) (bool, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(context.Context, *model.User) bool); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(context.Context, *model.User) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewRefresher creates a new instance of Refresher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewRefresher(t interface {
mock.TestingT
Cleanup(func())
}) *Refresher {
mock := &Refresher{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,291 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
model "codeberg.org/crowci/crow/v3/server/model"
mock "github.com/stretchr/testify/mock"
)
// SecretStore is an autogenerated mock type for the SecretStore type
type SecretStore struct {
mock.Mock
}
// GlobalSecretFind provides a mock function with given fields: _a0
func (_m *SecretStore) GlobalSecretFind(_a0 string) (*model.Secret, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalSecretFind")
}
var r0 *model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.Secret, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(string) *model.Secret); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GlobalSecretList provides a mock function with given fields: _a0
func (_m *SecretStore) GlobalSecretList(_a0 *model.ListOptions) ([]*model.Secret, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalSecretList")
}
var r0 []*model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(*model.ListOptions) ([]*model.Secret, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.ListOptions) []*model.Secret); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(*model.ListOptions) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// OrgSecretFind provides a mock function with given fields: _a0, _a1
func (_m *SecretStore) OrgSecretFind(_a0 int64, _a1 string) (*model.Secret, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgSecretFind")
}
var r0 *model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(int64, string) (*model.Secret, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(int64, string) *model.Secret); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(int64, string) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// OrgSecretList provides a mock function with given fields: _a0, _a1
func (_m *SecretStore) OrgSecretList(_a0 int64, _a1 *model.ListOptions) ([]*model.Secret, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgSecretList")
}
var r0 []*model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(int64, *model.ListOptions) ([]*model.Secret, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(int64, *model.ListOptions) []*model.Secret); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(int64, *model.ListOptions) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SecretCreate provides a mock function with given fields: _a0
func (_m *SecretStore) SecretCreate(_a0 *model.Secret) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for SecretCreate")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Secret) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// SecretDelete provides a mock function with given fields: _a0
func (_m *SecretStore) SecretDelete(_a0 *model.Secret) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for SecretDelete")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Secret) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// SecretFind provides a mock function with given fields: _a0, _a1
func (_m *SecretStore) SecretFind(_a0 *model.Repo, _a1 string) (*model.Secret, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for SecretFind")
}
var r0 *model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, string) (*model.Secret, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, string) *model.Secret); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(*model.Repo, string) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SecretList provides a mock function with given fields: _a0, _a1, _a2
func (_m *SecretStore) SecretList(_a0 *model.Repo, _a1 bool, _a2 *model.ListOptions) ([]*model.Secret, error) {
ret := _m.Called(_a0, _a1, _a2)
if len(ret) == 0 {
panic("no return value specified for SecretList")
}
var r0 []*model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, bool, *model.ListOptions) ([]*model.Secret, error)); ok {
return rf(_a0, _a1, _a2)
}
if rf, ok := ret.Get(0).(func(*model.Repo, bool, *model.ListOptions) []*model.Secret); ok {
r0 = rf(_a0, _a1, _a2)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(*model.Repo, bool, *model.ListOptions) error); ok {
r1 = rf(_a0, _a1, _a2)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SecretListAll provides a mock function with given fields:
func (_m *SecretStore) SecretListAll() ([]*model.Secret, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for SecretListAll")
}
var r0 []*model.Secret
var r1 error
if rf, ok := ret.Get(0).(func() ([]*model.Secret, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() []*model.Secret); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Secret)
}
}
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SecretUpdate provides a mock function with given fields: _a0
func (_m *SecretStore) SecretUpdate(_a0 *model.Secret) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for SecretUpdate")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Secret) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// NewSecretStore creates a new instance of SecretStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewSecretStore(t interface {
mock.TestingT
Cleanup(func())
}) *SecretStore {
mock := &SecretStore{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,399 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
model "codeberg.org/crowci/crow/v3/server/model"
mock "github.com/stretchr/testify/mock"
)
// Service is an autogenerated mock type for the Service type
type Service struct {
mock.Mock
}
// GlobalSecretCreate provides a mock function with given fields: _a0
func (_m *Service) GlobalSecretCreate(_a0 *model.Secret) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalSecretCreate")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Secret) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// GlobalSecretDelete provides a mock function with given fields: _a0
func (_m *Service) GlobalSecretDelete(_a0 string) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalSecretDelete")
}
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// GlobalSecretFind provides a mock function with given fields: _a0
func (_m *Service) GlobalSecretFind(_a0 string) (*model.Secret, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalSecretFind")
}
var r0 *model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.Secret, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(string) *model.Secret); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GlobalSecretList provides a mock function with given fields: _a0
func (_m *Service) GlobalSecretList(_a0 *model.ListOptions) ([]*model.Secret, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalSecretList")
}
var r0 []*model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(*model.ListOptions) ([]*model.Secret, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.ListOptions) []*model.Secret); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(*model.ListOptions) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GlobalSecretUpdate provides a mock function with given fields: _a0
func (_m *Service) GlobalSecretUpdate(_a0 *model.Secret) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalSecretUpdate")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Secret) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// OrgSecretCreate provides a mock function with given fields: _a0, _a1
func (_m *Service) OrgSecretCreate(_a0 int64, _a1 *model.Secret) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgSecretCreate")
}
var r0 error
if rf, ok := ret.Get(0).(func(int64, *model.Secret) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// OrgSecretDelete provides a mock function with given fields: _a0, _a1
func (_m *Service) OrgSecretDelete(_a0 int64, _a1 string) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgSecretDelete")
}
var r0 error
if rf, ok := ret.Get(0).(func(int64, string) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// OrgSecretFind provides a mock function with given fields: _a0, _a1
func (_m *Service) OrgSecretFind(_a0 int64, _a1 string) (*model.Secret, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgSecretFind")
}
var r0 *model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(int64, string) (*model.Secret, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(int64, string) *model.Secret); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(int64, string) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// OrgSecretList provides a mock function with given fields: _a0, _a1
func (_m *Service) OrgSecretList(_a0 int64, _a1 *model.ListOptions) ([]*model.Secret, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgSecretList")
}
var r0 []*model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(int64, *model.ListOptions) ([]*model.Secret, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(int64, *model.ListOptions) []*model.Secret); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(int64, *model.ListOptions) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// OrgSecretUpdate provides a mock function with given fields: _a0, _a1
func (_m *Service) OrgSecretUpdate(_a0 int64, _a1 *model.Secret) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgSecretUpdate")
}
var r0 error
if rf, ok := ret.Get(0).(func(int64, *model.Secret) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// SecretCreate provides a mock function with given fields: _a0, _a1
func (_m *Service) SecretCreate(_a0 *model.Repo, _a1 *model.Secret) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for SecretCreate")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Repo, *model.Secret) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// SecretDelete provides a mock function with given fields: _a0, _a1
func (_m *Service) SecretDelete(_a0 *model.Repo, _a1 string) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for SecretDelete")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Repo, string) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// SecretFind provides a mock function with given fields: _a0, _a1
func (_m *Service) SecretFind(_a0 *model.Repo, _a1 string) (*model.Secret, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for SecretFind")
}
var r0 *model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, string) (*model.Secret, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, string) *model.Secret); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(*model.Repo, string) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SecretList provides a mock function with given fields: _a0, _a1
func (_m *Service) SecretList(_a0 *model.Repo, _a1 *model.ListOptions) ([]*model.Secret, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for SecretList")
}
var r0 []*model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, *model.ListOptions) ([]*model.Secret, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, *model.ListOptions) []*model.Secret); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(*model.Repo, *model.ListOptions) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SecretListPipeline provides a mock function with given fields: _a0, _a1
func (_m *Service) SecretListPipeline(_a0 *model.Repo, _a1 *model.Pipeline) ([]*model.Secret, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for SecretListPipeline")
}
var r0 []*model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, *model.Pipeline) ([]*model.Secret, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, *model.Pipeline) []*model.Secret); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(*model.Repo, *model.Pipeline) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SecretUpdate provides a mock function with given fields: _a0, _a1
func (_m *Service) SecretUpdate(_a0 *model.Repo, _a1 *model.Secret) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for SecretUpdate")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Repo, *model.Secret) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// NewService creates a new instance of Service. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewService(t interface {
mock.TestingT
Cleanup(func())
}) *Service {
mock := &Service{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,59 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
forge "codeberg.org/crowci/crow/v3/server/forge"
mock "github.com/stretchr/testify/mock"
model "codeberg.org/crowci/crow/v3/server/model"
)
// SetupForge is an autogenerated mock type for the SetupForge type
type SetupForge struct {
mock.Mock
}
// Execute provides a mock function with given fields: _a0
func (_m *SetupForge) Execute(_a0 *model.Forge) (forge.Forge, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for Execute")
}
var r0 forge.Forge
var r1 error
if rf, ok := ret.Get(0).(func(*model.Forge) (forge.Forge, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.Forge) forge.Forge); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(forge.Forge)
}
}
if rf, ok := ret.Get(1).(func(*model.Forge) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewSetupForge creates a new instance of SetupForge. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewSetupForge(t interface {
mock.TestingT
Cleanup(func())
}) *SetupForge {
mock := &SetupForge{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

File diff suppressed because it is too large Load Diff

View File

@ -1,132 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
context "context"
metadata "google.golang.org/grpc/metadata"
mock "github.com/stretchr/testify/mock"
)
// StreamContextWrapper is an autogenerated mock type for the StreamContextWrapper type
type StreamContextWrapper struct {
mock.Mock
}
// Context provides a mock function with given fields:
func (_m *StreamContextWrapper) Context() context.Context {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Context")
}
var r0 context.Context
if rf, ok := ret.Get(0).(func() context.Context); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(context.Context)
}
}
return r0
}
// RecvMsg provides a mock function with given fields: m
func (_m *StreamContextWrapper) RecvMsg(m interface{}) error {
ret := _m.Called(m)
if len(ret) == 0 {
panic("no return value specified for RecvMsg")
}
var r0 error
if rf, ok := ret.Get(0).(func(interface{}) error); ok {
r0 = rf(m)
} else {
r0 = ret.Error(0)
}
return r0
}
// SendHeader provides a mock function with given fields: _a0
func (_m *StreamContextWrapper) SendHeader(_a0 metadata.MD) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for SendHeader")
}
var r0 error
if rf, ok := ret.Get(0).(func(metadata.MD) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// SendMsg provides a mock function with given fields: m
func (_m *StreamContextWrapper) SendMsg(m interface{}) error {
ret := _m.Called(m)
if len(ret) == 0 {
panic("no return value specified for SendMsg")
}
var r0 error
if rf, ok := ret.Get(0).(func(interface{}) error); ok {
r0 = rf(m)
} else {
r0 = ret.Error(0)
}
return r0
}
// SetContext provides a mock function with given fields: _a0
func (_m *StreamContextWrapper) SetContext(_a0 context.Context) {
_m.Called(_a0)
}
// SetHeader provides a mock function with given fields: _a0
func (_m *StreamContextWrapper) SetHeader(_a0 metadata.MD) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for SetHeader")
}
var r0 error
if rf, ok := ret.Get(0).(func(metadata.MD) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// SetTrailer provides a mock function with given fields: _a0
func (_m *StreamContextWrapper) SetTrailer(_a0 metadata.MD) {
_m.Called(_a0)
}
// NewStreamContextWrapper creates a new instance of StreamContextWrapper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewStreamContextWrapper(t interface {
mock.TestingT
Cleanup(func())
}) *StreamContextWrapper {
mock := &StreamContextWrapper{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,583 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package model
import (
model "codeberg.org/crowci/crow/v3/server/model"
mock "github.com/stretchr/testify/mock"
)
// MockSecretStore is an autogenerated mock type for the SecretStore type
type MockSecretStore struct {
mock.Mock
}
type MockSecretStore_Expecter struct {
mock *mock.Mock
}
func (_m *MockSecretStore) EXPECT() *MockSecretStore_Expecter {
return &MockSecretStore_Expecter{mock: &_m.Mock}
}
// GlobalSecretFind provides a mock function with given fields: _a0
func (_m *MockSecretStore) GlobalSecretFind(_a0 string) (*model.Secret, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalSecretFind")
}
var r0 *model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.Secret, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(string) *model.Secret); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockSecretStore_GlobalSecretFind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GlobalSecretFind'
type MockSecretStore_GlobalSecretFind_Call struct {
*mock.Call
}
// GlobalSecretFind is a helper method to define mock.On call
// - _a0 string
func (_e *MockSecretStore_Expecter) GlobalSecretFind(_a0 interface{}) *MockSecretStore_GlobalSecretFind_Call {
return &MockSecretStore_GlobalSecretFind_Call{Call: _e.mock.On("GlobalSecretFind", _a0)}
}
func (_c *MockSecretStore_GlobalSecretFind_Call) Run(run func(_a0 string)) *MockSecretStore_GlobalSecretFind_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string))
})
return _c
}
func (_c *MockSecretStore_GlobalSecretFind_Call) Return(_a0 *model.Secret, _a1 error) *MockSecretStore_GlobalSecretFind_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockSecretStore_GlobalSecretFind_Call) RunAndReturn(run func(string) (*model.Secret, error)) *MockSecretStore_GlobalSecretFind_Call {
_c.Call.Return(run)
return _c
}
// GlobalSecretList provides a mock function with given fields: _a0
func (_m *MockSecretStore) GlobalSecretList(_a0 *model.ListOptions) ([]*model.Secret, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalSecretList")
}
var r0 []*model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(*model.ListOptions) ([]*model.Secret, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.ListOptions) []*model.Secret); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(*model.ListOptions) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockSecretStore_GlobalSecretList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GlobalSecretList'
type MockSecretStore_GlobalSecretList_Call struct {
*mock.Call
}
// GlobalSecretList is a helper method to define mock.On call
// - _a0 *model.ListOptions
func (_e *MockSecretStore_Expecter) GlobalSecretList(_a0 interface{}) *MockSecretStore_GlobalSecretList_Call {
return &MockSecretStore_GlobalSecretList_Call{Call: _e.mock.On("GlobalSecretList", _a0)}
}
func (_c *MockSecretStore_GlobalSecretList_Call) Run(run func(_a0 *model.ListOptions)) *MockSecretStore_GlobalSecretList_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.ListOptions))
})
return _c
}
func (_c *MockSecretStore_GlobalSecretList_Call) Return(_a0 []*model.Secret, _a1 error) *MockSecretStore_GlobalSecretList_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockSecretStore_GlobalSecretList_Call) RunAndReturn(run func(*model.ListOptions) ([]*model.Secret, error)) *MockSecretStore_GlobalSecretList_Call {
_c.Call.Return(run)
return _c
}
// OrgSecretFind provides a mock function with given fields: _a0, _a1
func (_m *MockSecretStore) OrgSecretFind(_a0 int64, _a1 string) (*model.Secret, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgSecretFind")
}
var r0 *model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(int64, string) (*model.Secret, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(int64, string) *model.Secret); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(int64, string) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockSecretStore_OrgSecretFind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OrgSecretFind'
type MockSecretStore_OrgSecretFind_Call struct {
*mock.Call
}
// OrgSecretFind is a helper method to define mock.On call
// - _a0 int64
// - _a1 string
func (_e *MockSecretStore_Expecter) OrgSecretFind(_a0 interface{}, _a1 interface{}) *MockSecretStore_OrgSecretFind_Call {
return &MockSecretStore_OrgSecretFind_Call{Call: _e.mock.On("OrgSecretFind", _a0, _a1)}
}
func (_c *MockSecretStore_OrgSecretFind_Call) Run(run func(_a0 int64, _a1 string)) *MockSecretStore_OrgSecretFind_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(int64), args[1].(string))
})
return _c
}
func (_c *MockSecretStore_OrgSecretFind_Call) Return(_a0 *model.Secret, _a1 error) *MockSecretStore_OrgSecretFind_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockSecretStore_OrgSecretFind_Call) RunAndReturn(run func(int64, string) (*model.Secret, error)) *MockSecretStore_OrgSecretFind_Call {
_c.Call.Return(run)
return _c
}
// OrgSecretList provides a mock function with given fields: _a0, _a1
func (_m *MockSecretStore) OrgSecretList(_a0 int64, _a1 *model.ListOptions) ([]*model.Secret, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgSecretList")
}
var r0 []*model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(int64, *model.ListOptions) ([]*model.Secret, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(int64, *model.ListOptions) []*model.Secret); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(int64, *model.ListOptions) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockSecretStore_OrgSecretList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OrgSecretList'
type MockSecretStore_OrgSecretList_Call struct {
*mock.Call
}
// OrgSecretList is a helper method to define mock.On call
// - _a0 int64
// - _a1 *model.ListOptions
func (_e *MockSecretStore_Expecter) OrgSecretList(_a0 interface{}, _a1 interface{}) *MockSecretStore_OrgSecretList_Call {
return &MockSecretStore_OrgSecretList_Call{Call: _e.mock.On("OrgSecretList", _a0, _a1)}
}
func (_c *MockSecretStore_OrgSecretList_Call) Run(run func(_a0 int64, _a1 *model.ListOptions)) *MockSecretStore_OrgSecretList_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(int64), args[1].(*model.ListOptions))
})
return _c
}
func (_c *MockSecretStore_OrgSecretList_Call) Return(_a0 []*model.Secret, _a1 error) *MockSecretStore_OrgSecretList_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockSecretStore_OrgSecretList_Call) RunAndReturn(run func(int64, *model.ListOptions) ([]*model.Secret, error)) *MockSecretStore_OrgSecretList_Call {
_c.Call.Return(run)
return _c
}
// SecretCreate provides a mock function with given fields: _a0
func (_m *MockSecretStore) SecretCreate(_a0 *model.Secret) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for SecretCreate")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Secret) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockSecretStore_SecretCreate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SecretCreate'
type MockSecretStore_SecretCreate_Call struct {
*mock.Call
}
// SecretCreate is a helper method to define mock.On call
// - _a0 *model.Secret
func (_e *MockSecretStore_Expecter) SecretCreate(_a0 interface{}) *MockSecretStore_SecretCreate_Call {
return &MockSecretStore_SecretCreate_Call{Call: _e.mock.On("SecretCreate", _a0)}
}
func (_c *MockSecretStore_SecretCreate_Call) Run(run func(_a0 *model.Secret)) *MockSecretStore_SecretCreate_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Secret))
})
return _c
}
func (_c *MockSecretStore_SecretCreate_Call) Return(_a0 error) *MockSecretStore_SecretCreate_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockSecretStore_SecretCreate_Call) RunAndReturn(run func(*model.Secret) error) *MockSecretStore_SecretCreate_Call {
_c.Call.Return(run)
return _c
}
// SecretDelete provides a mock function with given fields: _a0
func (_m *MockSecretStore) SecretDelete(_a0 *model.Secret) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for SecretDelete")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Secret) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockSecretStore_SecretDelete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SecretDelete'
type MockSecretStore_SecretDelete_Call struct {
*mock.Call
}
// SecretDelete is a helper method to define mock.On call
// - _a0 *model.Secret
func (_e *MockSecretStore_Expecter) SecretDelete(_a0 interface{}) *MockSecretStore_SecretDelete_Call {
return &MockSecretStore_SecretDelete_Call{Call: _e.mock.On("SecretDelete", _a0)}
}
func (_c *MockSecretStore_SecretDelete_Call) Run(run func(_a0 *model.Secret)) *MockSecretStore_SecretDelete_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Secret))
})
return _c
}
func (_c *MockSecretStore_SecretDelete_Call) Return(_a0 error) *MockSecretStore_SecretDelete_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockSecretStore_SecretDelete_Call) RunAndReturn(run func(*model.Secret) error) *MockSecretStore_SecretDelete_Call {
_c.Call.Return(run)
return _c
}
// SecretFind provides a mock function with given fields: _a0, _a1
func (_m *MockSecretStore) SecretFind(_a0 *model.Repo, _a1 string) (*model.Secret, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for SecretFind")
}
var r0 *model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, string) (*model.Secret, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, string) *model.Secret); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(*model.Repo, string) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockSecretStore_SecretFind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SecretFind'
type MockSecretStore_SecretFind_Call struct {
*mock.Call
}
// SecretFind is a helper method to define mock.On call
// - _a0 *model.Repo
// - _a1 string
func (_e *MockSecretStore_Expecter) SecretFind(_a0 interface{}, _a1 interface{}) *MockSecretStore_SecretFind_Call {
return &MockSecretStore_SecretFind_Call{Call: _e.mock.On("SecretFind", _a0, _a1)}
}
func (_c *MockSecretStore_SecretFind_Call) Run(run func(_a0 *model.Repo, _a1 string)) *MockSecretStore_SecretFind_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Repo), args[1].(string))
})
return _c
}
func (_c *MockSecretStore_SecretFind_Call) Return(_a0 *model.Secret, _a1 error) *MockSecretStore_SecretFind_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockSecretStore_SecretFind_Call) RunAndReturn(run func(*model.Repo, string) (*model.Secret, error)) *MockSecretStore_SecretFind_Call {
_c.Call.Return(run)
return _c
}
// SecretList provides a mock function with given fields: _a0, _a1, _a2
func (_m *MockSecretStore) SecretList(_a0 *model.Repo, _a1 bool, _a2 *model.ListOptions) ([]*model.Secret, error) {
ret := _m.Called(_a0, _a1, _a2)
if len(ret) == 0 {
panic("no return value specified for SecretList")
}
var r0 []*model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, bool, *model.ListOptions) ([]*model.Secret, error)); ok {
return rf(_a0, _a1, _a2)
}
if rf, ok := ret.Get(0).(func(*model.Repo, bool, *model.ListOptions) []*model.Secret); ok {
r0 = rf(_a0, _a1, _a2)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(*model.Repo, bool, *model.ListOptions) error); ok {
r1 = rf(_a0, _a1, _a2)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockSecretStore_SecretList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SecretList'
type MockSecretStore_SecretList_Call struct {
*mock.Call
}
// SecretList is a helper method to define mock.On call
// - _a0 *model.Repo
// - _a1 bool
// - _a2 *model.ListOptions
func (_e *MockSecretStore_Expecter) SecretList(_a0 interface{}, _a1 interface{}, _a2 interface{}) *MockSecretStore_SecretList_Call {
return &MockSecretStore_SecretList_Call{Call: _e.mock.On("SecretList", _a0, _a1, _a2)}
}
func (_c *MockSecretStore_SecretList_Call) Run(run func(_a0 *model.Repo, _a1 bool, _a2 *model.ListOptions)) *MockSecretStore_SecretList_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Repo), args[1].(bool), args[2].(*model.ListOptions))
})
return _c
}
func (_c *MockSecretStore_SecretList_Call) Return(_a0 []*model.Secret, _a1 error) *MockSecretStore_SecretList_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockSecretStore_SecretList_Call) RunAndReturn(run func(*model.Repo, bool, *model.ListOptions) ([]*model.Secret, error)) *MockSecretStore_SecretList_Call {
_c.Call.Return(run)
return _c
}
// SecretListAll provides a mock function with no fields
func (_m *MockSecretStore) SecretListAll() ([]*model.Secret, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for SecretListAll")
}
var r0 []*model.Secret
var r1 error
if rf, ok := ret.Get(0).(func() ([]*model.Secret, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() []*model.Secret); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Secret)
}
}
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockSecretStore_SecretListAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SecretListAll'
type MockSecretStore_SecretListAll_Call struct {
*mock.Call
}
// SecretListAll is a helper method to define mock.On call
func (_e *MockSecretStore_Expecter) SecretListAll() *MockSecretStore_SecretListAll_Call {
return &MockSecretStore_SecretListAll_Call{Call: _e.mock.On("SecretListAll")}
}
func (_c *MockSecretStore_SecretListAll_Call) Run(run func()) *MockSecretStore_SecretListAll_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockSecretStore_SecretListAll_Call) Return(_a0 []*model.Secret, _a1 error) *MockSecretStore_SecretListAll_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockSecretStore_SecretListAll_Call) RunAndReturn(run func() ([]*model.Secret, error)) *MockSecretStore_SecretListAll_Call {
_c.Call.Return(run)
return _c
}
// SecretUpdate provides a mock function with given fields: _a0
func (_m *MockSecretStore) SecretUpdate(_a0 *model.Secret) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for SecretUpdate")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Secret) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockSecretStore_SecretUpdate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SecretUpdate'
type MockSecretStore_SecretUpdate_Call struct {
*mock.Call
}
// SecretUpdate is a helper method to define mock.On call
// - _a0 *model.Secret
func (_e *MockSecretStore_Expecter) SecretUpdate(_a0 interface{}) *MockSecretStore_SecretUpdate_Call {
return &MockSecretStore_SecretUpdate_Call{Call: _e.mock.On("SecretUpdate", _a0)}
}
func (_c *MockSecretStore_SecretUpdate_Call) Run(run func(_a0 *model.Secret)) *MockSecretStore_SecretUpdate_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Secret))
})
return _c
}
func (_c *MockSecretStore_SecretUpdate_Call) Return(_a0 error) *MockSecretStore_SecretUpdate_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockSecretStore_SecretUpdate_Call) RunAndReturn(run func(*model.Secret) error) *MockSecretStore_SecretUpdate_Call {
_c.Call.Return(run)
return _c
}
// NewMockSecretStore creates a new instance of MockSecretStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockSecretStore(t interface {
mock.TestingT
Cleanup(func())
}) *MockSecretStore {
mock := &MockSecretStore{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -25,11 +25,11 @@ import (
"codeberg.org/crowci/crow/v3/server/model"
"codeberg.org/crowci/crow/v3/server/store"
"codeberg.org/crowci/crow/v3/server/store/mocks"
store_mocks "codeberg.org/crowci/crow/v3/server/store/mocks"
)
func mockStorePipeline(t *testing.T) store.Store {
s := mocks.NewStore(t)
func mockStorePipeline() store.Store {
s := new(store_mocks.MockStore)
s.On("UpdatePipeline", mock.Anything).Return(nil)
return s
}
@ -37,7 +37,7 @@ func mockStorePipeline(t *testing.T) store.Store {
func TestUpdateToStatusRunning(t *testing.T) {
t.Parallel()
pipeline, _ := UpdateToStatusRunning(mockStorePipeline(t), model.Pipeline{}, int64(1))
pipeline, _ := UpdateToStatusRunning(mockStorePipeline(), model.Pipeline{}, int64(1))
assert.Equal(t, model.StatusRunning, pipeline.Status)
assert.EqualValues(t, 1, pipeline.Started)
}
@ -47,7 +47,7 @@ func TestUpdateToStatusPending(t *testing.T) {
now := time.Now().Unix()
pipeline, _ := UpdateToStatusPending(mockStorePipeline(t), model.Pipeline{}, "Reviewer")
pipeline, _ := UpdateToStatusPending(mockStorePipeline(), model.Pipeline{}, "Reviewer")
assert.Equal(t, model.StatusPending, pipeline.Status)
assert.Equal(t, "Reviewer", pipeline.Reviewer)
@ -59,7 +59,7 @@ func TestUpdateToStatusDeclined(t *testing.T) {
now := time.Now().Unix()
pipeline, _ := UpdateToStatusDeclined(mockStorePipeline(t), model.Pipeline{}, "Reviewer")
pipeline, _ := UpdateToStatusDeclined(mockStorePipeline(), model.Pipeline{}, "Reviewer")
assert.Equal(t, model.StatusDeclined, pipeline.Status)
assert.Equal(t, "Reviewer", pipeline.Reviewer)
@ -69,7 +69,7 @@ func TestUpdateToStatusDeclined(t *testing.T) {
func TestUpdateToStatusToDone(t *testing.T) {
t.Parallel()
pipeline, _ := UpdateStatusToDone(mockStorePipeline(t), model.Pipeline{}, "status", int64(1))
pipeline, _ := UpdateStatusToDone(mockStorePipeline(), model.Pipeline{}, "status", int64(1))
assert.Equal(t, model.StatusValue("status"), pipeline.Status)
assert.EqualValues(t, 1, pipeline.Finished)
@ -80,7 +80,7 @@ func TestUpdateToStatusError(t *testing.T) {
now := time.Now().Unix()
pipeline, _ := UpdateToStatusError(mockStorePipeline(t), model.Pipeline{}, errors.New("this is an error"))
pipeline, _ := UpdateToStatusError(mockStorePipeline(), model.Pipeline{}, errors.New("this is an error"))
assert.Len(t, pipeline.Errors, 1)
assert.Equal(t, "[generic] this is an error", pipeline.Errors[0].Error())
@ -95,7 +95,7 @@ func TestUpdateToStatusKilled(t *testing.T) {
now := time.Now().Unix()
pipeline, _ := UpdateToStatusKilled(mockStorePipeline(t), model.Pipeline{})
pipeline, _ := UpdateToStatusKilled(mockStorePipeline(), model.Pipeline{})
assert.Equal(t, model.StatusKilled, pipeline.Status)
assert.LessOrEqual(t, now, pipeline.Finished)

View File

@ -26,11 +26,11 @@ import (
"codeberg.org/crowci/crow/v3/pipeline/rpc"
"codeberg.org/crowci/crow/v3/server/model"
"codeberg.org/crowci/crow/v3/server/store"
"codeberg.org/crowci/crow/v3/server/store/mocks"
store_mocks "codeberg.org/crowci/crow/v3/server/store/mocks"
)
func mockStoreStep(t *testing.T) store.Store {
s := mocks.NewStore(t)
func mockStoreStep() store.Store {
s := new(store_mocks.MockStore)
s.On("StepUpdate", mock.Anything).Return(nil)
return s
}
@ -50,7 +50,7 @@ func TestUpdateStepStatusNotExited(t *testing.T) {
Error: "not an error",
}
err := UpdateStepStatus(mockStoreStep(t), step, state)
err := UpdateStepStatus(mockStoreStep(), step, state)
assert.NoError(t, err)
assert.EqualValues(t, model.StatusRunning, step.State)
assert.EqualValues(t, 42, step.Started)
@ -74,7 +74,7 @@ func TestUpdateStepStatusNotExitedButStopped(t *testing.T) {
Error: "not an error",
}
err := UpdateStepStatus(mockStoreStep(t), step, state)
err := UpdateStepStatus(mockStoreStep(), step, state)
assert.NoError(t, err)
assert.EqualValues(t, model.StatusKilled, step.State)
assert.EqualValues(t, 42, step.Started)
@ -98,7 +98,7 @@ func TestUpdateStepStatusExited(t *testing.T) {
Error: "an error",
}
err := UpdateStepStatus(mockStoreStep(t), step, state)
err := UpdateStepStatus(mockStoreStep(), step, state)
assert.NoError(t, err)
assert.EqualValues(t, model.StatusKilled, step.State)
assert.EqualValues(t, 42, step.Started)
@ -121,7 +121,7 @@ func TestUpdateStepStatusExitedButNot137(t *testing.T) {
Error: "an error",
}
err := UpdateStepStatus(mockStoreStep(t), step, state)
err := UpdateStepStatus(mockStoreStep(), step, state)
assert.NoError(t, err)
assert.EqualValues(t, model.StatusFailure, step.State)
assert.EqualValues(t, 42, step.Started)
@ -142,7 +142,7 @@ func TestUpdateStepStatusExitedWithCode(t *testing.T) {
Error: "an error",
}
step := &model.Step{}
err := UpdateStepStatus(mockStoreStep(t), step, state)
err := UpdateStepStatus(mockStoreStep(), step, state)
assert.NoError(t, err)
assert.Equal(t, model.StatusFailure, step.State)
@ -153,7 +153,7 @@ func TestUpdateStepToStatusStarted(t *testing.T) {
t.Parallel()
state := rpc.StepState{Started: int64(42)}
step, _ := UpdateStepToStatusStarted(mockStoreStep(t), model.Step{}, state)
step, _ := UpdateStepToStatusStarted(mockStoreStep(), model.Step{}, state)
assert.Equal(t, model.StatusRunning, step.State)
assert.EqualValues(t, 42, step.Started)
@ -162,7 +162,7 @@ func TestUpdateStepToStatusStarted(t *testing.T) {
func TestUpdateStepToStatusSkipped(t *testing.T) {
t.Parallel()
step, _ := UpdateStepToStatusSkipped(mockStoreStep(t), model.Step{}, int64(1))
step, _ := UpdateStepToStatusSkipped(mockStoreStep(), model.Step{}, int64(1))
assert.Equal(t, model.StatusSkipped, step.State)
assert.EqualValues(t, 0, step.Finished)
@ -175,7 +175,7 @@ func TestUpdateStepToStatusSkippedButStarted(t *testing.T) {
Started: int64(42),
}
step, _ = UpdateStepToStatusSkipped(mockStoreStep(t), *step, int64(1))
step, _ = UpdateStepToStatusSkipped(mockStoreStep(), *step, int64(1))
assert.Equal(t, model.StatusSuccess, step.State)
assert.EqualValues(t, 1, step.Finished)
@ -188,7 +188,7 @@ func TestUpdateStepStatusToDoneSkipped(t *testing.T) {
Finished: int64(34),
}
step, _ := UpdateStepStatusToDone(mockStoreStep(t), model.Step{}, state)
step, _ := UpdateStepStatusToDone(mockStoreStep(), model.Step{}, state)
assert.Equal(t, model.StatusSkipped, step.State)
assert.EqualValues(t, 34, step.Finished)
@ -204,7 +204,7 @@ func TestUpdateStepStatusToDoneSuccess(t *testing.T) {
Finished: int64(34),
}
step, _ := UpdateStepStatusToDone(mockStoreStep(t), model.Step{}, state)
step, _ := UpdateStepStatusToDone(mockStoreStep(), model.Step{}, state)
assert.Equal(t, model.StatusSuccess, step.State)
assert.EqualValues(t, 34, step.Finished)
@ -217,7 +217,7 @@ func TestUpdateStepStatusToDoneFailureWithError(t *testing.T) {
state := rpc.StepState{Error: "an error"}
step, _ := UpdateStepStatusToDone(mockStoreStep(t), model.Step{}, state)
step, _ := UpdateStepStatusToDone(mockStoreStep(), model.Step{}, state)
assert.Equal(t, model.StatusFailure, step.State)
}
@ -227,7 +227,7 @@ func TestUpdateStepStatusToDoneFailureWithExitCode(t *testing.T) {
state := rpc.StepState{ExitCode: 43}
step, _ := UpdateStepStatusToDone(mockStoreStep(t), model.Step{}, state)
step, _ := UpdateStepStatusToDone(mockStoreStep(), model.Step{}, state)
assert.Equal(t, model.StatusFailure, step.State)
}
@ -237,7 +237,7 @@ func TestUpdateStepToStatusKilledStarted(t *testing.T) {
now := time.Now().Unix()
step, _ := UpdateStepToStatusKilled(mockStoreStep(t), model.Step{})
step, _ := UpdateStepToStatusKilled(mockStoreStep(), model.Step{})
assert.Equal(t, model.StatusKilled, step.State)
assert.LessOrEqual(t, now, step.Finished)
@ -248,7 +248,7 @@ func TestUpdateStepToStatusKilledStarted(t *testing.T) {
func TestUpdateStepToStatusKilledNotStarted(t *testing.T) {
t.Parallel()
step, _ := UpdateStepToStatusKilled(mockStoreStep(t), model.Step{Started: int64(1)})
step, _ := UpdateStepToStatusKilled(mockStoreStep(), model.Step{Started: int64(1)})
assert.EqualValues(t, 1, step.Started)
}

View File

@ -20,12 +20,12 @@ import (
"github.com/stretchr/testify/assert"
"codeberg.org/crowci/crow/v3/pipeline/frontend/metadata"
"codeberg.org/crowci/crow/v3/server/forge/mocks"
forge_mocks "codeberg.org/crowci/crow/v3/server/forge/mocks"
"codeberg.org/crowci/crow/v3/server/model"
)
func TestMetadataFromStruct(t *testing.T) {
forge := mocks.NewForge(t)
forge := new(forge_mocks.MockForge)
forge.On("Name").Return("gitea")
forge.On("URL").Return("https://gitea.com")

View File

@ -23,7 +23,7 @@ import (
"codeberg.org/crowci/crow/v3/pipeline/errors"
"codeberg.org/crowci/crow/v3/server/forge"
"codeberg.org/crowci/crow/v3/server/forge/mocks"
forge_mocks "codeberg.org/crowci/crow/v3/server/forge/mocks"
forge_types "codeberg.org/crowci/crow/v3/server/forge/types"
"codeberg.org/crowci/crow/v3/server/model"
)
@ -32,7 +32,7 @@ func TestGlobalEnvsubst(t *testing.T) {
t.Parallel()
b := StepBuilder{
Forge: getMockForge(t),
Forge: getMockForge(),
Envs: map[string]string{
"KEY_K": "VALUE_V",
"IMAGE": "scratch",
@ -71,7 +71,7 @@ func TestMissingGlobalEnvsubst(t *testing.T) {
t.Parallel()
b := StepBuilder{
Forge: getMockForge(t),
Forge: getMockForge(),
Envs: map[string]string{
"KEY_K": "VALUE_V",
"NO_IMAGE": "scratch",
@ -110,7 +110,7 @@ func TestMultilineEnvsubst(t *testing.T) {
t.Parallel()
b := StepBuilder{
Forge: getMockForge(t),
Forge: getMockForge(),
Repo: &model.Repo{},
Curr: &model.Pipeline{
Message: `aaa
@ -154,7 +154,7 @@ func TestMultiPipeline(t *testing.T) {
t.Parallel()
b := StepBuilder{
Forge: getMockForge(t),
Forge: getMockForge(),
Repo: &model.Repo{},
Curr: &model.Pipeline{
Event: model.EventPush,
@ -195,7 +195,7 @@ func TestDependsOn(t *testing.T) {
t.Parallel()
b := StepBuilder{
Forge: getMockForge(t),
Forge: getMockForge(),
Repo: &model.Repo{},
Curr: &model.Pipeline{
Event: model.EventPush,
@ -250,7 +250,7 @@ func TestRunsOn(t *testing.T) {
t.Parallel()
b := StepBuilder{
Forge: getMockForge(t),
Forge: getMockForge(),
Repo: &model.Repo{},
Curr: &model.Pipeline{
Event: model.EventPush,
@ -291,7 +291,7 @@ func TestPipelineName(t *testing.T) {
t.Parallel()
b := StepBuilder{
Forge: getMockForge(t),
Forge: getMockForge(),
Repo: &model.Repo{Config: ".woodpecker"},
Curr: &model.Pipeline{
Event: model.EventPush,
@ -333,7 +333,7 @@ func TestBranchFilter(t *testing.T) {
t.Parallel()
b := StepBuilder{
Forge: getMockForge(t),
Forge: getMockForge(),
Repo: &model.Repo{},
Curr: &model.Pipeline{
Branch: "dev",
@ -379,7 +379,7 @@ func TestRootWhenFilter(t *testing.T) {
t.Parallel()
b := StepBuilder{
Forge: getMockForge(t),
Forge: getMockForge(),
Repo: &model.Repo{},
Curr: &model.Pipeline{Event: "tag"},
Prev: &model.Pipeline{},
@ -429,7 +429,7 @@ func TestZeroSteps(t *testing.T) {
}
b := StepBuilder{
Forge: getMockForge(t),
Forge: getMockForge(),
Repo: &model.Repo{},
Curr: pipeline,
Prev: &model.Pipeline{},
@ -469,7 +469,7 @@ func TestZeroStepsAsMultiPipelineDeps(t *testing.T) {
}
b := StepBuilder{
Forge: getMockForge(t),
Forge: getMockForge(),
Repo: &model.Repo{},
Curr: pipeline,
Prev: &model.Pipeline{},
@ -527,7 +527,7 @@ func TestZeroStepsAsMultiPipelineTransitiveDeps(t *testing.T) {
}
b := StepBuilder{
Forge: getMockForge(t),
Forge: getMockForge(),
Repo: &model.Repo{},
Curr: pipeline,
Prev: &model.Pipeline{},
@ -624,8 +624,8 @@ func TestSanitizePath(t *testing.T) {
}
}
func getMockForge(t *testing.T) forge.Forge {
forge := mocks.NewForge(t)
func getMockForge() forge.Forge {
forge := new(forge_mocks.MockForge)
forge.On("Name").Return("mock")
forge.On("URL").Return("https://codeberg.org")
return forge

View File

@ -0,0 +1,68 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package pubsub
import (
pubsub "codeberg.org/crowci/crow/v3/server/pubsub"
mock "github.com/stretchr/testify/mock"
)
// MockReceiver is an autogenerated mock type for the Receiver type
type MockReceiver struct {
mock.Mock
}
type MockReceiver_Expecter struct {
mock *mock.Mock
}
func (_m *MockReceiver) EXPECT() *MockReceiver_Expecter {
return &MockReceiver_Expecter{mock: &_m.Mock}
}
// Execute provides a mock function with given fields: _a0
func (_m *MockReceiver) Execute(_a0 pubsub.Message) {
_m.Called(_a0)
}
// MockReceiver_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
type MockReceiver_Execute_Call struct {
*mock.Call
}
// Execute is a helper method to define mock.On call
// - _a0 pubsub.Message
func (_e *MockReceiver_Expecter) Execute(_a0 interface{}) *MockReceiver_Execute_Call {
return &MockReceiver_Execute_Call{Call: _e.mock.On("Execute", _a0)}
}
func (_c *MockReceiver_Execute_Call) Run(run func(_a0 pubsub.Message)) *MockReceiver_Execute_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(pubsub.Message))
})
return _c
}
func (_c *MockReceiver_Execute_Call) Return() *MockReceiver_Execute_Call {
_c.Call.Return()
return _c
}
func (_c *MockReceiver_Execute_Call) RunAndReturn(run func(pubsub.Message)) *MockReceiver_Execute_Call {
_c.Run(run)
return _c
}
// NewMockReceiver creates a new instance of MockReceiver. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockReceiver(t interface {
mock.TestingT
Cleanup(func())
}) *MockReceiver {
mock := &MockReceiver{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,91 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package queue
import (
model "codeberg.org/crowci/crow/v3/server/model"
mock "github.com/stretchr/testify/mock"
)
// MockFilterFn is an autogenerated mock type for the FilterFn type
type MockFilterFn struct {
mock.Mock
}
type MockFilterFn_Expecter struct {
mock *mock.Mock
}
func (_m *MockFilterFn) EXPECT() *MockFilterFn_Expecter {
return &MockFilterFn_Expecter{mock: &_m.Mock}
}
// Execute provides a mock function with given fields: _a0
func (_m *MockFilterFn) Execute(_a0 *model.Task) (bool, int) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for Execute")
}
var r0 bool
var r1 int
if rf, ok := ret.Get(0).(func(*model.Task) (bool, int)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.Task) bool); ok {
r0 = rf(_a0)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(*model.Task) int); ok {
r1 = rf(_a0)
} else {
r1 = ret.Get(1).(int)
}
return r0, r1
}
// MockFilterFn_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
type MockFilterFn_Execute_Call struct {
*mock.Call
}
// Execute is a helper method to define mock.On call
// - _a0 *model.Task
func (_e *MockFilterFn_Expecter) Execute(_a0 interface{}) *MockFilterFn_Execute_Call {
return &MockFilterFn_Execute_Call{Call: _e.mock.On("Execute", _a0)}
}
func (_c *MockFilterFn_Execute_Call) Run(run func(_a0 *model.Task)) *MockFilterFn_Execute_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Task))
})
return _c
}
func (_c *MockFilterFn_Execute_Call) Return(_a0 bool, _a1 int) *MockFilterFn_Execute_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockFilterFn_Execute_Call) RunAndReturn(run func(*model.Task) (bool, int)) *MockFilterFn_Execute_Call {
_c.Call.Return(run)
return _c
}
// NewMockFilterFn creates a new instance of MockFilterFn. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockFilterFn(t interface {
mock.TestingT
Cleanup(func())
}) *MockFilterFn {
mock := &MockFilterFn{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,669 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package queue
import (
context "context"
model "codeberg.org/crowci/crow/v3/server/model"
mock "github.com/stretchr/testify/mock"
queue "codeberg.org/crowci/crow/v3/server/queue"
)
// MockQueue is an autogenerated mock type for the Queue type
type MockQueue struct {
mock.Mock
}
type MockQueue_Expecter struct {
mock *mock.Mock
}
func (_m *MockQueue) EXPECT() *MockQueue_Expecter {
return &MockQueue_Expecter{mock: &_m.Mock}
}
// Done provides a mock function with given fields: c, id, exitStatus
func (_m *MockQueue) Done(c context.Context, id string, exitStatus model.StatusValue) error {
ret := _m.Called(c, id, exitStatus)
if len(ret) == 0 {
panic("no return value specified for Done")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, model.StatusValue) error); ok {
r0 = rf(c, id, exitStatus)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockQueue_Done_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Done'
type MockQueue_Done_Call struct {
*mock.Call
}
// Done is a helper method to define mock.On call
// - c context.Context
// - id string
// - exitStatus model.StatusValue
func (_e *MockQueue_Expecter) Done(c interface{}, id interface{}, exitStatus interface{}) *MockQueue_Done_Call {
return &MockQueue_Done_Call{Call: _e.mock.On("Done", c, id, exitStatus)}
}
func (_c *MockQueue_Done_Call) Run(run func(c context.Context, id string, exitStatus model.StatusValue)) *MockQueue_Done_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(model.StatusValue))
})
return _c
}
func (_c *MockQueue_Done_Call) Return(_a0 error) *MockQueue_Done_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockQueue_Done_Call) RunAndReturn(run func(context.Context, string, model.StatusValue) error) *MockQueue_Done_Call {
_c.Call.Return(run)
return _c
}
// Error provides a mock function with given fields: c, id, err
func (_m *MockQueue) Error(c context.Context, id string, err error) error {
ret := _m.Called(c, id, err)
if len(ret) == 0 {
panic("no return value specified for Error")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, error) error); ok {
r0 = rf(c, id, err)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockQueue_Error_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Error'
type MockQueue_Error_Call struct {
*mock.Call
}
// Error is a helper method to define mock.On call
// - c context.Context
// - id string
// - err error
func (_e *MockQueue_Expecter) Error(c interface{}, id interface{}, err interface{}) *MockQueue_Error_Call {
return &MockQueue_Error_Call{Call: _e.mock.On("Error", c, id, err)}
}
func (_c *MockQueue_Error_Call) Run(run func(c context.Context, id string, err error)) *MockQueue_Error_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(error))
})
return _c
}
func (_c *MockQueue_Error_Call) Return(_a0 error) *MockQueue_Error_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockQueue_Error_Call) RunAndReturn(run func(context.Context, string, error) error) *MockQueue_Error_Call {
_c.Call.Return(run)
return _c
}
// ErrorAtOnce provides a mock function with given fields: c, ids, err
func (_m *MockQueue) ErrorAtOnce(c context.Context, ids []string, err error) error {
ret := _m.Called(c, ids, err)
if len(ret) == 0 {
panic("no return value specified for ErrorAtOnce")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, []string, error) error); ok {
r0 = rf(c, ids, err)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockQueue_ErrorAtOnce_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ErrorAtOnce'
type MockQueue_ErrorAtOnce_Call struct {
*mock.Call
}
// ErrorAtOnce is a helper method to define mock.On call
// - c context.Context
// - ids []string
// - err error
func (_e *MockQueue_Expecter) ErrorAtOnce(c interface{}, ids interface{}, err interface{}) *MockQueue_ErrorAtOnce_Call {
return &MockQueue_ErrorAtOnce_Call{Call: _e.mock.On("ErrorAtOnce", c, ids, err)}
}
func (_c *MockQueue_ErrorAtOnce_Call) Run(run func(c context.Context, ids []string, err error)) *MockQueue_ErrorAtOnce_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].([]string), args[2].(error))
})
return _c
}
func (_c *MockQueue_ErrorAtOnce_Call) Return(_a0 error) *MockQueue_ErrorAtOnce_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockQueue_ErrorAtOnce_Call) RunAndReturn(run func(context.Context, []string, error) error) *MockQueue_ErrorAtOnce_Call {
_c.Call.Return(run)
return _c
}
// Evict provides a mock function with given fields: c, id
func (_m *MockQueue) Evict(c context.Context, id string) error {
ret := _m.Called(c, id)
if len(ret) == 0 {
panic("no return value specified for Evict")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = rf(c, id)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockQueue_Evict_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Evict'
type MockQueue_Evict_Call struct {
*mock.Call
}
// Evict is a helper method to define mock.On call
// - c context.Context
// - id string
func (_e *MockQueue_Expecter) Evict(c interface{}, id interface{}) *MockQueue_Evict_Call {
return &MockQueue_Evict_Call{Call: _e.mock.On("Evict", c, id)}
}
func (_c *MockQueue_Evict_Call) Run(run func(c context.Context, id string)) *MockQueue_Evict_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *MockQueue_Evict_Call) Return(_a0 error) *MockQueue_Evict_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockQueue_Evict_Call) RunAndReturn(run func(context.Context, string) error) *MockQueue_Evict_Call {
_c.Call.Return(run)
return _c
}
// EvictAtOnce provides a mock function with given fields: c, ids
func (_m *MockQueue) EvictAtOnce(c context.Context, ids []string) error {
ret := _m.Called(c, ids)
if len(ret) == 0 {
panic("no return value specified for EvictAtOnce")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, []string) error); ok {
r0 = rf(c, ids)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockQueue_EvictAtOnce_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EvictAtOnce'
type MockQueue_EvictAtOnce_Call struct {
*mock.Call
}
// EvictAtOnce is a helper method to define mock.On call
// - c context.Context
// - ids []string
func (_e *MockQueue_Expecter) EvictAtOnce(c interface{}, ids interface{}) *MockQueue_EvictAtOnce_Call {
return &MockQueue_EvictAtOnce_Call{Call: _e.mock.On("EvictAtOnce", c, ids)}
}
func (_c *MockQueue_EvictAtOnce_Call) Run(run func(c context.Context, ids []string)) *MockQueue_EvictAtOnce_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].([]string))
})
return _c
}
func (_c *MockQueue_EvictAtOnce_Call) Return(_a0 error) *MockQueue_EvictAtOnce_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockQueue_EvictAtOnce_Call) RunAndReturn(run func(context.Context, []string) error) *MockQueue_EvictAtOnce_Call {
_c.Call.Return(run)
return _c
}
// Extend provides a mock function with given fields: c, agentID, workflowID
func (_m *MockQueue) Extend(c context.Context, agentID int64, workflowID string) error {
ret := _m.Called(c, agentID, workflowID)
if len(ret) == 0 {
panic("no return value specified for Extend")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, int64, string) error); ok {
r0 = rf(c, agentID, workflowID)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockQueue_Extend_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Extend'
type MockQueue_Extend_Call struct {
*mock.Call
}
// Extend is a helper method to define mock.On call
// - c context.Context
// - agentID int64
// - workflowID string
func (_e *MockQueue_Expecter) Extend(c interface{}, agentID interface{}, workflowID interface{}) *MockQueue_Extend_Call {
return &MockQueue_Extend_Call{Call: _e.mock.On("Extend", c, agentID, workflowID)}
}
func (_c *MockQueue_Extend_Call) Run(run func(c context.Context, agentID int64, workflowID string)) *MockQueue_Extend_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(int64), args[2].(string))
})
return _c
}
func (_c *MockQueue_Extend_Call) Return(_a0 error) *MockQueue_Extend_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockQueue_Extend_Call) RunAndReturn(run func(context.Context, int64, string) error) *MockQueue_Extend_Call {
_c.Call.Return(run)
return _c
}
// Info provides a mock function with given fields: c
func (_m *MockQueue) Info(c context.Context) queue.InfoT {
ret := _m.Called(c)
if len(ret) == 0 {
panic("no return value specified for Info")
}
var r0 queue.InfoT
if rf, ok := ret.Get(0).(func(context.Context) queue.InfoT); ok {
r0 = rf(c)
} else {
r0 = ret.Get(0).(queue.InfoT)
}
return r0
}
// MockQueue_Info_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Info'
type MockQueue_Info_Call struct {
*mock.Call
}
// Info is a helper method to define mock.On call
// - c context.Context
func (_e *MockQueue_Expecter) Info(c interface{}) *MockQueue_Info_Call {
return &MockQueue_Info_Call{Call: _e.mock.On("Info", c)}
}
func (_c *MockQueue_Info_Call) Run(run func(c context.Context)) *MockQueue_Info_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *MockQueue_Info_Call) Return(_a0 queue.InfoT) *MockQueue_Info_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockQueue_Info_Call) RunAndReturn(run func(context.Context) queue.InfoT) *MockQueue_Info_Call {
_c.Call.Return(run)
return _c
}
// KickAgentWorkers provides a mock function with given fields: agentID
func (_m *MockQueue) KickAgentWorkers(agentID int64) {
_m.Called(agentID)
}
// MockQueue_KickAgentWorkers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'KickAgentWorkers'
type MockQueue_KickAgentWorkers_Call struct {
*mock.Call
}
// KickAgentWorkers is a helper method to define mock.On call
// - agentID int64
func (_e *MockQueue_Expecter) KickAgentWorkers(agentID interface{}) *MockQueue_KickAgentWorkers_Call {
return &MockQueue_KickAgentWorkers_Call{Call: _e.mock.On("KickAgentWorkers", agentID)}
}
func (_c *MockQueue_KickAgentWorkers_Call) Run(run func(agentID int64)) *MockQueue_KickAgentWorkers_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(int64))
})
return _c
}
func (_c *MockQueue_KickAgentWorkers_Call) Return() *MockQueue_KickAgentWorkers_Call {
_c.Call.Return()
return _c
}
func (_c *MockQueue_KickAgentWorkers_Call) RunAndReturn(run func(int64)) *MockQueue_KickAgentWorkers_Call {
_c.Run(run)
return _c
}
// Pause provides a mock function with no fields
func (_m *MockQueue) Pause() {
_m.Called()
}
// MockQueue_Pause_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Pause'
type MockQueue_Pause_Call struct {
*mock.Call
}
// Pause is a helper method to define mock.On call
func (_e *MockQueue_Expecter) Pause() *MockQueue_Pause_Call {
return &MockQueue_Pause_Call{Call: _e.mock.On("Pause")}
}
func (_c *MockQueue_Pause_Call) Run(run func()) *MockQueue_Pause_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockQueue_Pause_Call) Return() *MockQueue_Pause_Call {
_c.Call.Return()
return _c
}
func (_c *MockQueue_Pause_Call) RunAndReturn(run func()) *MockQueue_Pause_Call {
_c.Run(run)
return _c
}
// Poll provides a mock function with given fields: c, agentID, f
func (_m *MockQueue) Poll(c context.Context, agentID int64, f queue.FilterFn) (*model.Task, error) {
ret := _m.Called(c, agentID, f)
if len(ret) == 0 {
panic("no return value specified for Poll")
}
var r0 *model.Task
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, int64, queue.FilterFn) (*model.Task, error)); ok {
return rf(c, agentID, f)
}
if rf, ok := ret.Get(0).(func(context.Context, int64, queue.FilterFn) *model.Task); ok {
r0 = rf(c, agentID, f)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Task)
}
}
if rf, ok := ret.Get(1).(func(context.Context, int64, queue.FilterFn) error); ok {
r1 = rf(c, agentID, f)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockQueue_Poll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Poll'
type MockQueue_Poll_Call struct {
*mock.Call
}
// Poll is a helper method to define mock.On call
// - c context.Context
// - agentID int64
// - f queue.FilterFn
func (_e *MockQueue_Expecter) Poll(c interface{}, agentID interface{}, f interface{}) *MockQueue_Poll_Call {
return &MockQueue_Poll_Call{Call: _e.mock.On("Poll", c, agentID, f)}
}
func (_c *MockQueue_Poll_Call) Run(run func(c context.Context, agentID int64, f queue.FilterFn)) *MockQueue_Poll_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(int64), args[2].(queue.FilterFn))
})
return _c
}
func (_c *MockQueue_Poll_Call) Return(_a0 *model.Task, _a1 error) *MockQueue_Poll_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockQueue_Poll_Call) RunAndReturn(run func(context.Context, int64, queue.FilterFn) (*model.Task, error)) *MockQueue_Poll_Call {
_c.Call.Return(run)
return _c
}
// Push provides a mock function with given fields: c, task
func (_m *MockQueue) Push(c context.Context, task *model.Task) error {
ret := _m.Called(c, task)
if len(ret) == 0 {
panic("no return value specified for Push")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *model.Task) error); ok {
r0 = rf(c, task)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockQueue_Push_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Push'
type MockQueue_Push_Call struct {
*mock.Call
}
// Push is a helper method to define mock.On call
// - c context.Context
// - task *model.Task
func (_e *MockQueue_Expecter) Push(c interface{}, task interface{}) *MockQueue_Push_Call {
return &MockQueue_Push_Call{Call: _e.mock.On("Push", c, task)}
}
func (_c *MockQueue_Push_Call) Run(run func(c context.Context, task *model.Task)) *MockQueue_Push_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*model.Task))
})
return _c
}
func (_c *MockQueue_Push_Call) Return(_a0 error) *MockQueue_Push_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockQueue_Push_Call) RunAndReturn(run func(context.Context, *model.Task) error) *MockQueue_Push_Call {
_c.Call.Return(run)
return _c
}
// PushAtOnce provides a mock function with given fields: c, tasks
func (_m *MockQueue) PushAtOnce(c context.Context, tasks []*model.Task) error {
ret := _m.Called(c, tasks)
if len(ret) == 0 {
panic("no return value specified for PushAtOnce")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, []*model.Task) error); ok {
r0 = rf(c, tasks)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockQueue_PushAtOnce_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PushAtOnce'
type MockQueue_PushAtOnce_Call struct {
*mock.Call
}
// PushAtOnce is a helper method to define mock.On call
// - c context.Context
// - tasks []*model.Task
func (_e *MockQueue_Expecter) PushAtOnce(c interface{}, tasks interface{}) *MockQueue_PushAtOnce_Call {
return &MockQueue_PushAtOnce_Call{Call: _e.mock.On("PushAtOnce", c, tasks)}
}
func (_c *MockQueue_PushAtOnce_Call) Run(run func(c context.Context, tasks []*model.Task)) *MockQueue_PushAtOnce_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].([]*model.Task))
})
return _c
}
func (_c *MockQueue_PushAtOnce_Call) Return(_a0 error) *MockQueue_PushAtOnce_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockQueue_PushAtOnce_Call) RunAndReturn(run func(context.Context, []*model.Task) error) *MockQueue_PushAtOnce_Call {
_c.Call.Return(run)
return _c
}
// Resume provides a mock function with no fields
func (_m *MockQueue) Resume() {
_m.Called()
}
// MockQueue_Resume_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Resume'
type MockQueue_Resume_Call struct {
*mock.Call
}
// Resume is a helper method to define mock.On call
func (_e *MockQueue_Expecter) Resume() *MockQueue_Resume_Call {
return &MockQueue_Resume_Call{Call: _e.mock.On("Resume")}
}
func (_c *MockQueue_Resume_Call) Run(run func()) *MockQueue_Resume_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockQueue_Resume_Call) Return() *MockQueue_Resume_Call {
_c.Call.Return()
return _c
}
func (_c *MockQueue_Resume_Call) RunAndReturn(run func()) *MockQueue_Resume_Call {
_c.Run(run)
return _c
}
// Wait provides a mock function with given fields: c, id
func (_m *MockQueue) Wait(c context.Context, id string) error {
ret := _m.Called(c, id)
if len(ret) == 0 {
panic("no return value specified for Wait")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = rf(c, id)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockQueue_Wait_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Wait'
type MockQueue_Wait_Call struct {
*mock.Call
}
// Wait is a helper method to define mock.On call
// - c context.Context
// - id string
func (_e *MockQueue_Expecter) Wait(c interface{}, id interface{}) *MockQueue_Wait_Call {
return &MockQueue_Wait_Call{Call: _e.mock.On("Wait", c, id)}
}
func (_c *MockQueue_Wait_Call) Run(run func(c context.Context, id string)) *MockQueue_Wait_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *MockQueue_Wait_Call) Return(_a0 error) *MockQueue_Wait_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockQueue_Wait_Call) RunAndReturn(run func(context.Context, string) error) *MockQueue_Wait_Call {
_c.Call.Return(run)
return _c
}
// NewMockQueue creates a new instance of MockQueue. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockQueue(t interface {
mock.TestingT
Cleanup(func())
}) *MockQueue {
mock := &MockQueue{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,259 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
//go:build test
// +build test
package mocks
import (
context "context"
model "codeberg.org/crowci/crow/v3/server/model"
mock "github.com/stretchr/testify/mock"
queue "codeberg.org/crowci/crow/v3/server/queue"
)
// Queue is an autogenerated mock type for the Queue type
type Queue struct {
mock.Mock
}
// Done provides a mock function with given fields: c, id, exitStatus
func (_m *Queue) Done(c context.Context, id string, exitStatus model.StatusValue) error {
ret := _m.Called(c, id, exitStatus)
if len(ret) == 0 {
panic("no return value specified for Done")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, model.StatusValue) error); ok {
r0 = rf(c, id, exitStatus)
} else {
r0 = ret.Error(0)
}
return r0
}
// Error provides a mock function with given fields: c, id, err
func (_m *Queue) Error(c context.Context, id string, err error) error {
ret := _m.Called(c, id, err)
if len(ret) == 0 {
panic("no return value specified for Error")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, error) error); ok {
r0 = rf(c, id, err)
} else {
r0 = ret.Error(0)
}
return r0
}
// ErrorAtOnce provides a mock function with given fields: c, ids, err
func (_m *Queue) ErrorAtOnce(c context.Context, ids []string, err error) error {
ret := _m.Called(c, ids, err)
if len(ret) == 0 {
panic("no return value specified for ErrorAtOnce")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, []string, error) error); ok {
r0 = rf(c, ids, err)
} else {
r0 = ret.Error(0)
}
return r0
}
// Evict provides a mock function with given fields: c, id
func (_m *Queue) Evict(c context.Context, id string) error {
ret := _m.Called(c, id)
if len(ret) == 0 {
panic("no return value specified for Evict")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = rf(c, id)
} else {
r0 = ret.Error(0)
}
return r0
}
// EvictAtOnce provides a mock function with given fields: c, ids
func (_m *Queue) EvictAtOnce(c context.Context, ids []string) error {
ret := _m.Called(c, ids)
if len(ret) == 0 {
panic("no return value specified for EvictAtOnce")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, []string) error); ok {
r0 = rf(c, ids)
} else {
r0 = ret.Error(0)
}
return r0
}
// Extend provides a mock function with given fields: c, agentID, workflowID
func (_m *Queue) Extend(c context.Context, agentID int64, workflowID string) error {
ret := _m.Called(c, agentID, workflowID)
if len(ret) == 0 {
panic("no return value specified for Extend")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, int64, string) error); ok {
r0 = rf(c, agentID, workflowID)
} else {
r0 = ret.Error(0)
}
return r0
}
// Info provides a mock function with given fields: c
func (_m *Queue) Info(c context.Context) queue.InfoT {
ret := _m.Called(c)
if len(ret) == 0 {
panic("no return value specified for Info")
}
var r0 queue.InfoT
if rf, ok := ret.Get(0).(func(context.Context) queue.InfoT); ok {
r0 = rf(c)
} else {
r0 = ret.Get(0).(queue.InfoT)
}
return r0
}
// KickAgentWorkers provides a mock function with given fields: agentID
func (_m *Queue) KickAgentWorkers(agentID int64) {
_m.Called(agentID)
}
// Pause provides a mock function with given fields:
func (_m *Queue) Pause() {
_m.Called()
}
// Poll provides a mock function with given fields: c, agentID, f
func (_m *Queue) Poll(c context.Context, agentID int64, f queue.FilterFn) (*model.Task, error) {
ret := _m.Called(c, agentID, f)
if len(ret) == 0 {
panic("no return value specified for Poll")
}
var r0 *model.Task
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, int64, queue.FilterFn) (*model.Task, error)); ok {
return rf(c, agentID, f)
}
if rf, ok := ret.Get(0).(func(context.Context, int64, queue.FilterFn) *model.Task); ok {
r0 = rf(c, agentID, f)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Task)
}
}
if rf, ok := ret.Get(1).(func(context.Context, int64, queue.FilterFn) error); ok {
r1 = rf(c, agentID, f)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Push provides a mock function with given fields: c, task
func (_m *Queue) Push(c context.Context, task *model.Task) error {
ret := _m.Called(c, task)
if len(ret) == 0 {
panic("no return value specified for Push")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *model.Task) error); ok {
r0 = rf(c, task)
} else {
r0 = ret.Error(0)
}
return r0
}
// PushAtOnce provides a mock function with given fields: c, tasks
func (_m *Queue) PushAtOnce(c context.Context, tasks []*model.Task) error {
ret := _m.Called(c, tasks)
if len(ret) == 0 {
panic("no return value specified for PushAtOnce")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, []*model.Task) error); ok {
r0 = rf(c, tasks)
} else {
r0 = ret.Error(0)
}
return r0
}
// Resume provides a mock function with given fields:
func (_m *Queue) Resume() {
_m.Called()
}
// Wait provides a mock function with given fields: c, id
func (_m *Queue) Wait(c context.Context, id string) error {
ret := _m.Called(c, id)
if len(ret) == 0 {
panic("no return value specified for Wait")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = rf(c, id)
} else {
r0 = ret.Error(0)
}
return r0
}
// NewQueue creates a new instance of Queue. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewQueue(t interface {
mock.TestingT
Cleanup(func())
}) *Queue {
mock := &Queue{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -31,7 +31,7 @@ import (
"github.com/stretchr/testify/mock"
"github.com/yaronf/httpsign"
"codeberg.org/crowci/crow/v3/server/forge/mocks"
forge_mocks "codeberg.org/crowci/crow/v3/server/forge/mocks"
forge_types "codeberg.org/crowci/crow/v3/server/forge/types"
"codeberg.org/crowci/crow/v3/server/model"
"codeberg.org/crowci/crow/v3/server/services/config"
@ -192,7 +192,7 @@ func TestFetchFromConfigService(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
repo := &model.Repo{Owner: "laszlocph", Name: tt.name, Config: tt.repoConfig} // Using test name as repo name to provide different responses in mock server
f := new(mocks.Forge)
f := new(forge_mocks.MockForge)
dirs := map[string][]*forge_types.FileMeta{}
for _, file := range tt.files {
f.On("File", mock.Anything, mock.Anything, mock.Anything, mock.Anything, file.name).Return(file.data, nil)

View File

@ -24,7 +24,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"codeberg.org/crowci/crow/v3/server/forge/mocks"
forge_mocks "codeberg.org/crowci/crow/v3/server/forge/mocks"
forge_types "codeberg.org/crowci/crow/v3/server/forge/types"
"codeberg.org/crowci/crow/v3/server/model"
"codeberg.org/crowci/crow/v3/server/services/config"
@ -284,7 +284,7 @@ func TestFetch(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
repo := &model.Repo{Owner: "laszlocph", Name: "multipipeline", Config: tt.repoConfig}
f := new(mocks.Forge)
f := new(forge_mocks.MockForge)
dirs := map[string][]*forge_types.FileMeta{}
for _, file := range tt.files {
f.On("File", mock.Anything, mock.Anything, mock.Anything, mock.Anything, file.name).Once().Return(file.data, nil)

View File

@ -0,0 +1,105 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package config
import (
context "context"
forge "codeberg.org/crowci/crow/v3/server/forge"
mock "github.com/stretchr/testify/mock"
model "codeberg.org/crowci/crow/v3/server/model"
types "codeberg.org/crowci/crow/v3/server/forge/types"
)
// MockService is an autogenerated mock type for the Service type
type MockService struct {
mock.Mock
}
type MockService_Expecter struct {
mock *mock.Mock
}
func (_m *MockService) EXPECT() *MockService_Expecter {
return &MockService_Expecter{mock: &_m.Mock}
}
// Fetch provides a mock function with given fields: ctx, _a1, user, repo, pipeline, oldConfigData, restart
func (_m *MockService) Fetch(ctx context.Context, _a1 forge.Forge, user *model.User, repo *model.Repo, pipeline *model.Pipeline, oldConfigData []*types.FileMeta, restart bool) ([]*types.FileMeta, error) {
ret := _m.Called(ctx, _a1, user, repo, pipeline, oldConfigData, restart)
if len(ret) == 0 {
panic("no return value specified for Fetch")
}
var r0 []*types.FileMeta
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, forge.Forge, *model.User, *model.Repo, *model.Pipeline, []*types.FileMeta, bool) ([]*types.FileMeta, error)); ok {
return rf(ctx, _a1, user, repo, pipeline, oldConfigData, restart)
}
if rf, ok := ret.Get(0).(func(context.Context, forge.Forge, *model.User, *model.Repo, *model.Pipeline, []*types.FileMeta, bool) []*types.FileMeta); ok {
r0 = rf(ctx, _a1, user, repo, pipeline, oldConfigData, restart)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*types.FileMeta)
}
}
if rf, ok := ret.Get(1).(func(context.Context, forge.Forge, *model.User, *model.Repo, *model.Pipeline, []*types.FileMeta, bool) error); ok {
r1 = rf(ctx, _a1, user, repo, pipeline, oldConfigData, restart)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockService_Fetch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Fetch'
type MockService_Fetch_Call struct {
*mock.Call
}
// Fetch is a helper method to define mock.On call
// - ctx context.Context
// - _a1 forge.Forge
// - user *model.User
// - repo *model.Repo
// - pipeline *model.Pipeline
// - oldConfigData []*types.FileMeta
// - restart bool
func (_e *MockService_Expecter) Fetch(ctx interface{}, _a1 interface{}, user interface{}, repo interface{}, pipeline interface{}, oldConfigData interface{}, restart interface{}) *MockService_Fetch_Call {
return &MockService_Fetch_Call{Call: _e.mock.On("Fetch", ctx, _a1, user, repo, pipeline, oldConfigData, restart)}
}
func (_c *MockService_Fetch_Call) Run(run func(ctx context.Context, _a1 forge.Forge, user *model.User, repo *model.Repo, pipeline *model.Pipeline, oldConfigData []*types.FileMeta, restart bool)) *MockService_Fetch_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(forge.Forge), args[2].(*model.User), args[3].(*model.Repo), args[4].(*model.Pipeline), args[5].([]*types.FileMeta), args[6].(bool))
})
return _c
}
func (_c *MockService_Fetch_Call) Return(configData []*types.FileMeta, err error) *MockService_Fetch_Call {
_c.Call.Return(configData, err)
return _c
}
func (_c *MockService_Fetch_Call) RunAndReturn(run func(context.Context, forge.Forge, *model.User, *model.Repo, *model.Pipeline, []*types.FileMeta, bool) ([]*types.FileMeta, error)) *MockService_Fetch_Call {
_c.Call.Return(run)
return _c
}
// NewMockService creates a new instance of MockService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockService(t interface {
mock.TestingT
Cleanup(func())
}) *MockService {
mock := &MockService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,63 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
context "context"
forge "codeberg.org/crowci/crow/v3/server/forge"
mock "github.com/stretchr/testify/mock"
model "codeberg.org/crowci/crow/v3/server/model"
types "codeberg.org/crowci/crow/v3/server/forge/types"
)
// Service is an autogenerated mock type for the Service type
type Service struct {
mock.Mock
}
// Fetch provides a mock function with given fields: ctx, _a1, user, repo, pipeline, oldConfigData, restart
func (_m *Service) Fetch(ctx context.Context, _a1 forge.Forge, user *model.User, repo *model.Repo, pipeline *model.Pipeline, oldConfigData []*types.FileMeta, restart bool) ([]*types.FileMeta, error) {
ret := _m.Called(ctx, _a1, user, repo, pipeline, oldConfigData, restart)
if len(ret) == 0 {
panic("no return value specified for Fetch")
}
var r0 []*types.FileMeta
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, forge.Forge, *model.User, *model.Repo, *model.Pipeline, []*types.FileMeta, bool) ([]*types.FileMeta, error)); ok {
return rf(ctx, _a1, user, repo, pipeline, oldConfigData, restart)
}
if rf, ok := ret.Get(0).(func(context.Context, forge.Forge, *model.User, *model.Repo, *model.Pipeline, []*types.FileMeta, bool) []*types.FileMeta); ok {
r0 = rf(ctx, _a1, user, repo, pipeline, oldConfigData, restart)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*types.FileMeta)
}
}
if rf, ok := ret.Get(1).(func(context.Context, forge.Forge, *model.User, *model.Repo, *model.Pipeline, []*types.FileMeta, bool) error); ok {
r1 = rf(ctx, _a1, user, repo, pipeline, oldConfigData, restart)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewService creates a new instance of Service. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewService(t interface {
mock.TestingT
Cleanup(func())
}) *Service {
mock := &Service{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,128 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package types
import (
types "codeberg.org/crowci/crow/v3/server/services/encryption/types"
mock "github.com/stretchr/testify/mock"
)
// MockEncryptionBuilder is an autogenerated mock type for the EncryptionBuilder type
type MockEncryptionBuilder struct {
mock.Mock
}
type MockEncryptionBuilder_Expecter struct {
mock *mock.Mock
}
func (_m *MockEncryptionBuilder) EXPECT() *MockEncryptionBuilder_Expecter {
return &MockEncryptionBuilder_Expecter{mock: &_m.Mock}
}
// Build provides a mock function with no fields
func (_m *MockEncryptionBuilder) Build() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Build")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// MockEncryptionBuilder_Build_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Build'
type MockEncryptionBuilder_Build_Call struct {
*mock.Call
}
// Build is a helper method to define mock.On call
func (_e *MockEncryptionBuilder_Expecter) Build() *MockEncryptionBuilder_Build_Call {
return &MockEncryptionBuilder_Build_Call{Call: _e.mock.On("Build")}
}
func (_c *MockEncryptionBuilder_Build_Call) Run(run func()) *MockEncryptionBuilder_Build_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockEncryptionBuilder_Build_Call) Return(_a0 error) *MockEncryptionBuilder_Build_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockEncryptionBuilder_Build_Call) RunAndReturn(run func() error) *MockEncryptionBuilder_Build_Call {
_c.Call.Return(run)
return _c
}
// WithClient provides a mock function with given fields: client
func (_m *MockEncryptionBuilder) WithClient(client types.EncryptionClient) types.EncryptionBuilder {
ret := _m.Called(client)
if len(ret) == 0 {
panic("no return value specified for WithClient")
}
var r0 types.EncryptionBuilder
if rf, ok := ret.Get(0).(func(types.EncryptionClient) types.EncryptionBuilder); ok {
r0 = rf(client)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(types.EncryptionBuilder)
}
}
return r0
}
// MockEncryptionBuilder_WithClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithClient'
type MockEncryptionBuilder_WithClient_Call struct {
*mock.Call
}
// WithClient is a helper method to define mock.On call
// - client types.EncryptionClient
func (_e *MockEncryptionBuilder_Expecter) WithClient(client interface{}) *MockEncryptionBuilder_WithClient_Call {
return &MockEncryptionBuilder_WithClient_Call{Call: _e.mock.On("WithClient", client)}
}
func (_c *MockEncryptionBuilder_WithClient_Call) Run(run func(client types.EncryptionClient)) *MockEncryptionBuilder_WithClient_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(types.EncryptionClient))
})
return _c
}
func (_c *MockEncryptionBuilder_WithClient_Call) Return(_a0 types.EncryptionBuilder) *MockEncryptionBuilder_WithClient_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockEncryptionBuilder_WithClient_Call) RunAndReturn(run func(types.EncryptionClient) types.EncryptionBuilder) *MockEncryptionBuilder_WithClient_Call {
_c.Call.Return(run)
return _c
}
// NewMockEncryptionBuilder creates a new instance of MockEncryptionBuilder. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockEncryptionBuilder(t interface {
mock.TestingT
Cleanup(func())
}) *MockEncryptionBuilder {
mock := &MockEncryptionBuilder{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,172 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package types
import (
types "codeberg.org/crowci/crow/v3/server/services/encryption/types"
mock "github.com/stretchr/testify/mock"
)
// MockEncryptionClient is an autogenerated mock type for the EncryptionClient type
type MockEncryptionClient struct {
mock.Mock
}
type MockEncryptionClient_Expecter struct {
mock *mock.Mock
}
func (_m *MockEncryptionClient) EXPECT() *MockEncryptionClient_Expecter {
return &MockEncryptionClient_Expecter{mock: &_m.Mock}
}
// EnableEncryption provides a mock function with no fields
func (_m *MockEncryptionClient) EnableEncryption() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for EnableEncryption")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// MockEncryptionClient_EnableEncryption_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnableEncryption'
type MockEncryptionClient_EnableEncryption_Call struct {
*mock.Call
}
// EnableEncryption is a helper method to define mock.On call
func (_e *MockEncryptionClient_Expecter) EnableEncryption() *MockEncryptionClient_EnableEncryption_Call {
return &MockEncryptionClient_EnableEncryption_Call{Call: _e.mock.On("EnableEncryption")}
}
func (_c *MockEncryptionClient_EnableEncryption_Call) Run(run func()) *MockEncryptionClient_EnableEncryption_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockEncryptionClient_EnableEncryption_Call) Return(_a0 error) *MockEncryptionClient_EnableEncryption_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockEncryptionClient_EnableEncryption_Call) RunAndReturn(run func() error) *MockEncryptionClient_EnableEncryption_Call {
_c.Call.Return(run)
return _c
}
// MigrateEncryption provides a mock function with given fields: newEncryption
func (_m *MockEncryptionClient) MigrateEncryption(newEncryption types.EncryptionService) error {
ret := _m.Called(newEncryption)
if len(ret) == 0 {
panic("no return value specified for MigrateEncryption")
}
var r0 error
if rf, ok := ret.Get(0).(func(types.EncryptionService) error); ok {
r0 = rf(newEncryption)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockEncryptionClient_MigrateEncryption_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MigrateEncryption'
type MockEncryptionClient_MigrateEncryption_Call struct {
*mock.Call
}
// MigrateEncryption is a helper method to define mock.On call
// - newEncryption types.EncryptionService
func (_e *MockEncryptionClient_Expecter) MigrateEncryption(newEncryption interface{}) *MockEncryptionClient_MigrateEncryption_Call {
return &MockEncryptionClient_MigrateEncryption_Call{Call: _e.mock.On("MigrateEncryption", newEncryption)}
}
func (_c *MockEncryptionClient_MigrateEncryption_Call) Run(run func(newEncryption types.EncryptionService)) *MockEncryptionClient_MigrateEncryption_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(types.EncryptionService))
})
return _c
}
func (_c *MockEncryptionClient_MigrateEncryption_Call) Return(_a0 error) *MockEncryptionClient_MigrateEncryption_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockEncryptionClient_MigrateEncryption_Call) RunAndReturn(run func(types.EncryptionService) error) *MockEncryptionClient_MigrateEncryption_Call {
_c.Call.Return(run)
return _c
}
// SetEncryptionService provides a mock function with given fields: encryption
func (_m *MockEncryptionClient) SetEncryptionService(encryption types.EncryptionService) error {
ret := _m.Called(encryption)
if len(ret) == 0 {
panic("no return value specified for SetEncryptionService")
}
var r0 error
if rf, ok := ret.Get(0).(func(types.EncryptionService) error); ok {
r0 = rf(encryption)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockEncryptionClient_SetEncryptionService_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetEncryptionService'
type MockEncryptionClient_SetEncryptionService_Call struct {
*mock.Call
}
// SetEncryptionService is a helper method to define mock.On call
// - encryption types.EncryptionService
func (_e *MockEncryptionClient_Expecter) SetEncryptionService(encryption interface{}) *MockEncryptionClient_SetEncryptionService_Call {
return &MockEncryptionClient_SetEncryptionService_Call{Call: _e.mock.On("SetEncryptionService", encryption)}
}
func (_c *MockEncryptionClient_SetEncryptionService_Call) Run(run func(encryption types.EncryptionService)) *MockEncryptionClient_SetEncryptionService_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(types.EncryptionService))
})
return _c
}
func (_c *MockEncryptionClient_SetEncryptionService_Call) Return(_a0 error) *MockEncryptionClient_SetEncryptionService_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockEncryptionClient_SetEncryptionService_Call) RunAndReturn(run func(types.EncryptionService) error) *MockEncryptionClient_SetEncryptionService_Call {
_c.Call.Return(run)
return _c
}
// NewMockEncryptionClient creates a new instance of MockEncryptionClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockEncryptionClient(t interface {
mock.TestingT
Cleanup(func())
}) *MockEncryptionClient {
mock := &MockEncryptionClient{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,191 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package types
import mock "github.com/stretchr/testify/mock"
// MockEncryptionService is an autogenerated mock type for the EncryptionService type
type MockEncryptionService struct {
mock.Mock
}
type MockEncryptionService_Expecter struct {
mock *mock.Mock
}
func (_m *MockEncryptionService) EXPECT() *MockEncryptionService_Expecter {
return &MockEncryptionService_Expecter{mock: &_m.Mock}
}
// Decrypt provides a mock function with given fields: ciphertext, associatedData
func (_m *MockEncryptionService) Decrypt(ciphertext string, associatedData string) (string, error) {
ret := _m.Called(ciphertext, associatedData)
if len(ret) == 0 {
panic("no return value specified for Decrypt")
}
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(string, string) (string, error)); ok {
return rf(ciphertext, associatedData)
}
if rf, ok := ret.Get(0).(func(string, string) string); ok {
r0 = rf(ciphertext, associatedData)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(string, string) error); ok {
r1 = rf(ciphertext, associatedData)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockEncryptionService_Decrypt_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Decrypt'
type MockEncryptionService_Decrypt_Call struct {
*mock.Call
}
// Decrypt is a helper method to define mock.On call
// - ciphertext string
// - associatedData string
func (_e *MockEncryptionService_Expecter) Decrypt(ciphertext interface{}, associatedData interface{}) *MockEncryptionService_Decrypt_Call {
return &MockEncryptionService_Decrypt_Call{Call: _e.mock.On("Decrypt", ciphertext, associatedData)}
}
func (_c *MockEncryptionService_Decrypt_Call) Run(run func(ciphertext string, associatedData string)) *MockEncryptionService_Decrypt_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string), args[1].(string))
})
return _c
}
func (_c *MockEncryptionService_Decrypt_Call) Return(_a0 string, _a1 error) *MockEncryptionService_Decrypt_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockEncryptionService_Decrypt_Call) RunAndReturn(run func(string, string) (string, error)) *MockEncryptionService_Decrypt_Call {
_c.Call.Return(run)
return _c
}
// Disable provides a mock function with no fields
func (_m *MockEncryptionService) Disable() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Disable")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// MockEncryptionService_Disable_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Disable'
type MockEncryptionService_Disable_Call struct {
*mock.Call
}
// Disable is a helper method to define mock.On call
func (_e *MockEncryptionService_Expecter) Disable() *MockEncryptionService_Disable_Call {
return &MockEncryptionService_Disable_Call{Call: _e.mock.On("Disable")}
}
func (_c *MockEncryptionService_Disable_Call) Run(run func()) *MockEncryptionService_Disable_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockEncryptionService_Disable_Call) Return(_a0 error) *MockEncryptionService_Disable_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockEncryptionService_Disable_Call) RunAndReturn(run func() error) *MockEncryptionService_Disable_Call {
_c.Call.Return(run)
return _c
}
// Encrypt provides a mock function with given fields: plaintext, associatedData
func (_m *MockEncryptionService) Encrypt(plaintext string, associatedData string) (string, error) {
ret := _m.Called(plaintext, associatedData)
if len(ret) == 0 {
panic("no return value specified for Encrypt")
}
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(string, string) (string, error)); ok {
return rf(plaintext, associatedData)
}
if rf, ok := ret.Get(0).(func(string, string) string); ok {
r0 = rf(plaintext, associatedData)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(string, string) error); ok {
r1 = rf(plaintext, associatedData)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockEncryptionService_Encrypt_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Encrypt'
type MockEncryptionService_Encrypt_Call struct {
*mock.Call
}
// Encrypt is a helper method to define mock.On call
// - plaintext string
// - associatedData string
func (_e *MockEncryptionService_Expecter) Encrypt(plaintext interface{}, associatedData interface{}) *MockEncryptionService_Encrypt_Call {
return &MockEncryptionService_Encrypt_Call{Call: _e.mock.On("Encrypt", plaintext, associatedData)}
}
func (_c *MockEncryptionService_Encrypt_Call) Run(run func(plaintext string, associatedData string)) *MockEncryptionService_Encrypt_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string), args[1].(string))
})
return _c
}
func (_c *MockEncryptionService_Encrypt_Call) Return(_a0 string, _a1 error) *MockEncryptionService_Encrypt_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockEncryptionService_Encrypt_Call) RunAndReturn(run func(string, string) (string, error)) *MockEncryptionService_Encrypt_Call {
_c.Call.Return(run)
return _c
}
// NewMockEncryptionService creates a new instance of MockEncryptionService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockEncryptionService(t interface {
mock.TestingT
Cleanup(func())
}) *MockEncryptionService {
mock := &MockEncryptionService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,140 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package types
import (
types "codeberg.org/crowci/crow/v3/server/services/encryption/types"
mock "github.com/stretchr/testify/mock"
)
// MockEncryptionServiceBuilder is an autogenerated mock type for the EncryptionServiceBuilder type
type MockEncryptionServiceBuilder struct {
mock.Mock
}
type MockEncryptionServiceBuilder_Expecter struct {
mock *mock.Mock
}
func (_m *MockEncryptionServiceBuilder) EXPECT() *MockEncryptionServiceBuilder_Expecter {
return &MockEncryptionServiceBuilder_Expecter{mock: &_m.Mock}
}
// Build provides a mock function with no fields
func (_m *MockEncryptionServiceBuilder) Build() (types.EncryptionService, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Build")
}
var r0 types.EncryptionService
var r1 error
if rf, ok := ret.Get(0).(func() (types.EncryptionService, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() types.EncryptionService); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(types.EncryptionService)
}
}
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockEncryptionServiceBuilder_Build_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Build'
type MockEncryptionServiceBuilder_Build_Call struct {
*mock.Call
}
// Build is a helper method to define mock.On call
func (_e *MockEncryptionServiceBuilder_Expecter) Build() *MockEncryptionServiceBuilder_Build_Call {
return &MockEncryptionServiceBuilder_Build_Call{Call: _e.mock.On("Build")}
}
func (_c *MockEncryptionServiceBuilder_Build_Call) Run(run func()) *MockEncryptionServiceBuilder_Build_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockEncryptionServiceBuilder_Build_Call) Return(_a0 types.EncryptionService, _a1 error) *MockEncryptionServiceBuilder_Build_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockEncryptionServiceBuilder_Build_Call) RunAndReturn(run func() (types.EncryptionService, error)) *MockEncryptionServiceBuilder_Build_Call {
_c.Call.Return(run)
return _c
}
// WithClients provides a mock function with given fields: clients
func (_m *MockEncryptionServiceBuilder) WithClients(clients []types.EncryptionClient) types.EncryptionServiceBuilder {
ret := _m.Called(clients)
if len(ret) == 0 {
panic("no return value specified for WithClients")
}
var r0 types.EncryptionServiceBuilder
if rf, ok := ret.Get(0).(func([]types.EncryptionClient) types.EncryptionServiceBuilder); ok {
r0 = rf(clients)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(types.EncryptionServiceBuilder)
}
}
return r0
}
// MockEncryptionServiceBuilder_WithClients_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithClients'
type MockEncryptionServiceBuilder_WithClients_Call struct {
*mock.Call
}
// WithClients is a helper method to define mock.On call
// - clients []types.EncryptionClient
func (_e *MockEncryptionServiceBuilder_Expecter) WithClients(clients interface{}) *MockEncryptionServiceBuilder_WithClients_Call {
return &MockEncryptionServiceBuilder_WithClients_Call{Call: _e.mock.On("WithClients", clients)}
}
func (_c *MockEncryptionServiceBuilder_WithClients_Call) Run(run func(clients []types.EncryptionClient)) *MockEncryptionServiceBuilder_WithClients_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].([]types.EncryptionClient))
})
return _c
}
func (_c *MockEncryptionServiceBuilder_WithClients_Call) Return(_a0 types.EncryptionServiceBuilder) *MockEncryptionServiceBuilder_WithClients_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockEncryptionServiceBuilder_WithClients_Call) RunAndReturn(run func([]types.EncryptionClient) types.EncryptionServiceBuilder) *MockEncryptionServiceBuilder_WithClients_Call {
_c.Call.Return(run)
return _c
}
// NewMockEncryptionServiceBuilder creates a new instance of MockEncryptionServiceBuilder. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockEncryptionServiceBuilder(t interface {
mock.TestingT
Cleanup(func())
}) *MockEncryptionServiceBuilder {
mock := &MockEncryptionServiceBuilder{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,93 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package environment
import (
model "codeberg.org/crowci/crow/v3/server/model"
mock "github.com/stretchr/testify/mock"
)
// MockService is an autogenerated mock type for the Service type
type MockService struct {
mock.Mock
}
type MockService_Expecter struct {
mock *mock.Mock
}
func (_m *MockService) EXPECT() *MockService_Expecter {
return &MockService_Expecter{mock: &_m.Mock}
}
// EnvironList provides a mock function with given fields: _a0
func (_m *MockService) EnvironList(_a0 *model.Repo) ([]*model.Environ, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for EnvironList")
}
var r0 []*model.Environ
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo) ([]*model.Environ, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.Repo) []*model.Environ); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Environ)
}
}
if rf, ok := ret.Get(1).(func(*model.Repo) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockService_EnvironList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnvironList'
type MockService_EnvironList_Call struct {
*mock.Call
}
// EnvironList is a helper method to define mock.On call
// - _a0 *model.Repo
func (_e *MockService_Expecter) EnvironList(_a0 interface{}) *MockService_EnvironList_Call {
return &MockService_EnvironList_Call{Call: _e.mock.On("EnvironList", _a0)}
}
func (_c *MockService_EnvironList_Call) Run(run func(_a0 *model.Repo)) *MockService_EnvironList_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Repo))
})
return _c
}
func (_c *MockService_EnvironList_Call) Return(_a0 []*model.Environ, _a1 error) *MockService_EnvironList_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockService_EnvironList_Call) RunAndReturn(run func(*model.Repo) ([]*model.Environ, error)) *MockService_EnvironList_Call {
_c.Call.Return(run)
return _c
}
// NewMockService creates a new instance of MockService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockService(t interface {
mock.TestingT
Cleanup(func())
}) *MockService {
mock := &MockService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,57 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
model "codeberg.org/crowci/crow/v3/server/model"
mock "github.com/stretchr/testify/mock"
)
// Service is an autogenerated mock type for the Service type
type Service struct {
mock.Mock
}
// EnvironList provides a mock function with given fields: _a0
func (_m *Service) EnvironList(_a0 *model.Repo) ([]*model.Environ, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for EnvironList")
}
var r0 []*model.Environ
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo) ([]*model.Environ, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.Repo) []*model.Environ); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Environ)
}
}
if rf, ok := ret.Get(1).(func(*model.Repo) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewService creates a new instance of Service. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewService(t interface {
mock.TestingT
Cleanup(func())
}) *Service {
mock := &Service{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,186 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package log
import (
model "codeberg.org/crowci/crow/v3/server/model"
mock "github.com/stretchr/testify/mock"
)
// MockService is an autogenerated mock type for the Service type
type MockService struct {
mock.Mock
}
type MockService_Expecter struct {
mock *mock.Mock
}
func (_m *MockService) EXPECT() *MockService_Expecter {
return &MockService_Expecter{mock: &_m.Mock}
}
// LogAppend provides a mock function with given fields: step, logEntries
func (_m *MockService) LogAppend(step *model.Step, logEntries []*model.LogEntry) error {
ret := _m.Called(step, logEntries)
if len(ret) == 0 {
panic("no return value specified for LogAppend")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Step, []*model.LogEntry) error); ok {
r0 = rf(step, logEntries)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockService_LogAppend_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LogAppend'
type MockService_LogAppend_Call struct {
*mock.Call
}
// LogAppend is a helper method to define mock.On call
// - step *model.Step
// - logEntries []*model.LogEntry
func (_e *MockService_Expecter) LogAppend(step interface{}, logEntries interface{}) *MockService_LogAppend_Call {
return &MockService_LogAppend_Call{Call: _e.mock.On("LogAppend", step, logEntries)}
}
func (_c *MockService_LogAppend_Call) Run(run func(step *model.Step, logEntries []*model.LogEntry)) *MockService_LogAppend_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Step), args[1].([]*model.LogEntry))
})
return _c
}
func (_c *MockService_LogAppend_Call) Return(_a0 error) *MockService_LogAppend_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockService_LogAppend_Call) RunAndReturn(run func(*model.Step, []*model.LogEntry) error) *MockService_LogAppend_Call {
_c.Call.Return(run)
return _c
}
// LogDelete provides a mock function with given fields: step
func (_m *MockService) LogDelete(step *model.Step) error {
ret := _m.Called(step)
if len(ret) == 0 {
panic("no return value specified for LogDelete")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Step) error); ok {
r0 = rf(step)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockService_LogDelete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LogDelete'
type MockService_LogDelete_Call struct {
*mock.Call
}
// LogDelete is a helper method to define mock.On call
// - step *model.Step
func (_e *MockService_Expecter) LogDelete(step interface{}) *MockService_LogDelete_Call {
return &MockService_LogDelete_Call{Call: _e.mock.On("LogDelete", step)}
}
func (_c *MockService_LogDelete_Call) Run(run func(step *model.Step)) *MockService_LogDelete_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Step))
})
return _c
}
func (_c *MockService_LogDelete_Call) Return(_a0 error) *MockService_LogDelete_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockService_LogDelete_Call) RunAndReturn(run func(*model.Step) error) *MockService_LogDelete_Call {
_c.Call.Return(run)
return _c
}
// LogFind provides a mock function with given fields: step
func (_m *MockService) LogFind(step *model.Step) ([]*model.LogEntry, error) {
ret := _m.Called(step)
if len(ret) == 0 {
panic("no return value specified for LogFind")
}
var r0 []*model.LogEntry
var r1 error
if rf, ok := ret.Get(0).(func(*model.Step) ([]*model.LogEntry, error)); ok {
return rf(step)
}
if rf, ok := ret.Get(0).(func(*model.Step) []*model.LogEntry); ok {
r0 = rf(step)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.LogEntry)
}
}
if rf, ok := ret.Get(1).(func(*model.Step) error); ok {
r1 = rf(step)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockService_LogFind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LogFind'
type MockService_LogFind_Call struct {
*mock.Call
}
// LogFind is a helper method to define mock.On call
// - step *model.Step
func (_e *MockService_Expecter) LogFind(step interface{}) *MockService_LogFind_Call {
return &MockService_LogFind_Call{Call: _e.mock.On("LogFind", step)}
}
func (_c *MockService_LogFind_Call) Run(run func(step *model.Step)) *MockService_LogFind_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Step))
})
return _c
}
func (_c *MockService_LogFind_Call) Return(_a0 []*model.LogEntry, _a1 error) *MockService_LogFind_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockService_LogFind_Call) RunAndReturn(run func(*model.Step) ([]*model.LogEntry, error)) *MockService_LogFind_Call {
_c.Call.Return(run)
return _c
}
// NewMockService creates a new instance of MockService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockService(t interface {
mock.TestingT
Cleanup(func())
}) *MockService {
mock := &MockService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,65 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
types "codeberg.org/crowci/crow/v3/server/services/encryption/types"
mock "github.com/stretchr/testify/mock"
)
// EncryptionBuilder is an autogenerated mock type for the EncryptionBuilder type
type EncryptionBuilder struct {
mock.Mock
}
// Build provides a mock function with given fields:
func (_m *EncryptionBuilder) Build() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Build")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// WithClient provides a mock function with given fields: client
func (_m *EncryptionBuilder) WithClient(client types.EncryptionClient) types.EncryptionBuilder {
ret := _m.Called(client)
if len(ret) == 0 {
panic("no return value specified for WithClient")
}
var r0 types.EncryptionBuilder
if rf, ok := ret.Get(0).(func(types.EncryptionClient) types.EncryptionBuilder); ok {
r0 = rf(client)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(types.EncryptionBuilder)
}
}
return r0
}
// NewEncryptionBuilder creates a new instance of EncryptionBuilder. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewEncryptionBuilder(t interface {
mock.TestingT
Cleanup(func())
}) *EncryptionBuilder {
mock := &EncryptionBuilder{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,81 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
types "codeberg.org/crowci/crow/v3/server/services/encryption/types"
mock "github.com/stretchr/testify/mock"
)
// EncryptionClient is an autogenerated mock type for the EncryptionClient type
type EncryptionClient struct {
mock.Mock
}
// EnableEncryption provides a mock function with given fields:
func (_m *EncryptionClient) EnableEncryption() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for EnableEncryption")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// MigrateEncryption provides a mock function with given fields: newEncryption
func (_m *EncryptionClient) MigrateEncryption(newEncryption types.EncryptionService) error {
ret := _m.Called(newEncryption)
if len(ret) == 0 {
panic("no return value specified for MigrateEncryption")
}
var r0 error
if rf, ok := ret.Get(0).(func(types.EncryptionService) error); ok {
r0 = rf(newEncryption)
} else {
r0 = ret.Error(0)
}
return r0
}
// SetEncryptionService provides a mock function with given fields: encryption
func (_m *EncryptionClient) SetEncryptionService(encryption types.EncryptionService) error {
ret := _m.Called(encryption)
if len(ret) == 0 {
panic("no return value specified for SetEncryptionService")
}
var r0 error
if rf, ok := ret.Get(0).(func(types.EncryptionService) error); ok {
r0 = rf(encryption)
} else {
r0 = ret.Error(0)
}
return r0
}
// NewEncryptionClient creates a new instance of EncryptionClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewEncryptionClient(t interface {
mock.TestingT
Cleanup(func())
}) *EncryptionClient {
mock := &EncryptionClient{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,98 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import mock "github.com/stretchr/testify/mock"
// EncryptionService is an autogenerated mock type for the EncryptionService type
type EncryptionService struct {
mock.Mock
}
// Decrypt provides a mock function with given fields: ciphertext, associatedData
func (_m *EncryptionService) Decrypt(ciphertext string, associatedData string) (string, error) {
ret := _m.Called(ciphertext, associatedData)
if len(ret) == 0 {
panic("no return value specified for Decrypt")
}
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(string, string) (string, error)); ok {
return rf(ciphertext, associatedData)
}
if rf, ok := ret.Get(0).(func(string, string) string); ok {
r0 = rf(ciphertext, associatedData)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(string, string) error); ok {
r1 = rf(ciphertext, associatedData)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Disable provides a mock function with given fields:
func (_m *EncryptionService) Disable() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Disable")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// Encrypt provides a mock function with given fields: plaintext, associatedData
func (_m *EncryptionService) Encrypt(plaintext string, associatedData string) (string, error) {
ret := _m.Called(plaintext, associatedData)
if len(ret) == 0 {
panic("no return value specified for Encrypt")
}
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(string, string) (string, error)); ok {
return rf(plaintext, associatedData)
}
if rf, ok := ret.Get(0).(func(string, string) string); ok {
r0 = rf(plaintext, associatedData)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(string, string) error); ok {
r1 = rf(plaintext, associatedData)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewEncryptionService creates a new instance of EncryptionService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewEncryptionService(t interface {
mock.TestingT
Cleanup(func())
}) *EncryptionService {
mock := &EncryptionService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,77 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
types "codeberg.org/crowci/crow/v3/server/services/encryption/types"
mock "github.com/stretchr/testify/mock"
)
// EncryptionServiceBuilder is an autogenerated mock type for the EncryptionServiceBuilder type
type EncryptionServiceBuilder struct {
mock.Mock
}
// Build provides a mock function with given fields:
func (_m *EncryptionServiceBuilder) Build() (types.EncryptionService, error) {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Build")
}
var r0 types.EncryptionService
var r1 error
if rf, ok := ret.Get(0).(func() (types.EncryptionService, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() types.EncryptionService); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(types.EncryptionService)
}
}
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// WithClients provides a mock function with given fields: clients
func (_m *EncryptionServiceBuilder) WithClients(clients []types.EncryptionClient) types.EncryptionServiceBuilder {
ret := _m.Called(clients)
if len(ret) == 0 {
panic("no return value specified for WithClients")
}
var r0 types.EncryptionServiceBuilder
if rf, ok := ret.Get(0).(func([]types.EncryptionClient) types.EncryptionServiceBuilder); ok {
r0 = rf(clients)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(types.EncryptionServiceBuilder)
}
}
return r0
}
// NewEncryptionServiceBuilder creates a new instance of EncryptionServiceBuilder. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewEncryptionServiceBuilder(t interface {
mock.TestingT
Cleanup(func())
}) *EncryptionServiceBuilder {
mock := &EncryptionServiceBuilder{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,87 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
model "codeberg.org/crowci/crow/v3/server/model"
mock "github.com/stretchr/testify/mock"
)
// ReadOnlyService is an autogenerated mock type for the ReadOnlyService type
type ReadOnlyService struct {
mock.Mock
}
// GlobalRegistryFind provides a mock function with given fields: _a0
func (_m *ReadOnlyService) GlobalRegistryFind(_a0 string) (*model.Registry, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalRegistryFind")
}
var r0 *model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.Registry, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(string) *model.Registry); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Registry)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GlobalRegistryList provides a mock function with given fields: _a0
func (_m *ReadOnlyService) GlobalRegistryList(_a0 *model.ListOptions) ([]*model.Registry, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalRegistryList")
}
var r0 []*model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(*model.ListOptions) ([]*model.Registry, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.ListOptions) []*model.Registry); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Registry)
}
}
if rf, ok := ret.Get(1).(func(*model.ListOptions) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewReadOnlyService creates a new instance of ReadOnlyService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewReadOnlyService(t interface {
mock.TestingT
Cleanup(func())
}) *ReadOnlyService {
mock := &ReadOnlyService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,399 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
model "codeberg.org/crowci/crow/v3/server/model"
mock "github.com/stretchr/testify/mock"
)
// Service is an autogenerated mock type for the Service type
type Service struct {
mock.Mock
}
// GlobalSecretCreate provides a mock function with given fields: _a0
func (_m *Service) GlobalSecretCreate(_a0 *model.Secret) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalSecretCreate")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Secret) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// GlobalSecretDelete provides a mock function with given fields: _a0
func (_m *Service) GlobalSecretDelete(_a0 string) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalSecretDelete")
}
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// GlobalSecretFind provides a mock function with given fields: _a0
func (_m *Service) GlobalSecretFind(_a0 string) (*model.Secret, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalSecretFind")
}
var r0 *model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.Secret, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(string) *model.Secret); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GlobalSecretList provides a mock function with given fields: _a0
func (_m *Service) GlobalSecretList(_a0 *model.ListOptions) ([]*model.Secret, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalSecretList")
}
var r0 []*model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(*model.ListOptions) ([]*model.Secret, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.ListOptions) []*model.Secret); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(*model.ListOptions) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GlobalSecretUpdate provides a mock function with given fields: _a0
func (_m *Service) GlobalSecretUpdate(_a0 *model.Secret) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalSecretUpdate")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Secret) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// OrgSecretCreate provides a mock function with given fields: _a0, _a1
func (_m *Service) OrgSecretCreate(_a0 int64, _a1 *model.Secret) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgSecretCreate")
}
var r0 error
if rf, ok := ret.Get(0).(func(int64, *model.Secret) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// OrgSecretDelete provides a mock function with given fields: _a0, _a1
func (_m *Service) OrgSecretDelete(_a0 int64, _a1 string) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgSecretDelete")
}
var r0 error
if rf, ok := ret.Get(0).(func(int64, string) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// OrgSecretFind provides a mock function with given fields: _a0, _a1
func (_m *Service) OrgSecretFind(_a0 int64, _a1 string) (*model.Secret, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgSecretFind")
}
var r0 *model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(int64, string) (*model.Secret, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(int64, string) *model.Secret); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(int64, string) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// OrgSecretList provides a mock function with given fields: _a0, _a1
func (_m *Service) OrgSecretList(_a0 int64, _a1 *model.ListOptions) ([]*model.Secret, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgSecretList")
}
var r0 []*model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(int64, *model.ListOptions) ([]*model.Secret, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(int64, *model.ListOptions) []*model.Secret); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(int64, *model.ListOptions) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// OrgSecretUpdate provides a mock function with given fields: _a0, _a1
func (_m *Service) OrgSecretUpdate(_a0 int64, _a1 *model.Secret) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgSecretUpdate")
}
var r0 error
if rf, ok := ret.Get(0).(func(int64, *model.Secret) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// SecretCreate provides a mock function with given fields: _a0, _a1
func (_m *Service) SecretCreate(_a0 *model.Repo, _a1 *model.Secret) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for SecretCreate")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Repo, *model.Secret) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// SecretDelete provides a mock function with given fields: _a0, _a1
func (_m *Service) SecretDelete(_a0 *model.Repo, _a1 string) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for SecretDelete")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Repo, string) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// SecretFind provides a mock function with given fields: _a0, _a1
func (_m *Service) SecretFind(_a0 *model.Repo, _a1 string) (*model.Secret, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for SecretFind")
}
var r0 *model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, string) (*model.Secret, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, string) *model.Secret); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(*model.Repo, string) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SecretList provides a mock function with given fields: _a0, _a1
func (_m *Service) SecretList(_a0 *model.Repo, _a1 *model.ListOptions) ([]*model.Secret, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for SecretList")
}
var r0 []*model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, *model.ListOptions) ([]*model.Secret, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, *model.ListOptions) []*model.Secret); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(*model.Repo, *model.ListOptions) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SecretListPipeline provides a mock function with given fields: _a0, _a1
func (_m *Service) SecretListPipeline(_a0 *model.Repo, _a1 *model.Pipeline) ([]*model.Secret, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for SecretListPipeline")
}
var r0 []*model.Secret
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, *model.Pipeline) ([]*model.Secret, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, *model.Pipeline) []*model.Secret); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Secret)
}
}
if rf, ok := ret.Get(1).(func(*model.Repo, *model.Pipeline) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SecretUpdate provides a mock function with given fields: _a0, _a1
func (_m *Service) SecretUpdate(_a0 *model.Repo, _a1 *model.Secret) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for SecretUpdate")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Repo, *model.Secret) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// NewService creates a new instance of Service. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewService(t interface {
mock.TestingT
Cleanup(func())
}) *Service {
mock := &Service{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,59 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
forge "codeberg.org/crowci/crow/v3/server/forge"
mock "github.com/stretchr/testify/mock"
model "codeberg.org/crowci/crow/v3/server/model"
)
// SetupForge is an autogenerated mock type for the SetupForge type
type SetupForge struct {
mock.Mock
}
// Execute provides a mock function with given fields: _a0
func (_m *SetupForge) Execute(_a0 *model.Forge) (forge.Forge, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for Execute")
}
var r0 forge.Forge
var r1 error
if rf, ok := ret.Get(0).(func(*model.Forge) (forge.Forge, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.Forge) forge.Forge); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(forge.Forge)
}
}
if rf, ok := ret.Get(1).(func(*model.Forge) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewSetupForge creates a new instance of SetupForge. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewSetupForge(t interface {
mock.TestingT
Cleanup(func())
}) *SetupForge {
mock := &SetupForge{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,273 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
//go:build test
// +build test
package mocks
import (
crypto "crypto"
config "codeberg.org/crowci/crow/v3/server/services/config"
environment "codeberg.org/crowci/crow/v3/server/services/environment"
forge "codeberg.org/crowci/crow/v3/server/forge"
mock "github.com/stretchr/testify/mock"
model "codeberg.org/crowci/crow/v3/server/model"
registry "codeberg.org/crowci/crow/v3/server/services/registry"
secret "codeberg.org/crowci/crow/v3/server/services/secret"
)
// Manager is an autogenerated mock type for the Manager type
type Manager struct {
mock.Mock
}
// ConfigServiceFromRepo provides a mock function with given fields: repo
func (_m *Manager) ConfigServiceFromRepo(repo *model.Repo) config.Service {
ret := _m.Called(repo)
if len(ret) == 0 {
panic("no return value specified for ConfigServiceFromRepo")
}
var r0 config.Service
if rf, ok := ret.Get(0).(func(*model.Repo) config.Service); ok {
r0 = rf(repo)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(config.Service)
}
}
return r0
}
// EnvironmentService provides a mock function with given fields:
func (_m *Manager) EnvironmentService() environment.Service {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for EnvironmentService")
}
var r0 environment.Service
if rf, ok := ret.Get(0).(func() environment.Service); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(environment.Service)
}
}
return r0
}
// ForgeByID provides a mock function with given fields: forgeID
func (_m *Manager) ForgeByID(forgeID int64) (forge.Forge, error) {
ret := _m.Called(forgeID)
if len(ret) == 0 {
panic("no return value specified for ForgeByID")
}
var r0 forge.Forge
var r1 error
if rf, ok := ret.Get(0).(func(int64) (forge.Forge, error)); ok {
return rf(forgeID)
}
if rf, ok := ret.Get(0).(func(int64) forge.Forge); ok {
r0 = rf(forgeID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(forge.Forge)
}
}
if rf, ok := ret.Get(1).(func(int64) error); ok {
r1 = rf(forgeID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ForgeFromRepo provides a mock function with given fields: repo
func (_m *Manager) ForgeFromRepo(repo *model.Repo) (forge.Forge, error) {
ret := _m.Called(repo)
if len(ret) == 0 {
panic("no return value specified for ForgeFromRepo")
}
var r0 forge.Forge
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo) (forge.Forge, error)); ok {
return rf(repo)
}
if rf, ok := ret.Get(0).(func(*model.Repo) forge.Forge); ok {
r0 = rf(repo)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(forge.Forge)
}
}
if rf, ok := ret.Get(1).(func(*model.Repo) error); ok {
r1 = rf(repo)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ForgeFromUser provides a mock function with given fields: user
func (_m *Manager) ForgeFromUser(user *model.User) (forge.Forge, error) {
ret := _m.Called(user)
if len(ret) == 0 {
panic("no return value specified for ForgeFromUser")
}
var r0 forge.Forge
var r1 error
if rf, ok := ret.Get(0).(func(*model.User) (forge.Forge, error)); ok {
return rf(user)
}
if rf, ok := ret.Get(0).(func(*model.User) forge.Forge); ok {
r0 = rf(user)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(forge.Forge)
}
}
if rf, ok := ret.Get(1).(func(*model.User) error); ok {
r1 = rf(user)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// RegistryService provides a mock function with given fields:
func (_m *Manager) RegistryService() registry.Service {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for RegistryService")
}
var r0 registry.Service
if rf, ok := ret.Get(0).(func() registry.Service); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(registry.Service)
}
}
return r0
}
// RegistryServiceFromRepo provides a mock function with given fields: repo
func (_m *Manager) RegistryServiceFromRepo(repo *model.Repo) registry.Service {
ret := _m.Called(repo)
if len(ret) == 0 {
panic("no return value specified for RegistryServiceFromRepo")
}
var r0 registry.Service
if rf, ok := ret.Get(0).(func(*model.Repo) registry.Service); ok {
r0 = rf(repo)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(registry.Service)
}
}
return r0
}
// SecretService provides a mock function with given fields:
func (_m *Manager) SecretService() secret.Service {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for SecretService")
}
var r0 secret.Service
if rf, ok := ret.Get(0).(func() secret.Service); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(secret.Service)
}
}
return r0
}
// SecretServiceFromRepo provides a mock function with given fields: repo
func (_m *Manager) SecretServiceFromRepo(repo *model.Repo) secret.Service {
ret := _m.Called(repo)
if len(ret) == 0 {
panic("no return value specified for SecretServiceFromRepo")
}
var r0 secret.Service
if rf, ok := ret.Get(0).(func(*model.Repo) secret.Service); ok {
r0 = rf(repo)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(secret.Service)
}
}
return r0
}
// SignaturePublicKey provides a mock function with given fields:
func (_m *Manager) SignaturePublicKey() crypto.PublicKey {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for SignaturePublicKey")
}
var r0 crypto.PublicKey
if rf, ok := ret.Get(0).(func() crypto.PublicKey); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(crypto.PublicKey)
}
}
return r0
}
// NewManager creates a new instance of Manager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewManager(t interface {
mock.TestingT
Cleanup(func())
}) *Manager {
mock := &Manager{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,554 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package services
import (
crypto "crypto"
config "codeberg.org/crowci/crow/v3/server/services/config"
environment "codeberg.org/crowci/crow/v3/server/services/environment"
forge "codeberg.org/crowci/crow/v3/server/forge"
mock "github.com/stretchr/testify/mock"
model "codeberg.org/crowci/crow/v3/server/model"
registry "codeberg.org/crowci/crow/v3/server/services/registry"
secret "codeberg.org/crowci/crow/v3/server/services/secret"
)
// MockManager is an autogenerated mock type for the Manager type
type MockManager struct {
mock.Mock
}
type MockManager_Expecter struct {
mock *mock.Mock
}
func (_m *MockManager) EXPECT() *MockManager_Expecter {
return &MockManager_Expecter{mock: &_m.Mock}
}
// ConfigServiceFromRepo provides a mock function with given fields: repo
func (_m *MockManager) ConfigServiceFromRepo(repo *model.Repo) config.Service {
ret := _m.Called(repo)
if len(ret) == 0 {
panic("no return value specified for ConfigServiceFromRepo")
}
var r0 config.Service
if rf, ok := ret.Get(0).(func(*model.Repo) config.Service); ok {
r0 = rf(repo)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(config.Service)
}
}
return r0
}
// MockManager_ConfigServiceFromRepo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ConfigServiceFromRepo'
type MockManager_ConfigServiceFromRepo_Call struct {
*mock.Call
}
// ConfigServiceFromRepo is a helper method to define mock.On call
// - repo *model.Repo
func (_e *MockManager_Expecter) ConfigServiceFromRepo(repo interface{}) *MockManager_ConfigServiceFromRepo_Call {
return &MockManager_ConfigServiceFromRepo_Call{Call: _e.mock.On("ConfigServiceFromRepo", repo)}
}
func (_c *MockManager_ConfigServiceFromRepo_Call) Run(run func(repo *model.Repo)) *MockManager_ConfigServiceFromRepo_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Repo))
})
return _c
}
func (_c *MockManager_ConfigServiceFromRepo_Call) Return(_a0 config.Service) *MockManager_ConfigServiceFromRepo_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockManager_ConfigServiceFromRepo_Call) RunAndReturn(run func(*model.Repo) config.Service) *MockManager_ConfigServiceFromRepo_Call {
_c.Call.Return(run)
return _c
}
// EnvironmentService provides a mock function with no fields
func (_m *MockManager) EnvironmentService() environment.Service {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for EnvironmentService")
}
var r0 environment.Service
if rf, ok := ret.Get(0).(func() environment.Service); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(environment.Service)
}
}
return r0
}
// MockManager_EnvironmentService_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnvironmentService'
type MockManager_EnvironmentService_Call struct {
*mock.Call
}
// EnvironmentService is a helper method to define mock.On call
func (_e *MockManager_Expecter) EnvironmentService() *MockManager_EnvironmentService_Call {
return &MockManager_EnvironmentService_Call{Call: _e.mock.On("EnvironmentService")}
}
func (_c *MockManager_EnvironmentService_Call) Run(run func()) *MockManager_EnvironmentService_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockManager_EnvironmentService_Call) Return(_a0 environment.Service) *MockManager_EnvironmentService_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockManager_EnvironmentService_Call) RunAndReturn(run func() environment.Service) *MockManager_EnvironmentService_Call {
_c.Call.Return(run)
return _c
}
// ForgeByID provides a mock function with given fields: forgeID
func (_m *MockManager) ForgeByID(forgeID int64) (forge.Forge, error) {
ret := _m.Called(forgeID)
if len(ret) == 0 {
panic("no return value specified for ForgeByID")
}
var r0 forge.Forge
var r1 error
if rf, ok := ret.Get(0).(func(int64) (forge.Forge, error)); ok {
return rf(forgeID)
}
if rf, ok := ret.Get(0).(func(int64) forge.Forge); ok {
r0 = rf(forgeID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(forge.Forge)
}
}
if rf, ok := ret.Get(1).(func(int64) error); ok {
r1 = rf(forgeID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockManager_ForgeByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ForgeByID'
type MockManager_ForgeByID_Call struct {
*mock.Call
}
// ForgeByID is a helper method to define mock.On call
// - forgeID int64
func (_e *MockManager_Expecter) ForgeByID(forgeID interface{}) *MockManager_ForgeByID_Call {
return &MockManager_ForgeByID_Call{Call: _e.mock.On("ForgeByID", forgeID)}
}
func (_c *MockManager_ForgeByID_Call) Run(run func(forgeID int64)) *MockManager_ForgeByID_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(int64))
})
return _c
}
func (_c *MockManager_ForgeByID_Call) Return(_a0 forge.Forge, _a1 error) *MockManager_ForgeByID_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockManager_ForgeByID_Call) RunAndReturn(run func(int64) (forge.Forge, error)) *MockManager_ForgeByID_Call {
_c.Call.Return(run)
return _c
}
// ForgeFromRepo provides a mock function with given fields: repo
func (_m *MockManager) ForgeFromRepo(repo *model.Repo) (forge.Forge, error) {
ret := _m.Called(repo)
if len(ret) == 0 {
panic("no return value specified for ForgeFromRepo")
}
var r0 forge.Forge
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo) (forge.Forge, error)); ok {
return rf(repo)
}
if rf, ok := ret.Get(0).(func(*model.Repo) forge.Forge); ok {
r0 = rf(repo)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(forge.Forge)
}
}
if rf, ok := ret.Get(1).(func(*model.Repo) error); ok {
r1 = rf(repo)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockManager_ForgeFromRepo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ForgeFromRepo'
type MockManager_ForgeFromRepo_Call struct {
*mock.Call
}
// ForgeFromRepo is a helper method to define mock.On call
// - repo *model.Repo
func (_e *MockManager_Expecter) ForgeFromRepo(repo interface{}) *MockManager_ForgeFromRepo_Call {
return &MockManager_ForgeFromRepo_Call{Call: _e.mock.On("ForgeFromRepo", repo)}
}
func (_c *MockManager_ForgeFromRepo_Call) Run(run func(repo *model.Repo)) *MockManager_ForgeFromRepo_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Repo))
})
return _c
}
func (_c *MockManager_ForgeFromRepo_Call) Return(_a0 forge.Forge, _a1 error) *MockManager_ForgeFromRepo_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockManager_ForgeFromRepo_Call) RunAndReturn(run func(*model.Repo) (forge.Forge, error)) *MockManager_ForgeFromRepo_Call {
_c.Call.Return(run)
return _c
}
// ForgeFromUser provides a mock function with given fields: user
func (_m *MockManager) ForgeFromUser(user *model.User) (forge.Forge, error) {
ret := _m.Called(user)
if len(ret) == 0 {
panic("no return value specified for ForgeFromUser")
}
var r0 forge.Forge
var r1 error
if rf, ok := ret.Get(0).(func(*model.User) (forge.Forge, error)); ok {
return rf(user)
}
if rf, ok := ret.Get(0).(func(*model.User) forge.Forge); ok {
r0 = rf(user)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(forge.Forge)
}
}
if rf, ok := ret.Get(1).(func(*model.User) error); ok {
r1 = rf(user)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockManager_ForgeFromUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ForgeFromUser'
type MockManager_ForgeFromUser_Call struct {
*mock.Call
}
// ForgeFromUser is a helper method to define mock.On call
// - user *model.User
func (_e *MockManager_Expecter) ForgeFromUser(user interface{}) *MockManager_ForgeFromUser_Call {
return &MockManager_ForgeFromUser_Call{Call: _e.mock.On("ForgeFromUser", user)}
}
func (_c *MockManager_ForgeFromUser_Call) Run(run func(user *model.User)) *MockManager_ForgeFromUser_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.User))
})
return _c
}
func (_c *MockManager_ForgeFromUser_Call) Return(_a0 forge.Forge, _a1 error) *MockManager_ForgeFromUser_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockManager_ForgeFromUser_Call) RunAndReturn(run func(*model.User) (forge.Forge, error)) *MockManager_ForgeFromUser_Call {
_c.Call.Return(run)
return _c
}
// RegistryService provides a mock function with no fields
func (_m *MockManager) RegistryService() registry.Service {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for RegistryService")
}
var r0 registry.Service
if rf, ok := ret.Get(0).(func() registry.Service); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(registry.Service)
}
}
return r0
}
// MockManager_RegistryService_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegistryService'
type MockManager_RegistryService_Call struct {
*mock.Call
}
// RegistryService is a helper method to define mock.On call
func (_e *MockManager_Expecter) RegistryService() *MockManager_RegistryService_Call {
return &MockManager_RegistryService_Call{Call: _e.mock.On("RegistryService")}
}
func (_c *MockManager_RegistryService_Call) Run(run func()) *MockManager_RegistryService_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockManager_RegistryService_Call) Return(_a0 registry.Service) *MockManager_RegistryService_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockManager_RegistryService_Call) RunAndReturn(run func() registry.Service) *MockManager_RegistryService_Call {
_c.Call.Return(run)
return _c
}
// RegistryServiceFromRepo provides a mock function with given fields: repo
func (_m *MockManager) RegistryServiceFromRepo(repo *model.Repo) registry.Service {
ret := _m.Called(repo)
if len(ret) == 0 {
panic("no return value specified for RegistryServiceFromRepo")
}
var r0 registry.Service
if rf, ok := ret.Get(0).(func(*model.Repo) registry.Service); ok {
r0 = rf(repo)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(registry.Service)
}
}
return r0
}
// MockManager_RegistryServiceFromRepo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegistryServiceFromRepo'
type MockManager_RegistryServiceFromRepo_Call struct {
*mock.Call
}
// RegistryServiceFromRepo is a helper method to define mock.On call
// - repo *model.Repo
func (_e *MockManager_Expecter) RegistryServiceFromRepo(repo interface{}) *MockManager_RegistryServiceFromRepo_Call {
return &MockManager_RegistryServiceFromRepo_Call{Call: _e.mock.On("RegistryServiceFromRepo", repo)}
}
func (_c *MockManager_RegistryServiceFromRepo_Call) Run(run func(repo *model.Repo)) *MockManager_RegistryServiceFromRepo_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Repo))
})
return _c
}
func (_c *MockManager_RegistryServiceFromRepo_Call) Return(_a0 registry.Service) *MockManager_RegistryServiceFromRepo_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockManager_RegistryServiceFromRepo_Call) RunAndReturn(run func(*model.Repo) registry.Service) *MockManager_RegistryServiceFromRepo_Call {
_c.Call.Return(run)
return _c
}
// SecretService provides a mock function with no fields
func (_m *MockManager) SecretService() secret.Service {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for SecretService")
}
var r0 secret.Service
if rf, ok := ret.Get(0).(func() secret.Service); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(secret.Service)
}
}
return r0
}
// MockManager_SecretService_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SecretService'
type MockManager_SecretService_Call struct {
*mock.Call
}
// SecretService is a helper method to define mock.On call
func (_e *MockManager_Expecter) SecretService() *MockManager_SecretService_Call {
return &MockManager_SecretService_Call{Call: _e.mock.On("SecretService")}
}
func (_c *MockManager_SecretService_Call) Run(run func()) *MockManager_SecretService_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockManager_SecretService_Call) Return(_a0 secret.Service) *MockManager_SecretService_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockManager_SecretService_Call) RunAndReturn(run func() secret.Service) *MockManager_SecretService_Call {
_c.Call.Return(run)
return _c
}
// SecretServiceFromRepo provides a mock function with given fields: repo
func (_m *MockManager) SecretServiceFromRepo(repo *model.Repo) secret.Service {
ret := _m.Called(repo)
if len(ret) == 0 {
panic("no return value specified for SecretServiceFromRepo")
}
var r0 secret.Service
if rf, ok := ret.Get(0).(func(*model.Repo) secret.Service); ok {
r0 = rf(repo)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(secret.Service)
}
}
return r0
}
// MockManager_SecretServiceFromRepo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SecretServiceFromRepo'
type MockManager_SecretServiceFromRepo_Call struct {
*mock.Call
}
// SecretServiceFromRepo is a helper method to define mock.On call
// - repo *model.Repo
func (_e *MockManager_Expecter) SecretServiceFromRepo(repo interface{}) *MockManager_SecretServiceFromRepo_Call {
return &MockManager_SecretServiceFromRepo_Call{Call: _e.mock.On("SecretServiceFromRepo", repo)}
}
func (_c *MockManager_SecretServiceFromRepo_Call) Run(run func(repo *model.Repo)) *MockManager_SecretServiceFromRepo_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Repo))
})
return _c
}
func (_c *MockManager_SecretServiceFromRepo_Call) Return(_a0 secret.Service) *MockManager_SecretServiceFromRepo_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockManager_SecretServiceFromRepo_Call) RunAndReturn(run func(*model.Repo) secret.Service) *MockManager_SecretServiceFromRepo_Call {
_c.Call.Return(run)
return _c
}
// SignaturePublicKey provides a mock function with no fields
func (_m *MockManager) SignaturePublicKey() crypto.PublicKey {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for SignaturePublicKey")
}
var r0 crypto.PublicKey
if rf, ok := ret.Get(0).(func() crypto.PublicKey); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(crypto.PublicKey)
}
}
return r0
}
// MockManager_SignaturePublicKey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SignaturePublicKey'
type MockManager_SignaturePublicKey_Call struct {
*mock.Call
}
// SignaturePublicKey is a helper method to define mock.On call
func (_e *MockManager_Expecter) SignaturePublicKey() *MockManager_SignaturePublicKey_Call {
return &MockManager_SignaturePublicKey_Call{Call: _e.mock.On("SignaturePublicKey")}
}
func (_c *MockManager_SignaturePublicKey_Call) Run(run func()) *MockManager_SignaturePublicKey_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockManager_SignaturePublicKey_Call) Return(_a0 crypto.PublicKey) *MockManager_SignaturePublicKey_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockManager_SignaturePublicKey_Call) RunAndReturn(run func() crypto.PublicKey) *MockManager_SignaturePublicKey_Call {
_c.Call.Return(run)
return _c
}
// NewMockManager creates a new instance of MockManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockManager(t interface {
mock.TestingT
Cleanup(func())
}) *MockManager {
mock := &MockManager{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,95 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package services
import (
forge "codeberg.org/crowci/crow/v3/server/forge"
mock "github.com/stretchr/testify/mock"
model "codeberg.org/crowci/crow/v3/server/model"
)
// MockSetupForge is an autogenerated mock type for the SetupForge type
type MockSetupForge struct {
mock.Mock
}
type MockSetupForge_Expecter struct {
mock *mock.Mock
}
func (_m *MockSetupForge) EXPECT() *MockSetupForge_Expecter {
return &MockSetupForge_Expecter{mock: &_m.Mock}
}
// Execute provides a mock function with given fields: _a0
func (_m *MockSetupForge) Execute(_a0 *model.Forge) (forge.Forge, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for Execute")
}
var r0 forge.Forge
var r1 error
if rf, ok := ret.Get(0).(func(*model.Forge) (forge.Forge, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.Forge) forge.Forge); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(forge.Forge)
}
}
if rf, ok := ret.Get(1).(func(*model.Forge) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockSetupForge_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
type MockSetupForge_Execute_Call struct {
*mock.Call
}
// Execute is a helper method to define mock.On call
// - _a0 *model.Forge
func (_e *MockSetupForge_Expecter) Execute(_a0 interface{}) *MockSetupForge_Execute_Call {
return &MockSetupForge_Execute_Call{Call: _e.mock.On("Execute", _a0)}
}
func (_c *MockSetupForge_Execute_Call) Run(run func(_a0 *model.Forge)) *MockSetupForge_Execute_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Forge))
})
return _c
}
func (_c *MockSetupForge_Execute_Call) Return(_a0 forge.Forge, _a1 error) *MockSetupForge_Execute_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockSetupForge_Execute_Call) RunAndReturn(run func(*model.Forge) (forge.Forge, error)) *MockSetupForge_Execute_Call {
_c.Call.Return(run)
return _c
}
// NewMockSetupForge creates a new instance of MockSetupForge. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockSetupForge(t interface {
mock.TestingT
Cleanup(func())
}) *MockSetupForge {
mock := &MockSetupForge{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,151 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package registry
import (
model "codeberg.org/crowci/crow/v3/server/model"
mock "github.com/stretchr/testify/mock"
)
// MockReadOnlyService is an autogenerated mock type for the ReadOnlyService type
type MockReadOnlyService struct {
mock.Mock
}
type MockReadOnlyService_Expecter struct {
mock *mock.Mock
}
func (_m *MockReadOnlyService) EXPECT() *MockReadOnlyService_Expecter {
return &MockReadOnlyService_Expecter{mock: &_m.Mock}
}
// GlobalRegistryFind provides a mock function with given fields: _a0
func (_m *MockReadOnlyService) GlobalRegistryFind(_a0 string) (*model.Registry, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalRegistryFind")
}
var r0 *model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.Registry, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(string) *model.Registry); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Registry)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockReadOnlyService_GlobalRegistryFind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GlobalRegistryFind'
type MockReadOnlyService_GlobalRegistryFind_Call struct {
*mock.Call
}
// GlobalRegistryFind is a helper method to define mock.On call
// - _a0 string
func (_e *MockReadOnlyService_Expecter) GlobalRegistryFind(_a0 interface{}) *MockReadOnlyService_GlobalRegistryFind_Call {
return &MockReadOnlyService_GlobalRegistryFind_Call{Call: _e.mock.On("GlobalRegistryFind", _a0)}
}
func (_c *MockReadOnlyService_GlobalRegistryFind_Call) Run(run func(_a0 string)) *MockReadOnlyService_GlobalRegistryFind_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string))
})
return _c
}
func (_c *MockReadOnlyService_GlobalRegistryFind_Call) Return(_a0 *model.Registry, _a1 error) *MockReadOnlyService_GlobalRegistryFind_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockReadOnlyService_GlobalRegistryFind_Call) RunAndReturn(run func(string) (*model.Registry, error)) *MockReadOnlyService_GlobalRegistryFind_Call {
_c.Call.Return(run)
return _c
}
// GlobalRegistryList provides a mock function with given fields: _a0
func (_m *MockReadOnlyService) GlobalRegistryList(_a0 *model.ListOptions) ([]*model.Registry, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalRegistryList")
}
var r0 []*model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(*model.ListOptions) ([]*model.Registry, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.ListOptions) []*model.Registry); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Registry)
}
}
if rf, ok := ret.Get(1).(func(*model.ListOptions) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockReadOnlyService_GlobalRegistryList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GlobalRegistryList'
type MockReadOnlyService_GlobalRegistryList_Call struct {
*mock.Call
}
// GlobalRegistryList is a helper method to define mock.On call
// - _a0 *model.ListOptions
func (_e *MockReadOnlyService_Expecter) GlobalRegistryList(_a0 interface{}) *MockReadOnlyService_GlobalRegistryList_Call {
return &MockReadOnlyService_GlobalRegistryList_Call{Call: _e.mock.On("GlobalRegistryList", _a0)}
}
func (_c *MockReadOnlyService_GlobalRegistryList_Call) Run(run func(_a0 *model.ListOptions)) *MockReadOnlyService_GlobalRegistryList_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.ListOptions))
})
return _c
}
func (_c *MockReadOnlyService_GlobalRegistryList_Call) Return(_a0 []*model.Registry, _a1 error) *MockReadOnlyService_GlobalRegistryList_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockReadOnlyService_GlobalRegistryList_Call) RunAndReturn(run func(*model.ListOptions) ([]*model.Registry, error)) *MockReadOnlyService_GlobalRegistryList_Call {
_c.Call.Return(run)
return _c
}
// NewMockReadOnlyService creates a new instance of MockReadOnlyService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockReadOnlyService(t interface {
mock.TestingT
Cleanup(func())
}) *MockReadOnlyService {
mock := &MockReadOnlyService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -0,0 +1,866 @@
// Code generated by mockery v2.52.2. DO NOT EDIT.
package registry
import (
model "codeberg.org/crowci/crow/v3/server/model"
mock "github.com/stretchr/testify/mock"
)
// MockService is an autogenerated mock type for the Service type
type MockService struct {
mock.Mock
}
type MockService_Expecter struct {
mock *mock.Mock
}
func (_m *MockService) EXPECT() *MockService_Expecter {
return &MockService_Expecter{mock: &_m.Mock}
}
// GlobalRegistryCreate provides a mock function with given fields: _a0
func (_m *MockService) GlobalRegistryCreate(_a0 *model.Registry) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalRegistryCreate")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Registry) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockService_GlobalRegistryCreate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GlobalRegistryCreate'
type MockService_GlobalRegistryCreate_Call struct {
*mock.Call
}
// GlobalRegistryCreate is a helper method to define mock.On call
// - _a0 *model.Registry
func (_e *MockService_Expecter) GlobalRegistryCreate(_a0 interface{}) *MockService_GlobalRegistryCreate_Call {
return &MockService_GlobalRegistryCreate_Call{Call: _e.mock.On("GlobalRegistryCreate", _a0)}
}
func (_c *MockService_GlobalRegistryCreate_Call) Run(run func(_a0 *model.Registry)) *MockService_GlobalRegistryCreate_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Registry))
})
return _c
}
func (_c *MockService_GlobalRegistryCreate_Call) Return(_a0 error) *MockService_GlobalRegistryCreate_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockService_GlobalRegistryCreate_Call) RunAndReturn(run func(*model.Registry) error) *MockService_GlobalRegistryCreate_Call {
_c.Call.Return(run)
return _c
}
// GlobalRegistryDelete provides a mock function with given fields: _a0
func (_m *MockService) GlobalRegistryDelete(_a0 string) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalRegistryDelete")
}
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockService_GlobalRegistryDelete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GlobalRegistryDelete'
type MockService_GlobalRegistryDelete_Call struct {
*mock.Call
}
// GlobalRegistryDelete is a helper method to define mock.On call
// - _a0 string
func (_e *MockService_Expecter) GlobalRegistryDelete(_a0 interface{}) *MockService_GlobalRegistryDelete_Call {
return &MockService_GlobalRegistryDelete_Call{Call: _e.mock.On("GlobalRegistryDelete", _a0)}
}
func (_c *MockService_GlobalRegistryDelete_Call) Run(run func(_a0 string)) *MockService_GlobalRegistryDelete_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string))
})
return _c
}
func (_c *MockService_GlobalRegistryDelete_Call) Return(_a0 error) *MockService_GlobalRegistryDelete_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockService_GlobalRegistryDelete_Call) RunAndReturn(run func(string) error) *MockService_GlobalRegistryDelete_Call {
_c.Call.Return(run)
return _c
}
// GlobalRegistryFind provides a mock function with given fields: _a0
func (_m *MockService) GlobalRegistryFind(_a0 string) (*model.Registry, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalRegistryFind")
}
var r0 *model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.Registry, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(string) *model.Registry); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Registry)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockService_GlobalRegistryFind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GlobalRegistryFind'
type MockService_GlobalRegistryFind_Call struct {
*mock.Call
}
// GlobalRegistryFind is a helper method to define mock.On call
// - _a0 string
func (_e *MockService_Expecter) GlobalRegistryFind(_a0 interface{}) *MockService_GlobalRegistryFind_Call {
return &MockService_GlobalRegistryFind_Call{Call: _e.mock.On("GlobalRegistryFind", _a0)}
}
func (_c *MockService_GlobalRegistryFind_Call) Run(run func(_a0 string)) *MockService_GlobalRegistryFind_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string))
})
return _c
}
func (_c *MockService_GlobalRegistryFind_Call) Return(_a0 *model.Registry, _a1 error) *MockService_GlobalRegistryFind_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockService_GlobalRegistryFind_Call) RunAndReturn(run func(string) (*model.Registry, error)) *MockService_GlobalRegistryFind_Call {
_c.Call.Return(run)
return _c
}
// GlobalRegistryList provides a mock function with given fields: _a0
func (_m *MockService) GlobalRegistryList(_a0 *model.ListOptions) ([]*model.Registry, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalRegistryList")
}
var r0 []*model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(*model.ListOptions) ([]*model.Registry, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.ListOptions) []*model.Registry); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Registry)
}
}
if rf, ok := ret.Get(1).(func(*model.ListOptions) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockService_GlobalRegistryList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GlobalRegistryList'
type MockService_GlobalRegistryList_Call struct {
*mock.Call
}
// GlobalRegistryList is a helper method to define mock.On call
// - _a0 *model.ListOptions
func (_e *MockService_Expecter) GlobalRegistryList(_a0 interface{}) *MockService_GlobalRegistryList_Call {
return &MockService_GlobalRegistryList_Call{Call: _e.mock.On("GlobalRegistryList", _a0)}
}
func (_c *MockService_GlobalRegistryList_Call) Run(run func(_a0 *model.ListOptions)) *MockService_GlobalRegistryList_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.ListOptions))
})
return _c
}
func (_c *MockService_GlobalRegistryList_Call) Return(_a0 []*model.Registry, _a1 error) *MockService_GlobalRegistryList_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockService_GlobalRegistryList_Call) RunAndReturn(run func(*model.ListOptions) ([]*model.Registry, error)) *MockService_GlobalRegistryList_Call {
_c.Call.Return(run)
return _c
}
// GlobalRegistryUpdate provides a mock function with given fields: _a0
func (_m *MockService) GlobalRegistryUpdate(_a0 *model.Registry) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalRegistryUpdate")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Registry) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockService_GlobalRegistryUpdate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GlobalRegistryUpdate'
type MockService_GlobalRegistryUpdate_Call struct {
*mock.Call
}
// GlobalRegistryUpdate is a helper method to define mock.On call
// - _a0 *model.Registry
func (_e *MockService_Expecter) GlobalRegistryUpdate(_a0 interface{}) *MockService_GlobalRegistryUpdate_Call {
return &MockService_GlobalRegistryUpdate_Call{Call: _e.mock.On("GlobalRegistryUpdate", _a0)}
}
func (_c *MockService_GlobalRegistryUpdate_Call) Run(run func(_a0 *model.Registry)) *MockService_GlobalRegistryUpdate_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Registry))
})
return _c
}
func (_c *MockService_GlobalRegistryUpdate_Call) Return(_a0 error) *MockService_GlobalRegistryUpdate_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockService_GlobalRegistryUpdate_Call) RunAndReturn(run func(*model.Registry) error) *MockService_GlobalRegistryUpdate_Call {
_c.Call.Return(run)
return _c
}
// OrgRegistryCreate provides a mock function with given fields: _a0, _a1
func (_m *MockService) OrgRegistryCreate(_a0 int64, _a1 *model.Registry) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgRegistryCreate")
}
var r0 error
if rf, ok := ret.Get(0).(func(int64, *model.Registry) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockService_OrgRegistryCreate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OrgRegistryCreate'
type MockService_OrgRegistryCreate_Call struct {
*mock.Call
}
// OrgRegistryCreate is a helper method to define mock.On call
// - _a0 int64
// - _a1 *model.Registry
func (_e *MockService_Expecter) OrgRegistryCreate(_a0 interface{}, _a1 interface{}) *MockService_OrgRegistryCreate_Call {
return &MockService_OrgRegistryCreate_Call{Call: _e.mock.On("OrgRegistryCreate", _a0, _a1)}
}
func (_c *MockService_OrgRegistryCreate_Call) Run(run func(_a0 int64, _a1 *model.Registry)) *MockService_OrgRegistryCreate_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(int64), args[1].(*model.Registry))
})
return _c
}
func (_c *MockService_OrgRegistryCreate_Call) Return(_a0 error) *MockService_OrgRegistryCreate_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockService_OrgRegistryCreate_Call) RunAndReturn(run func(int64, *model.Registry) error) *MockService_OrgRegistryCreate_Call {
_c.Call.Return(run)
return _c
}
// OrgRegistryDelete provides a mock function with given fields: _a0, _a1
func (_m *MockService) OrgRegistryDelete(_a0 int64, _a1 string) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgRegistryDelete")
}
var r0 error
if rf, ok := ret.Get(0).(func(int64, string) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockService_OrgRegistryDelete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OrgRegistryDelete'
type MockService_OrgRegistryDelete_Call struct {
*mock.Call
}
// OrgRegistryDelete is a helper method to define mock.On call
// - _a0 int64
// - _a1 string
func (_e *MockService_Expecter) OrgRegistryDelete(_a0 interface{}, _a1 interface{}) *MockService_OrgRegistryDelete_Call {
return &MockService_OrgRegistryDelete_Call{Call: _e.mock.On("OrgRegistryDelete", _a0, _a1)}
}
func (_c *MockService_OrgRegistryDelete_Call) Run(run func(_a0 int64, _a1 string)) *MockService_OrgRegistryDelete_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(int64), args[1].(string))
})
return _c
}
func (_c *MockService_OrgRegistryDelete_Call) Return(_a0 error) *MockService_OrgRegistryDelete_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockService_OrgRegistryDelete_Call) RunAndReturn(run func(int64, string) error) *MockService_OrgRegistryDelete_Call {
_c.Call.Return(run)
return _c
}
// OrgRegistryFind provides a mock function with given fields: _a0, _a1
func (_m *MockService) OrgRegistryFind(_a0 int64, _a1 string) (*model.Registry, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgRegistryFind")
}
var r0 *model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(int64, string) (*model.Registry, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(int64, string) *model.Registry); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Registry)
}
}
if rf, ok := ret.Get(1).(func(int64, string) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockService_OrgRegistryFind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OrgRegistryFind'
type MockService_OrgRegistryFind_Call struct {
*mock.Call
}
// OrgRegistryFind is a helper method to define mock.On call
// - _a0 int64
// - _a1 string
func (_e *MockService_Expecter) OrgRegistryFind(_a0 interface{}, _a1 interface{}) *MockService_OrgRegistryFind_Call {
return &MockService_OrgRegistryFind_Call{Call: _e.mock.On("OrgRegistryFind", _a0, _a1)}
}
func (_c *MockService_OrgRegistryFind_Call) Run(run func(_a0 int64, _a1 string)) *MockService_OrgRegistryFind_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(int64), args[1].(string))
})
return _c
}
func (_c *MockService_OrgRegistryFind_Call) Return(_a0 *model.Registry, _a1 error) *MockService_OrgRegistryFind_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockService_OrgRegistryFind_Call) RunAndReturn(run func(int64, string) (*model.Registry, error)) *MockService_OrgRegistryFind_Call {
_c.Call.Return(run)
return _c
}
// OrgRegistryList provides a mock function with given fields: _a0, _a1
func (_m *MockService) OrgRegistryList(_a0 int64, _a1 *model.ListOptions) ([]*model.Registry, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgRegistryList")
}
var r0 []*model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(int64, *model.ListOptions) ([]*model.Registry, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(int64, *model.ListOptions) []*model.Registry); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Registry)
}
}
if rf, ok := ret.Get(1).(func(int64, *model.ListOptions) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockService_OrgRegistryList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OrgRegistryList'
type MockService_OrgRegistryList_Call struct {
*mock.Call
}
// OrgRegistryList is a helper method to define mock.On call
// - _a0 int64
// - _a1 *model.ListOptions
func (_e *MockService_Expecter) OrgRegistryList(_a0 interface{}, _a1 interface{}) *MockService_OrgRegistryList_Call {
return &MockService_OrgRegistryList_Call{Call: _e.mock.On("OrgRegistryList", _a0, _a1)}
}
func (_c *MockService_OrgRegistryList_Call) Run(run func(_a0 int64, _a1 *model.ListOptions)) *MockService_OrgRegistryList_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(int64), args[1].(*model.ListOptions))
})
return _c
}
func (_c *MockService_OrgRegistryList_Call) Return(_a0 []*model.Registry, _a1 error) *MockService_OrgRegistryList_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockService_OrgRegistryList_Call) RunAndReturn(run func(int64, *model.ListOptions) ([]*model.Registry, error)) *MockService_OrgRegistryList_Call {
_c.Call.Return(run)
return _c
}
// OrgRegistryUpdate provides a mock function with given fields: _a0, _a1
func (_m *MockService) OrgRegistryUpdate(_a0 int64, _a1 *model.Registry) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgRegistryUpdate")
}
var r0 error
if rf, ok := ret.Get(0).(func(int64, *model.Registry) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockService_OrgRegistryUpdate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OrgRegistryUpdate'
type MockService_OrgRegistryUpdate_Call struct {
*mock.Call
}
// OrgRegistryUpdate is a helper method to define mock.On call
// - _a0 int64
// - _a1 *model.Registry
func (_e *MockService_Expecter) OrgRegistryUpdate(_a0 interface{}, _a1 interface{}) *MockService_OrgRegistryUpdate_Call {
return &MockService_OrgRegistryUpdate_Call{Call: _e.mock.On("OrgRegistryUpdate", _a0, _a1)}
}
func (_c *MockService_OrgRegistryUpdate_Call) Run(run func(_a0 int64, _a1 *model.Registry)) *MockService_OrgRegistryUpdate_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(int64), args[1].(*model.Registry))
})
return _c
}
func (_c *MockService_OrgRegistryUpdate_Call) Return(_a0 error) *MockService_OrgRegistryUpdate_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockService_OrgRegistryUpdate_Call) RunAndReturn(run func(int64, *model.Registry) error) *MockService_OrgRegistryUpdate_Call {
_c.Call.Return(run)
return _c
}
// RegistryCreate provides a mock function with given fields: _a0, _a1
func (_m *MockService) RegistryCreate(_a0 *model.Repo, _a1 *model.Registry) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for RegistryCreate")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Repo, *model.Registry) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockService_RegistryCreate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegistryCreate'
type MockService_RegistryCreate_Call struct {
*mock.Call
}
// RegistryCreate is a helper method to define mock.On call
// - _a0 *model.Repo
// - _a1 *model.Registry
func (_e *MockService_Expecter) RegistryCreate(_a0 interface{}, _a1 interface{}) *MockService_RegistryCreate_Call {
return &MockService_RegistryCreate_Call{Call: _e.mock.On("RegistryCreate", _a0, _a1)}
}
func (_c *MockService_RegistryCreate_Call) Run(run func(_a0 *model.Repo, _a1 *model.Registry)) *MockService_RegistryCreate_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Repo), args[1].(*model.Registry))
})
return _c
}
func (_c *MockService_RegistryCreate_Call) Return(_a0 error) *MockService_RegistryCreate_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockService_RegistryCreate_Call) RunAndReturn(run func(*model.Repo, *model.Registry) error) *MockService_RegistryCreate_Call {
_c.Call.Return(run)
return _c
}
// RegistryDelete provides a mock function with given fields: _a0, _a1
func (_m *MockService) RegistryDelete(_a0 *model.Repo, _a1 string) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for RegistryDelete")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Repo, string) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockService_RegistryDelete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegistryDelete'
type MockService_RegistryDelete_Call struct {
*mock.Call
}
// RegistryDelete is a helper method to define mock.On call
// - _a0 *model.Repo
// - _a1 string
func (_e *MockService_Expecter) RegistryDelete(_a0 interface{}, _a1 interface{}) *MockService_RegistryDelete_Call {
return &MockService_RegistryDelete_Call{Call: _e.mock.On("RegistryDelete", _a0, _a1)}
}
func (_c *MockService_RegistryDelete_Call) Run(run func(_a0 *model.Repo, _a1 string)) *MockService_RegistryDelete_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Repo), args[1].(string))
})
return _c
}
func (_c *MockService_RegistryDelete_Call) Return(_a0 error) *MockService_RegistryDelete_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockService_RegistryDelete_Call) RunAndReturn(run func(*model.Repo, string) error) *MockService_RegistryDelete_Call {
_c.Call.Return(run)
return _c
}
// RegistryFind provides a mock function with given fields: _a0, _a1
func (_m *MockService) RegistryFind(_a0 *model.Repo, _a1 string) (*model.Registry, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for RegistryFind")
}
var r0 *model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, string) (*model.Registry, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, string) *model.Registry); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Registry)
}
}
if rf, ok := ret.Get(1).(func(*model.Repo, string) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockService_RegistryFind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegistryFind'
type MockService_RegistryFind_Call struct {
*mock.Call
}
// RegistryFind is a helper method to define mock.On call
// - _a0 *model.Repo
// - _a1 string
func (_e *MockService_Expecter) RegistryFind(_a0 interface{}, _a1 interface{}) *MockService_RegistryFind_Call {
return &MockService_RegistryFind_Call{Call: _e.mock.On("RegistryFind", _a0, _a1)}
}
func (_c *MockService_RegistryFind_Call) Run(run func(_a0 *model.Repo, _a1 string)) *MockService_RegistryFind_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Repo), args[1].(string))
})
return _c
}
func (_c *MockService_RegistryFind_Call) Return(_a0 *model.Registry, _a1 error) *MockService_RegistryFind_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockService_RegistryFind_Call) RunAndReturn(run func(*model.Repo, string) (*model.Registry, error)) *MockService_RegistryFind_Call {
_c.Call.Return(run)
return _c
}
// RegistryList provides a mock function with given fields: _a0, _a1
func (_m *MockService) RegistryList(_a0 *model.Repo, _a1 *model.ListOptions) ([]*model.Registry, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for RegistryList")
}
var r0 []*model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, *model.ListOptions) ([]*model.Registry, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, *model.ListOptions) []*model.Registry); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Registry)
}
}
if rf, ok := ret.Get(1).(func(*model.Repo, *model.ListOptions) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockService_RegistryList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegistryList'
type MockService_RegistryList_Call struct {
*mock.Call
}
// RegistryList is a helper method to define mock.On call
// - _a0 *model.Repo
// - _a1 *model.ListOptions
func (_e *MockService_Expecter) RegistryList(_a0 interface{}, _a1 interface{}) *MockService_RegistryList_Call {
return &MockService_RegistryList_Call{Call: _e.mock.On("RegistryList", _a0, _a1)}
}
func (_c *MockService_RegistryList_Call) Run(run func(_a0 *model.Repo, _a1 *model.ListOptions)) *MockService_RegistryList_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Repo), args[1].(*model.ListOptions))
})
return _c
}
func (_c *MockService_RegistryList_Call) Return(_a0 []*model.Registry, _a1 error) *MockService_RegistryList_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockService_RegistryList_Call) RunAndReturn(run func(*model.Repo, *model.ListOptions) ([]*model.Registry, error)) *MockService_RegistryList_Call {
_c.Call.Return(run)
return _c
}
// RegistryListPipeline provides a mock function with given fields: _a0, _a1
func (_m *MockService) RegistryListPipeline(_a0 *model.Repo, _a1 *model.Pipeline) ([]*model.Registry, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for RegistryListPipeline")
}
var r0 []*model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, *model.Pipeline) ([]*model.Registry, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, *model.Pipeline) []*model.Registry); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Registry)
}
}
if rf, ok := ret.Get(1).(func(*model.Repo, *model.Pipeline) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockService_RegistryListPipeline_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegistryListPipeline'
type MockService_RegistryListPipeline_Call struct {
*mock.Call
}
// RegistryListPipeline is a helper method to define mock.On call
// - _a0 *model.Repo
// - _a1 *model.Pipeline
func (_e *MockService_Expecter) RegistryListPipeline(_a0 interface{}, _a1 interface{}) *MockService_RegistryListPipeline_Call {
return &MockService_RegistryListPipeline_Call{Call: _e.mock.On("RegistryListPipeline", _a0, _a1)}
}
func (_c *MockService_RegistryListPipeline_Call) Run(run func(_a0 *model.Repo, _a1 *model.Pipeline)) *MockService_RegistryListPipeline_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Repo), args[1].(*model.Pipeline))
})
return _c
}
func (_c *MockService_RegistryListPipeline_Call) Return(_a0 []*model.Registry, _a1 error) *MockService_RegistryListPipeline_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockService_RegistryListPipeline_Call) RunAndReturn(run func(*model.Repo, *model.Pipeline) ([]*model.Registry, error)) *MockService_RegistryListPipeline_Call {
_c.Call.Return(run)
return _c
}
// RegistryUpdate provides a mock function with given fields: _a0, _a1
func (_m *MockService) RegistryUpdate(_a0 *model.Repo, _a1 *model.Registry) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for RegistryUpdate")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Repo, *model.Registry) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockService_RegistryUpdate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegistryUpdate'
type MockService_RegistryUpdate_Call struct {
*mock.Call
}
// RegistryUpdate is a helper method to define mock.On call
// - _a0 *model.Repo
// - _a1 *model.Registry
func (_e *MockService_Expecter) RegistryUpdate(_a0 interface{}, _a1 interface{}) *MockService_RegistryUpdate_Call {
return &MockService_RegistryUpdate_Call{Call: _e.mock.On("RegistryUpdate", _a0, _a1)}
}
func (_c *MockService_RegistryUpdate_Call) Run(run func(_a0 *model.Repo, _a1 *model.Registry)) *MockService_RegistryUpdate_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(*model.Repo), args[1].(*model.Registry))
})
return _c
}
func (_c *MockService_RegistryUpdate_Call) Return(_a0 error) *MockService_RegistryUpdate_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockService_RegistryUpdate_Call) RunAndReturn(run func(*model.Repo, *model.Registry) error) *MockService_RegistryUpdate_Call {
_c.Call.Return(run)
return _c
}
// NewMockService creates a new instance of MockService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockService(t interface {
mock.TestingT
Cleanup(func())
}) *MockService {
mock := &MockService{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -1,399 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mocks
import (
model "codeberg.org/crowci/crow/v3/server/model"
mock "github.com/stretchr/testify/mock"
)
// Service is an autogenerated mock type for the Service type
type Service struct {
mock.Mock
}
// GlobalRegistryCreate provides a mock function with given fields: _a0
func (_m *Service) GlobalRegistryCreate(_a0 *model.Registry) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalRegistryCreate")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Registry) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// GlobalRegistryDelete provides a mock function with given fields: _a0
func (_m *Service) GlobalRegistryDelete(_a0 string) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalRegistryDelete")
}
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// GlobalRegistryFind provides a mock function with given fields: _a0
func (_m *Service) GlobalRegistryFind(_a0 string) (*model.Registry, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalRegistryFind")
}
var r0 *model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.Registry, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(string) *model.Registry); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Registry)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GlobalRegistryList provides a mock function with given fields: _a0
func (_m *Service) GlobalRegistryList(_a0 *model.ListOptions) ([]*model.Registry, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalRegistryList")
}
var r0 []*model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(*model.ListOptions) ([]*model.Registry, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(*model.ListOptions) []*model.Registry); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Registry)
}
}
if rf, ok := ret.Get(1).(func(*model.ListOptions) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GlobalRegistryUpdate provides a mock function with given fields: _a0
func (_m *Service) GlobalRegistryUpdate(_a0 *model.Registry) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for GlobalRegistryUpdate")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Registry) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// OrgRegistryCreate provides a mock function with given fields: _a0, _a1
func (_m *Service) OrgRegistryCreate(_a0 int64, _a1 *model.Registry) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgRegistryCreate")
}
var r0 error
if rf, ok := ret.Get(0).(func(int64, *model.Registry) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// OrgRegistryDelete provides a mock function with given fields: _a0, _a1
func (_m *Service) OrgRegistryDelete(_a0 int64, _a1 string) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgRegistryDelete")
}
var r0 error
if rf, ok := ret.Get(0).(func(int64, string) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// OrgRegistryFind provides a mock function with given fields: _a0, _a1
func (_m *Service) OrgRegistryFind(_a0 int64, _a1 string) (*model.Registry, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgRegistryFind")
}
var r0 *model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(int64, string) (*model.Registry, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(int64, string) *model.Registry); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Registry)
}
}
if rf, ok := ret.Get(1).(func(int64, string) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// OrgRegistryList provides a mock function with given fields: _a0, _a1
func (_m *Service) OrgRegistryList(_a0 int64, _a1 *model.ListOptions) ([]*model.Registry, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgRegistryList")
}
var r0 []*model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(int64, *model.ListOptions) ([]*model.Registry, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(int64, *model.ListOptions) []*model.Registry); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Registry)
}
}
if rf, ok := ret.Get(1).(func(int64, *model.ListOptions) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// OrgRegistryUpdate provides a mock function with given fields: _a0, _a1
func (_m *Service) OrgRegistryUpdate(_a0 int64, _a1 *model.Registry) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for OrgRegistryUpdate")
}
var r0 error
if rf, ok := ret.Get(0).(func(int64, *model.Registry) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// RegistryCreate provides a mock function with given fields: _a0, _a1
func (_m *Service) RegistryCreate(_a0 *model.Repo, _a1 *model.Registry) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for RegistryCreate")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Repo, *model.Registry) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// RegistryDelete provides a mock function with given fields: _a0, _a1
func (_m *Service) RegistryDelete(_a0 *model.Repo, _a1 string) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for RegistryDelete")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Repo, string) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// RegistryFind provides a mock function with given fields: _a0, _a1
func (_m *Service) RegistryFind(_a0 *model.Repo, _a1 string) (*model.Registry, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for RegistryFind")
}
var r0 *model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, string) (*model.Registry, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, string) *model.Registry); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Registry)
}
}
if rf, ok := ret.Get(1).(func(*model.Repo, string) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// RegistryList provides a mock function with given fields: _a0, _a1
func (_m *Service) RegistryList(_a0 *model.Repo, _a1 *model.ListOptions) ([]*model.Registry, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for RegistryList")
}
var r0 []*model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, *model.ListOptions) ([]*model.Registry, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, *model.ListOptions) []*model.Registry); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Registry)
}
}
if rf, ok := ret.Get(1).(func(*model.Repo, *model.ListOptions) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// RegistryListPipeline provides a mock function with given fields: _a0, _a1
func (_m *Service) RegistryListPipeline(_a0 *model.Repo, _a1 *model.Pipeline) ([]*model.Registry, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for RegistryListPipeline")
}
var r0 []*model.Registry
var r1 error
if rf, ok := ret.Get(0).(func(*model.Repo, *model.Pipeline) ([]*model.Registry, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(*model.Repo, *model.Pipeline) []*model.Registry); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Registry)
}
}
if rf, ok := ret.Get(1).(func(*model.Repo, *model.Pipeline) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// RegistryUpdate provides a mock function with given fields: _a0, _a1
func (_m *Service) RegistryUpdate(_a0 *model.Repo, _a1 *model.Registry) error {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for RegistryUpdate")
}
var r0 error
if rf, ok := ret.Get(0).(func(*model.Repo, *model.Registry) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// NewService creates a new instance of Service. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewService(t interface {
mock.TestingT
Cleanup(func())
}) *Service {
mock := &Service{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -22,7 +22,7 @@ import (
"codeberg.org/crowci/crow/v3/server/model"
"codeberg.org/crowci/crow/v3/server/services/secret"
mocks_store "codeberg.org/crowci/crow/v3/server/store/mocks"
store_mocks "codeberg.org/crowci/crow/v3/server/store/mocks"
)
var (
@ -52,7 +52,7 @@ var (
)
func TestSecretListPipeline(t *testing.T) {
mockStore := mocks_store.NewStore(t)
mockStore := new(store_mocks.MockStore)
mockStore.On("SecretList", mock.Anything, mock.Anything, mock.Anything).Once().Return([]*model.Secret{
globalSecret,

Some files were not shown because too many files have changed in this diff Show More