diff --git a/internal/runner/mock_actionHandler.go b/internal/runner/mock_actionHandler.go new file mode 100644 index 00000000..293b1a26 --- /dev/null +++ b/internal/runner/mock_actionHandler.go @@ -0,0 +1,96 @@ +// Code generated by mockery v2.42.1. DO NOT EDIT. + +package runner + +import ( + context "context" + + model "github.com/metal-toolbox/flasher/internal/model" + mock "github.com/stretchr/testify/mock" +) + +// MockActionHandler is an autogenerated mock type for the ActionHandler type +type MockActionHandler struct { + mock.Mock +} + +type MockActionHandler_Expecter struct { + mock *mock.Mock +} + +func (_m *MockActionHandler) EXPECT() *MockActionHandler_Expecter { + return &MockActionHandler_Expecter{mock: &_m.Mock} +} + +// ComposeAction provides a mock function with given fields: ctx, actionCtx +func (_m *MockActionHandler) ComposeAction(ctx context.Context, actionCtx *ActionHandlerContext) (*model.Action, error) { + ret := _m.Called(ctx, actionCtx) + + if len(ret) == 0 { + panic("no return value specified for ComposeAction") + } + + var r0 *model.Action + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *ActionHandlerContext) (*model.Action, error)); ok { + return rf(ctx, actionCtx) + } + if rf, ok := ret.Get(0).(func(context.Context, *ActionHandlerContext) *model.Action); ok { + r0 = rf(ctx, actionCtx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*model.Action) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *ActionHandlerContext) error); ok { + r1 = rf(ctx, actionCtx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockActionHandler_ComposeAction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ComposeAction' +type MockActionHandler_ComposeAction_Call struct { + *mock.Call +} + +// ComposeAction is a helper method to define mock.On call +// - ctx context.Context +// - actionCtx *ActionHandlerContext +func (_e *MockActionHandler_Expecter) ComposeAction(ctx interface{}, actionCtx interface{}) *MockActionHandler_ComposeAction_Call { + return &MockActionHandler_ComposeAction_Call{Call: _e.mock.On("ComposeAction", ctx, actionCtx)} +} + +func (_c *MockActionHandler_ComposeAction_Call) Run(run func(ctx context.Context, actionCtx *ActionHandlerContext)) *MockActionHandler_ComposeAction_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*ActionHandlerContext)) + }) + return _c +} + +func (_c *MockActionHandler_ComposeAction_Call) Return(_a0 *model.Action, _a1 error) *MockActionHandler_ComposeAction_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockActionHandler_ComposeAction_Call) RunAndReturn(run func(context.Context, *ActionHandlerContext) (*model.Action, error)) *MockActionHandler_ComposeAction_Call { + _c.Call.Return(run) + return _c +} + +// NewMockActionHandler creates a new instance of MockActionHandler. 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 NewMockActionHandler(t interface { + mock.TestingT + Cleanup(func()) +}) *MockActionHandler { + mock := &MockActionHandler{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/internal/runner/mock_taskHandler.go b/internal/runner/mock_taskHandler.go new file mode 100644 index 00000000..8ff7cea7 --- /dev/null +++ b/internal/runner/mock_taskHandler.go @@ -0,0 +1,276 @@ +// Code generated by mockery v2.42.1. DO NOT EDIT. + +package runner + +import ( + context "context" + + model "github.com/metal-toolbox/flasher/internal/model" + mock "github.com/stretchr/testify/mock" +) + +// MockTaskHandler is an autogenerated mock type for the TaskHandler type +type MockTaskHandler struct { + mock.Mock +} + +type MockTaskHandler_Expecter struct { + mock *mock.Mock +} + +func (_m *MockTaskHandler) EXPECT() *MockTaskHandler_Expecter { + return &MockTaskHandler_Expecter{mock: &_m.Mock} +} + +// Initialize provides a mock function with given fields: ctx +func (_m *MockTaskHandler) Initialize(ctx context.Context) error { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for Initialize") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context) error); ok { + r0 = rf(ctx) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockTaskHandler_Initialize_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Initialize' +type MockTaskHandler_Initialize_Call struct { + *mock.Call +} + +// Initialize is a helper method to define mock.On call +// - ctx context.Context +func (_e *MockTaskHandler_Expecter) Initialize(ctx interface{}) *MockTaskHandler_Initialize_Call { + return &MockTaskHandler_Initialize_Call{Call: _e.mock.On("Initialize", ctx)} +} + +func (_c *MockTaskHandler_Initialize_Call) Run(run func(ctx context.Context)) *MockTaskHandler_Initialize_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *MockTaskHandler_Initialize_Call) Return(_a0 error) *MockTaskHandler_Initialize_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockTaskHandler_Initialize_Call) RunAndReturn(run func(context.Context) error) *MockTaskHandler_Initialize_Call { + _c.Call.Return(run) + return _c +} + +// OnFailure provides a mock function with given fields: ctx, task +func (_m *MockTaskHandler) OnFailure(ctx context.Context, task *model.Task) { + _m.Called(ctx, task) +} + +// MockTaskHandler_OnFailure_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OnFailure' +type MockTaskHandler_OnFailure_Call struct { + *mock.Call +} + +// OnFailure is a helper method to define mock.On call +// - ctx context.Context +// - task *model.Task +func (_e *MockTaskHandler_Expecter) OnFailure(ctx interface{}, task interface{}) *MockTaskHandler_OnFailure_Call { + return &MockTaskHandler_OnFailure_Call{Call: _e.mock.On("OnFailure", ctx, task)} +} + +func (_c *MockTaskHandler_OnFailure_Call) Run(run func(ctx context.Context, task *model.Task)) *MockTaskHandler_OnFailure_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*model.Task)) + }) + return _c +} + +func (_c *MockTaskHandler_OnFailure_Call) Return() *MockTaskHandler_OnFailure_Call { + _c.Call.Return() + return _c +} + +func (_c *MockTaskHandler_OnFailure_Call) RunAndReturn(run func(context.Context, *model.Task)) *MockTaskHandler_OnFailure_Call { + _c.Call.Return(run) + return _c +} + +// OnSuccess provides a mock function with given fields: ctx, task +func (_m *MockTaskHandler) OnSuccess(ctx context.Context, task *model.Task) { + _m.Called(ctx, task) +} + +// MockTaskHandler_OnSuccess_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OnSuccess' +type MockTaskHandler_OnSuccess_Call struct { + *mock.Call +} + +// OnSuccess is a helper method to define mock.On call +// - ctx context.Context +// - task *model.Task +func (_e *MockTaskHandler_Expecter) OnSuccess(ctx interface{}, task interface{}) *MockTaskHandler_OnSuccess_Call { + return &MockTaskHandler_OnSuccess_Call{Call: _e.mock.On("OnSuccess", ctx, task)} +} + +func (_c *MockTaskHandler_OnSuccess_Call) Run(run func(ctx context.Context, task *model.Task)) *MockTaskHandler_OnSuccess_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*model.Task)) + }) + return _c +} + +func (_c *MockTaskHandler_OnSuccess_Call) Return() *MockTaskHandler_OnSuccess_Call { + _c.Call.Return() + return _c +} + +func (_c *MockTaskHandler_OnSuccess_Call) RunAndReturn(run func(context.Context, *model.Task)) *MockTaskHandler_OnSuccess_Call { + _c.Call.Return(run) + return _c +} + +// PlanActions provides a mock function with given fields: ctx +func (_m *MockTaskHandler) PlanActions(ctx context.Context) error { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for PlanActions") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context) error); ok { + r0 = rf(ctx) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockTaskHandler_PlanActions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PlanActions' +type MockTaskHandler_PlanActions_Call struct { + *mock.Call +} + +// PlanActions is a helper method to define mock.On call +// - ctx context.Context +func (_e *MockTaskHandler_Expecter) PlanActions(ctx interface{}) *MockTaskHandler_PlanActions_Call { + return &MockTaskHandler_PlanActions_Call{Call: _e.mock.On("PlanActions", ctx)} +} + +func (_c *MockTaskHandler_PlanActions_Call) Run(run func(ctx context.Context)) *MockTaskHandler_PlanActions_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *MockTaskHandler_PlanActions_Call) Return(_a0 error) *MockTaskHandler_PlanActions_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockTaskHandler_PlanActions_Call) RunAndReturn(run func(context.Context) error) *MockTaskHandler_PlanActions_Call { + _c.Call.Return(run) + return _c +} + +// Publish provides a mock function with given fields: ctx +func (_m *MockTaskHandler) Publish(ctx context.Context) { + _m.Called(ctx) +} + +// MockTaskHandler_Publish_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Publish' +type MockTaskHandler_Publish_Call struct { + *mock.Call +} + +// Publish is a helper method to define mock.On call +// - ctx context.Context +func (_e *MockTaskHandler_Expecter) Publish(ctx interface{}) *MockTaskHandler_Publish_Call { + return &MockTaskHandler_Publish_Call{Call: _e.mock.On("Publish", ctx)} +} + +func (_c *MockTaskHandler_Publish_Call) Run(run func(ctx context.Context)) *MockTaskHandler_Publish_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *MockTaskHandler_Publish_Call) Return() *MockTaskHandler_Publish_Call { + _c.Call.Return() + return _c +} + +func (_c *MockTaskHandler_Publish_Call) RunAndReturn(run func(context.Context)) *MockTaskHandler_Publish_Call { + _c.Call.Return(run) + return _c +} + +// Query provides a mock function with given fields: ctx +func (_m *MockTaskHandler) Query(ctx context.Context) error { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for Query") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context) error); ok { + r0 = rf(ctx) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockTaskHandler_Query_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Query' +type MockTaskHandler_Query_Call struct { + *mock.Call +} + +// Query is a helper method to define mock.On call +// - ctx context.Context +func (_e *MockTaskHandler_Expecter) Query(ctx interface{}) *MockTaskHandler_Query_Call { + return &MockTaskHandler_Query_Call{Call: _e.mock.On("Query", ctx)} +} + +func (_c *MockTaskHandler_Query_Call) Run(run func(ctx context.Context)) *MockTaskHandler_Query_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *MockTaskHandler_Query_Call) Return(_a0 error) *MockTaskHandler_Query_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockTaskHandler_Query_Call) RunAndReturn(run func(context.Context) error) *MockTaskHandler_Query_Call { + _c.Call.Return(run) + return _c +} + +// NewMockTaskHandler creates a new instance of MockTaskHandler. 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 NewMockTaskHandler(t interface { + mock.TestingT + Cleanup(func()) +}) *MockTaskHandler { + mock := &MockTaskHandler{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +}