* adding some logs to better understand what might be happening * only focus this PR on improve logging in finalizer handling * debug log before calling finalizers * working on finalizers * removing last todos, adding unit tests * better use SupportedFinalizers name * addressing comments * wip: fix tests and add delete error in status * chore: codegen * chore: codegen openapi * Merge remote-tracking branch 'origin/main' into provisioning-finalisers-fix-2 * update frontend client * fix: errors in testing * fix: breaking test --------- Co-authored-by: Daniele Ferru <daniele.ferru@grafana.com> Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
193 lines
5.1 KiB
Go
193 lines
5.1 KiB
Go
// Code generated by mockery v2.53.4. DO NOT EDIT.
|
|
|
|
package repository
|
|
|
|
import (
|
|
context "context"
|
|
|
|
mock "github.com/stretchr/testify/mock"
|
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
|
|
|
v0alpha1 "github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1"
|
|
)
|
|
|
|
// MockFactory is an autogenerated mock type for the Factory type
|
|
type MockFactory struct {
|
|
mock.Mock
|
|
}
|
|
|
|
type MockFactory_Expecter struct {
|
|
mock *mock.Mock
|
|
}
|
|
|
|
func (_m *MockFactory) EXPECT() *MockFactory_Expecter {
|
|
return &MockFactory_Expecter{mock: &_m.Mock}
|
|
}
|
|
|
|
// Build provides a mock function with given fields: ctx, r
|
|
func (_m *MockFactory) Build(ctx context.Context, r *v0alpha1.Repository) (Repository, error) {
|
|
ret := _m.Called(ctx, r)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Build")
|
|
}
|
|
|
|
var r0 Repository
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *v0alpha1.Repository) (Repository, error)); ok {
|
|
return rf(ctx, r)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *v0alpha1.Repository) Repository); ok {
|
|
r0 = rf(ctx, r)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(Repository)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *v0alpha1.Repository) error); ok {
|
|
r1 = rf(ctx, r)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// MockFactory_Build_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Build'
|
|
type MockFactory_Build_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Build is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - r *v0alpha1.Repository
|
|
func (_e *MockFactory_Expecter) Build(ctx interface{}, r interface{}) *MockFactory_Build_Call {
|
|
return &MockFactory_Build_Call{Call: _e.mock.On("Build", ctx, r)}
|
|
}
|
|
|
|
func (_c *MockFactory_Build_Call) Run(run func(ctx context.Context, r *v0alpha1.Repository)) *MockFactory_Build_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(*v0alpha1.Repository))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockFactory_Build_Call) Return(_a0 Repository, _a1 error) *MockFactory_Build_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockFactory_Build_Call) RunAndReturn(run func(context.Context, *v0alpha1.Repository) (Repository, error)) *MockFactory_Build_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Mutate provides a mock function with given fields: ctx, obj
|
|
func (_m *MockFactory) Mutate(ctx context.Context, obj runtime.Object) error {
|
|
ret := _m.Called(ctx, obj)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Mutate")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, runtime.Object) error); ok {
|
|
r0 = rf(ctx, obj)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// MockFactory_Mutate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Mutate'
|
|
type MockFactory_Mutate_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Mutate is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - obj runtime.Object
|
|
func (_e *MockFactory_Expecter) Mutate(ctx interface{}, obj interface{}) *MockFactory_Mutate_Call {
|
|
return &MockFactory_Mutate_Call{Call: _e.mock.On("Mutate", ctx, obj)}
|
|
}
|
|
|
|
func (_c *MockFactory_Mutate_Call) Run(run func(ctx context.Context, obj runtime.Object)) *MockFactory_Mutate_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(runtime.Object))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockFactory_Mutate_Call) Return(_a0 error) *MockFactory_Mutate_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockFactory_Mutate_Call) RunAndReturn(run func(context.Context, runtime.Object) error) *MockFactory_Mutate_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Types provides a mock function with no fields
|
|
func (_m *MockFactory) Types() []v0alpha1.RepositoryType {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Types")
|
|
}
|
|
|
|
var r0 []v0alpha1.RepositoryType
|
|
if rf, ok := ret.Get(0).(func() []v0alpha1.RepositoryType); ok {
|
|
r0 = rf()
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]v0alpha1.RepositoryType)
|
|
}
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// MockFactory_Types_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Types'
|
|
type MockFactory_Types_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Types is a helper method to define mock.On call
|
|
func (_e *MockFactory_Expecter) Types() *MockFactory_Types_Call {
|
|
return &MockFactory_Types_Call{Call: _e.mock.On("Types")}
|
|
}
|
|
|
|
func (_c *MockFactory_Types_Call) Run(run func()) *MockFactory_Types_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run()
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockFactory_Types_Call) Return(_a0 []v0alpha1.RepositoryType) *MockFactory_Types_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockFactory_Types_Call) RunAndReturn(run func() []v0alpha1.RepositoryType) *MockFactory_Types_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// NewMockFactory creates a new instance of MockFactory. 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 NewMockFactory(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *MockFactory {
|
|
mock := &MockFactory{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|