diff --git a/flyteadmin/pkg/workflowengine/interfaces/executor.go b/flyteadmin/pkg/workflowengine/interfaces/executor.go index 181986c2c3..24c8ec74fe 100644 --- a/flyteadmin/pkg/workflowengine/interfaces/executor.go +++ b/flyteadmin/pkg/workflowengine/interfaces/executor.go @@ -10,7 +10,7 @@ import ( "github.com/flyteorg/flyte/flytestdlib/storage" ) -//go:generate mockery -name=WorkflowExecutor -output=../mocks/ -case=underscore +//go:generate mockery-v2 --name=WorkflowExecutor --output=../mocks/ --case=underscore type TaskResources struct { Defaults runtime.TaskResourceSet diff --git a/flyteadmin/pkg/workflowengine/mocks/workflow_executor.go b/flyteadmin/pkg/workflowengine/mocks/workflow_executor.go index db0cece8f0..672b0d0af9 100644 --- a/flyteadmin/pkg/workflowengine/mocks/workflow_executor.go +++ b/flyteadmin/pkg/workflowengine/mocks/workflow_executor.go @@ -1,4 +1,4 @@ -// Code generated by mockery v1.0.1. DO NOT EDIT. +// Code generated by mockery v2.40.3. DO NOT EDIT. package mocks @@ -14,28 +14,14 @@ type WorkflowExecutor struct { mock.Mock } -type WorkflowExecutor_Abort struct { - *mock.Call -} - -func (_m WorkflowExecutor_Abort) Return(_a0 error) *WorkflowExecutor_Abort { - return &WorkflowExecutor_Abort{Call: _m.Call.Return(_a0)} -} - -func (_m *WorkflowExecutor) OnAbort(ctx context.Context, data interfaces.AbortData) *WorkflowExecutor_Abort { - c_call := _m.On("Abort", ctx, data) - return &WorkflowExecutor_Abort{Call: c_call} -} - -func (_m *WorkflowExecutor) OnAbortMatch(matchers ...interface{}) *WorkflowExecutor_Abort { - c_call := _m.On("Abort", matchers...) - return &WorkflowExecutor_Abort{Call: c_call} -} - // Abort provides a mock function with given fields: ctx, data func (_m *WorkflowExecutor) Abort(ctx context.Context, data interfaces.AbortData) error { ret := _m.Called(ctx, data) + if len(ret) == 0 { + panic("no return value specified for Abort") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, interfaces.AbortData) error); ok { r0 = rf(ctx, data) @@ -46,36 +32,25 @@ func (_m *WorkflowExecutor) Abort(ctx context.Context, data interfaces.AbortData return r0 } -type WorkflowExecutor_Execute struct { - *mock.Call -} - -func (_m WorkflowExecutor_Execute) Return(_a0 interfaces.ExecutionResponse, _a1 error) *WorkflowExecutor_Execute { - return &WorkflowExecutor_Execute{Call: _m.Call.Return(_a0, _a1)} -} - -func (_m *WorkflowExecutor) OnExecute(ctx context.Context, data interfaces.ExecutionData) *WorkflowExecutor_Execute { - c_call := _m.On("Execute", ctx, data) - return &WorkflowExecutor_Execute{Call: c_call} -} - -func (_m *WorkflowExecutor) OnExecuteMatch(matchers ...interface{}) *WorkflowExecutor_Execute { - c_call := _m.On("Execute", matchers...) - return &WorkflowExecutor_Execute{Call: c_call} -} - // Execute provides a mock function with given fields: ctx, data func (_m *WorkflowExecutor) Execute(ctx context.Context, data interfaces.ExecutionData) (interfaces.ExecutionResponse, error) { ret := _m.Called(ctx, data) + if len(ret) == 0 { + panic("no return value specified for Execute") + } + var r0 interfaces.ExecutionResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, interfaces.ExecutionData) (interfaces.ExecutionResponse, error)); ok { + return rf(ctx, data) + } if rf, ok := ret.Get(0).(func(context.Context, interfaces.ExecutionData) interfaces.ExecutionResponse); ok { r0 = rf(ctx, data) } else { r0 = ret.Get(0).(interfaces.ExecutionResponse) } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, interfaces.ExecutionData) error); ok { r1 = rf(ctx, data) } else { @@ -85,28 +60,14 @@ func (_m *WorkflowExecutor) Execute(ctx context.Context, data interfaces.Executi return r0, r1 } -type WorkflowExecutor_ID struct { - *mock.Call -} - -func (_m WorkflowExecutor_ID) Return(_a0 string) *WorkflowExecutor_ID { - return &WorkflowExecutor_ID{Call: _m.Call.Return(_a0)} -} - -func (_m *WorkflowExecutor) OnID() *WorkflowExecutor_ID { - c_call := _m.On("ID") - return &WorkflowExecutor_ID{Call: c_call} -} - -func (_m *WorkflowExecutor) OnIDMatch(matchers ...interface{}) *WorkflowExecutor_ID { - c_call := _m.On("ID", matchers...) - return &WorkflowExecutor_ID{Call: c_call} -} - // ID provides a mock function with given fields: func (_m *WorkflowExecutor) ID() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ID") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -116,3 +77,17 @@ func (_m *WorkflowExecutor) ID() string { return r0 } + +// NewWorkflowExecutor creates a new instance of WorkflowExecutor. 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 NewWorkflowExecutor(t interface { + mock.TestingT + Cleanup(func()) +}) *WorkflowExecutor { + mock := &WorkflowExecutor{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +}