From 18011ab3075a4cf5f7ec1df351a6dbbe2c55c472 Mon Sep 17 00:00:00 2001 From: Eduardo Apolinario Date: Thu, 6 Jun 2024 13:56:00 -0700 Subject: [PATCH] Fix existing propeller unit tests Signed-off-by: Eduardo Apolinario --- .../controller/executors/execution_context.go | 2 +- .../executors/mocks/execution_context.go | 892 +++++++++++++----- .../controller/nodes/array/handler_test.go | 26 +- .../controller/nodes/branch/handler_test.go | 8 +- .../pkg/controller/nodes/cache_test.go | 5 +- .../nodes/dynamic/dynamic_workflow_test.go | 26 +- .../controller/nodes/dynamic/handler_test.go | 16 +- .../pkg/controller/nodes/executor_test.go | 40 +- .../pkg/controller/nodes/gate/handler_test.go | 2 +- .../pkg/controller/nodes/resolve_test.go | 2 + .../nodes/subworkflow/handler_test.go | 32 +- .../nodes/subworkflow/launchplan_test.go | 20 +- .../nodes/subworkflow/subworkflow_test.go | 16 +- .../pkg/controller/nodes/task/handler_test.go | 26 +- .../nodes/task/taskexec_context_test.go | 6 +- .../controller/nodes/task/transformer_test.go | 8 +- 16 files changed, 771 insertions(+), 356 deletions(-) diff --git a/flytepropeller/pkg/controller/executors/execution_context.go b/flytepropeller/pkg/controller/executors/execution_context.go index 84799a0400..07b5a6c450 100644 --- a/flytepropeller/pkg/controller/executors/execution_context.go +++ b/flytepropeller/pkg/controller/executors/execution_context.go @@ -4,7 +4,7 @@ import ( "github.com/flyteorg/flyte/flytepropeller/pkg/apis/flyteworkflow/v1alpha1" ) -// go:generate mockery -case=underscore +//go:generate mockery-v2 --case=underscore --with-expecter --name ExecutionContext --output=mocks type TaskDetailsGetter interface { GetTask(id v1alpha1.TaskID) (v1alpha1.ExecutableTask, error) diff --git a/flytepropeller/pkg/controller/executors/mocks/execution_context.go b/flytepropeller/pkg/controller/executors/mocks/execution_context.go index cf9f4bcb49..cbcd501525 100644 --- a/flytepropeller/pkg/controller/executors/mocks/execution_context.go +++ b/flytepropeller/pkg/controller/executors/mocks/execution_context.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 @@ -20,28 +20,22 @@ type ExecutionContext struct { mock.Mock } -type ExecutionContext_CurrentNodeExecutionCount struct { - *mock.Call -} - -func (_m ExecutionContext_CurrentNodeExecutionCount) Return(_a0 uint32) *ExecutionContext_CurrentNodeExecutionCount { - return &ExecutionContext_CurrentNodeExecutionCount{Call: _m.Call.Return(_a0)} -} - -func (_m *ExecutionContext) OnCurrentNodeExecutionCount() *ExecutionContext_CurrentNodeExecutionCount { - c_call := _m.On("CurrentNodeExecutionCount") - return &ExecutionContext_CurrentNodeExecutionCount{Call: c_call} +type ExecutionContext_Expecter struct { + mock *mock.Mock } -func (_m *ExecutionContext) OnCurrentNodeExecutionCountMatch(matchers ...interface{}) *ExecutionContext_CurrentNodeExecutionCount { - c_call := _m.On("CurrentNodeExecutionCount", matchers...) - return &ExecutionContext_CurrentNodeExecutionCount{Call: c_call} +func (_m *ExecutionContext) EXPECT() *ExecutionContext_Expecter { + return &ExecutionContext_Expecter{mock: &_m.Mock} } // CurrentNodeExecutionCount provides a mock function with given fields: func (_m *ExecutionContext) CurrentNodeExecutionCount() uint32 { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for CurrentNodeExecutionCount") + } + var r0 uint32 if rf, ok := ret.Get(0).(func() uint32); ok { r0 = rf() @@ -52,28 +46,41 @@ func (_m *ExecutionContext) CurrentNodeExecutionCount() uint32 { return r0 } -type ExecutionContext_CurrentParallelism struct { +// ExecutionContext_CurrentNodeExecutionCount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CurrentNodeExecutionCount' +type ExecutionContext_CurrentNodeExecutionCount_Call struct { *mock.Call } -func (_m ExecutionContext_CurrentParallelism) Return(_a0 uint32) *ExecutionContext_CurrentParallelism { - return &ExecutionContext_CurrentParallelism{Call: _m.Call.Return(_a0)} +// CurrentNodeExecutionCount is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) CurrentNodeExecutionCount() *ExecutionContext_CurrentNodeExecutionCount_Call { + return &ExecutionContext_CurrentNodeExecutionCount_Call{Call: _e.mock.On("CurrentNodeExecutionCount")} } -func (_m *ExecutionContext) OnCurrentParallelism() *ExecutionContext_CurrentParallelism { - c_call := _m.On("CurrentParallelism") - return &ExecutionContext_CurrentParallelism{Call: c_call} +func (_c *ExecutionContext_CurrentNodeExecutionCount_Call) Run(run func()) *ExecutionContext_CurrentNodeExecutionCount_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnCurrentParallelismMatch(matchers ...interface{}) *ExecutionContext_CurrentParallelism { - c_call := _m.On("CurrentParallelism", matchers...) - return &ExecutionContext_CurrentParallelism{Call: c_call} +func (_c *ExecutionContext_CurrentNodeExecutionCount_Call) Return(_a0 uint32) *ExecutionContext_CurrentNodeExecutionCount_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ExecutionContext_CurrentNodeExecutionCount_Call) RunAndReturn(run func() uint32) *ExecutionContext_CurrentNodeExecutionCount_Call { + _c.Call.Return(run) + return _c } // CurrentParallelism provides a mock function with given fields: func (_m *ExecutionContext) CurrentParallelism() uint32 { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for CurrentParallelism") + } + var r0 uint32 if rf, ok := ret.Get(0).(func() uint32); ok { r0 = rf() @@ -84,28 +91,41 @@ func (_m *ExecutionContext) CurrentParallelism() uint32 { return r0 } -type ExecutionContext_CurrentTaskExecutionCount struct { +// ExecutionContext_CurrentParallelism_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CurrentParallelism' +type ExecutionContext_CurrentParallelism_Call struct { *mock.Call } -func (_m ExecutionContext_CurrentTaskExecutionCount) Return(_a0 uint32) *ExecutionContext_CurrentTaskExecutionCount { - return &ExecutionContext_CurrentTaskExecutionCount{Call: _m.Call.Return(_a0)} +// CurrentParallelism is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) CurrentParallelism() *ExecutionContext_CurrentParallelism_Call { + return &ExecutionContext_CurrentParallelism_Call{Call: _e.mock.On("CurrentParallelism")} +} + +func (_c *ExecutionContext_CurrentParallelism_Call) Run(run func()) *ExecutionContext_CurrentParallelism_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnCurrentTaskExecutionCount() *ExecutionContext_CurrentTaskExecutionCount { - c_call := _m.On("CurrentTaskExecutionCount") - return &ExecutionContext_CurrentTaskExecutionCount{Call: c_call} +func (_c *ExecutionContext_CurrentParallelism_Call) Return(_a0 uint32) *ExecutionContext_CurrentParallelism_Call { + _c.Call.Return(_a0) + return _c } -func (_m *ExecutionContext) OnCurrentTaskExecutionCountMatch(matchers ...interface{}) *ExecutionContext_CurrentTaskExecutionCount { - c_call := _m.On("CurrentTaskExecutionCount", matchers...) - return &ExecutionContext_CurrentTaskExecutionCount{Call: c_call} +func (_c *ExecutionContext_CurrentParallelism_Call) RunAndReturn(run func() uint32) *ExecutionContext_CurrentParallelism_Call { + _c.Call.Return(run) + return _c } // CurrentTaskExecutionCount provides a mock function with given fields: func (_m *ExecutionContext) CurrentTaskExecutionCount() uint32 { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for CurrentTaskExecutionCount") + } + var r0 uint32 if rf, ok := ret.Get(0).(func() uint32); ok { r0 = rf() @@ -116,28 +136,41 @@ func (_m *ExecutionContext) CurrentTaskExecutionCount() uint32 { return r0 } -type ExecutionContext_FindSubWorkflow struct { +// ExecutionContext_CurrentTaskExecutionCount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CurrentTaskExecutionCount' +type ExecutionContext_CurrentTaskExecutionCount_Call struct { *mock.Call } -func (_m ExecutionContext_FindSubWorkflow) Return(_a0 v1alpha1.ExecutableSubWorkflow) *ExecutionContext_FindSubWorkflow { - return &ExecutionContext_FindSubWorkflow{Call: _m.Call.Return(_a0)} +// CurrentTaskExecutionCount is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) CurrentTaskExecutionCount() *ExecutionContext_CurrentTaskExecutionCount_Call { + return &ExecutionContext_CurrentTaskExecutionCount_Call{Call: _e.mock.On("CurrentTaskExecutionCount")} } -func (_m *ExecutionContext) OnFindSubWorkflow(subID string) *ExecutionContext_FindSubWorkflow { - c_call := _m.On("FindSubWorkflow", subID) - return &ExecutionContext_FindSubWorkflow{Call: c_call} +func (_c *ExecutionContext_CurrentTaskExecutionCount_Call) Run(run func()) *ExecutionContext_CurrentTaskExecutionCount_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnFindSubWorkflowMatch(matchers ...interface{}) *ExecutionContext_FindSubWorkflow { - c_call := _m.On("FindSubWorkflow", matchers...) - return &ExecutionContext_FindSubWorkflow{Call: c_call} +func (_c *ExecutionContext_CurrentTaskExecutionCount_Call) Return(_a0 uint32) *ExecutionContext_CurrentTaskExecutionCount_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ExecutionContext_CurrentTaskExecutionCount_Call) RunAndReturn(run func() uint32) *ExecutionContext_CurrentTaskExecutionCount_Call { + _c.Call.Return(run) + return _c } // FindSubWorkflow provides a mock function with given fields: subID func (_m *ExecutionContext) FindSubWorkflow(subID string) v1alpha1.ExecutableSubWorkflow { ret := _m.Called(subID) + if len(ret) == 0 { + panic("no return value specified for FindSubWorkflow") + } + var r0 v1alpha1.ExecutableSubWorkflow if rf, ok := ret.Get(0).(func(string) v1alpha1.ExecutableSubWorkflow); ok { r0 = rf(subID) @@ -150,28 +183,42 @@ func (_m *ExecutionContext) FindSubWorkflow(subID string) v1alpha1.ExecutableSub return r0 } -type ExecutionContext_GetAnnotations struct { +// ExecutionContext_FindSubWorkflow_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindSubWorkflow' +type ExecutionContext_FindSubWorkflow_Call struct { *mock.Call } -func (_m ExecutionContext_GetAnnotations) Return(_a0 map[string]string) *ExecutionContext_GetAnnotations { - return &ExecutionContext_GetAnnotations{Call: _m.Call.Return(_a0)} +// FindSubWorkflow is a helper method to define mock.On call +// - subID string +func (_e *ExecutionContext_Expecter) FindSubWorkflow(subID interface{}) *ExecutionContext_FindSubWorkflow_Call { + return &ExecutionContext_FindSubWorkflow_Call{Call: _e.mock.On("FindSubWorkflow", subID)} } -func (_m *ExecutionContext) OnGetAnnotations() *ExecutionContext_GetAnnotations { - c_call := _m.On("GetAnnotations") - return &ExecutionContext_GetAnnotations{Call: c_call} +func (_c *ExecutionContext_FindSubWorkflow_Call) Run(run func(subID string)) *ExecutionContext_FindSubWorkflow_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c } -func (_m *ExecutionContext) OnGetAnnotationsMatch(matchers ...interface{}) *ExecutionContext_GetAnnotations { - c_call := _m.On("GetAnnotations", matchers...) - return &ExecutionContext_GetAnnotations{Call: c_call} +func (_c *ExecutionContext_FindSubWorkflow_Call) Return(_a0 v1alpha1.ExecutableSubWorkflow) *ExecutionContext_FindSubWorkflow_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ExecutionContext_FindSubWorkflow_Call) RunAndReturn(run func(string) v1alpha1.ExecutableSubWorkflow) *ExecutionContext_FindSubWorkflow_Call { + _c.Call.Return(run) + return _c } // GetAnnotations provides a mock function with given fields: func (_m *ExecutionContext) GetAnnotations() map[string]string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetAnnotations") + } + var r0 map[string]string if rf, ok := ret.Get(0).(func() map[string]string); ok { r0 = rf() @@ -184,28 +231,86 @@ func (_m *ExecutionContext) GetAnnotations() map[string]string { return r0 } -type ExecutionContext_GetCreationTimestamp struct { +// ExecutionContext_GetAnnotations_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAnnotations' +type ExecutionContext_GetAnnotations_Call struct { *mock.Call } -func (_m ExecutionContext_GetCreationTimestamp) Return(_a0 v1.Time) *ExecutionContext_GetCreationTimestamp { - return &ExecutionContext_GetCreationTimestamp{Call: _m.Call.Return(_a0)} +// GetAnnotations is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) GetAnnotations() *ExecutionContext_GetAnnotations_Call { + return &ExecutionContext_GetAnnotations_Call{Call: _e.mock.On("GetAnnotations")} +} + +func (_c *ExecutionContext_GetAnnotations_Call) Run(run func()) *ExecutionContext_GetAnnotations_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnGetCreationTimestamp() *ExecutionContext_GetCreationTimestamp { - c_call := _m.On("GetCreationTimestamp") - return &ExecutionContext_GetCreationTimestamp{Call: c_call} +func (_c *ExecutionContext_GetAnnotations_Call) Return(_a0 map[string]string) *ExecutionContext_GetAnnotations_Call { + _c.Call.Return(_a0) + return _c } -func (_m *ExecutionContext) OnGetCreationTimestampMatch(matchers ...interface{}) *ExecutionContext_GetCreationTimestamp { - c_call := _m.On("GetCreationTimestamp", matchers...) - return &ExecutionContext_GetCreationTimestamp{Call: c_call} +func (_c *ExecutionContext_GetAnnotations_Call) RunAndReturn(run func() map[string]string) *ExecutionContext_GetAnnotations_Call { + _c.Call.Return(run) + return _c +} + +// GetConsoleURL provides a mock function with given fields: +func (_m *ExecutionContext) GetConsoleURL() string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetConsoleURL") + } + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// ExecutionContext_GetConsoleURL_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetConsoleURL' +type ExecutionContext_GetConsoleURL_Call struct { + *mock.Call +} + +// GetConsoleURL is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) GetConsoleURL() *ExecutionContext_GetConsoleURL_Call { + return &ExecutionContext_GetConsoleURL_Call{Call: _e.mock.On("GetConsoleURL")} +} + +func (_c *ExecutionContext_GetConsoleURL_Call) Run(run func()) *ExecutionContext_GetConsoleURL_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ExecutionContext_GetConsoleURL_Call) Return(_a0 string) *ExecutionContext_GetConsoleURL_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ExecutionContext_GetConsoleURL_Call) RunAndReturn(run func() string) *ExecutionContext_GetConsoleURL_Call { + _c.Call.Return(run) + return _c } // GetCreationTimestamp provides a mock function with given fields: func (_m *ExecutionContext) GetCreationTimestamp() v1.Time { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetCreationTimestamp") + } + var r0 v1.Time if rf, ok := ret.Get(0).(func() v1.Time); ok { r0 = rf() @@ -216,28 +321,41 @@ func (_m *ExecutionContext) GetCreationTimestamp() v1.Time { return r0 } -type ExecutionContext_GetDefinitionVersion struct { +// ExecutionContext_GetCreationTimestamp_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCreationTimestamp' +type ExecutionContext_GetCreationTimestamp_Call struct { *mock.Call } -func (_m ExecutionContext_GetDefinitionVersion) Return(_a0 v1alpha1.WorkflowDefinitionVersion) *ExecutionContext_GetDefinitionVersion { - return &ExecutionContext_GetDefinitionVersion{Call: _m.Call.Return(_a0)} +// GetCreationTimestamp is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) GetCreationTimestamp() *ExecutionContext_GetCreationTimestamp_Call { + return &ExecutionContext_GetCreationTimestamp_Call{Call: _e.mock.On("GetCreationTimestamp")} } -func (_m *ExecutionContext) OnGetDefinitionVersion() *ExecutionContext_GetDefinitionVersion { - c_call := _m.On("GetDefinitionVersion") - return &ExecutionContext_GetDefinitionVersion{Call: c_call} +func (_c *ExecutionContext_GetCreationTimestamp_Call) Run(run func()) *ExecutionContext_GetCreationTimestamp_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnGetDefinitionVersionMatch(matchers ...interface{}) *ExecutionContext_GetDefinitionVersion { - c_call := _m.On("GetDefinitionVersion", matchers...) - return &ExecutionContext_GetDefinitionVersion{Call: c_call} +func (_c *ExecutionContext_GetCreationTimestamp_Call) Return(_a0 v1.Time) *ExecutionContext_GetCreationTimestamp_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ExecutionContext_GetCreationTimestamp_Call) RunAndReturn(run func() v1.Time) *ExecutionContext_GetCreationTimestamp_Call { + _c.Call.Return(run) + return _c } // GetDefinitionVersion provides a mock function with given fields: func (_m *ExecutionContext) GetDefinitionVersion() v1alpha1.WorkflowDefinitionVersion { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetDefinitionVersion") + } + var r0 v1alpha1.WorkflowDefinitionVersion if rf, ok := ret.Get(0).(func() v1alpha1.WorkflowDefinitionVersion); ok { r0 = rf() @@ -248,28 +366,41 @@ func (_m *ExecutionContext) GetDefinitionVersion() v1alpha1.WorkflowDefinitionVe return r0 } -type ExecutionContext_GetEventVersion struct { +// ExecutionContext_GetDefinitionVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDefinitionVersion' +type ExecutionContext_GetDefinitionVersion_Call struct { *mock.Call } -func (_m ExecutionContext_GetEventVersion) Return(_a0 v1alpha1.EventVersion) *ExecutionContext_GetEventVersion { - return &ExecutionContext_GetEventVersion{Call: _m.Call.Return(_a0)} +// GetDefinitionVersion is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) GetDefinitionVersion() *ExecutionContext_GetDefinitionVersion_Call { + return &ExecutionContext_GetDefinitionVersion_Call{Call: _e.mock.On("GetDefinitionVersion")} } -func (_m *ExecutionContext) OnGetEventVersion() *ExecutionContext_GetEventVersion { - c_call := _m.On("GetEventVersion") - return &ExecutionContext_GetEventVersion{Call: c_call} +func (_c *ExecutionContext_GetDefinitionVersion_Call) Run(run func()) *ExecutionContext_GetDefinitionVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnGetEventVersionMatch(matchers ...interface{}) *ExecutionContext_GetEventVersion { - c_call := _m.On("GetEventVersion", matchers...) - return &ExecutionContext_GetEventVersion{Call: c_call} +func (_c *ExecutionContext_GetDefinitionVersion_Call) Return(_a0 v1alpha1.WorkflowDefinitionVersion) *ExecutionContext_GetDefinitionVersion_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ExecutionContext_GetDefinitionVersion_Call) RunAndReturn(run func() v1alpha1.WorkflowDefinitionVersion) *ExecutionContext_GetDefinitionVersion_Call { + _c.Call.Return(run) + return _c } // GetEventVersion provides a mock function with given fields: func (_m *ExecutionContext) GetEventVersion() v1alpha1.EventVersion { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetEventVersion") + } + var r0 v1alpha1.EventVersion if rf, ok := ret.Get(0).(func() v1alpha1.EventVersion); ok { r0 = rf() @@ -280,28 +411,41 @@ func (_m *ExecutionContext) GetEventVersion() v1alpha1.EventVersion { return r0 } -type ExecutionContext_GetExecutionConfig struct { +// ExecutionContext_GetEventVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetEventVersion' +type ExecutionContext_GetEventVersion_Call struct { *mock.Call } -func (_m ExecutionContext_GetExecutionConfig) Return(_a0 v1alpha1.ExecutionConfig) *ExecutionContext_GetExecutionConfig { - return &ExecutionContext_GetExecutionConfig{Call: _m.Call.Return(_a0)} +// GetEventVersion is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) GetEventVersion() *ExecutionContext_GetEventVersion_Call { + return &ExecutionContext_GetEventVersion_Call{Call: _e.mock.On("GetEventVersion")} +} + +func (_c *ExecutionContext_GetEventVersion_Call) Run(run func()) *ExecutionContext_GetEventVersion_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnGetExecutionConfig() *ExecutionContext_GetExecutionConfig { - c_call := _m.On("GetExecutionConfig") - return &ExecutionContext_GetExecutionConfig{Call: c_call} +func (_c *ExecutionContext_GetEventVersion_Call) Return(_a0 v1alpha1.EventVersion) *ExecutionContext_GetEventVersion_Call { + _c.Call.Return(_a0) + return _c } -func (_m *ExecutionContext) OnGetExecutionConfigMatch(matchers ...interface{}) *ExecutionContext_GetExecutionConfig { - c_call := _m.On("GetExecutionConfig", matchers...) - return &ExecutionContext_GetExecutionConfig{Call: c_call} +func (_c *ExecutionContext_GetEventVersion_Call) RunAndReturn(run func() v1alpha1.EventVersion) *ExecutionContext_GetEventVersion_Call { + _c.Call.Return(run) + return _c } // GetExecutionConfig provides a mock function with given fields: func (_m *ExecutionContext) GetExecutionConfig() v1alpha1.ExecutionConfig { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetExecutionConfig") + } + var r0 v1alpha1.ExecutionConfig if rf, ok := ret.Get(0).(func() v1alpha1.ExecutionConfig); ok { r0 = rf() @@ -312,28 +456,41 @@ func (_m *ExecutionContext) GetExecutionConfig() v1alpha1.ExecutionConfig { return r0 } -type ExecutionContext_GetExecutionID struct { +// ExecutionContext_GetExecutionConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetExecutionConfig' +type ExecutionContext_GetExecutionConfig_Call struct { *mock.Call } -func (_m ExecutionContext_GetExecutionID) Return(_a0 v1alpha1.WorkflowExecutionIdentifier) *ExecutionContext_GetExecutionID { - return &ExecutionContext_GetExecutionID{Call: _m.Call.Return(_a0)} +// GetExecutionConfig is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) GetExecutionConfig() *ExecutionContext_GetExecutionConfig_Call { + return &ExecutionContext_GetExecutionConfig_Call{Call: _e.mock.On("GetExecutionConfig")} +} + +func (_c *ExecutionContext_GetExecutionConfig_Call) Run(run func()) *ExecutionContext_GetExecutionConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnGetExecutionID() *ExecutionContext_GetExecutionID { - c_call := _m.On("GetExecutionID") - return &ExecutionContext_GetExecutionID{Call: c_call} +func (_c *ExecutionContext_GetExecutionConfig_Call) Return(_a0 v1alpha1.ExecutionConfig) *ExecutionContext_GetExecutionConfig_Call { + _c.Call.Return(_a0) + return _c } -func (_m *ExecutionContext) OnGetExecutionIDMatch(matchers ...interface{}) *ExecutionContext_GetExecutionID { - c_call := _m.On("GetExecutionID", matchers...) - return &ExecutionContext_GetExecutionID{Call: c_call} +func (_c *ExecutionContext_GetExecutionConfig_Call) RunAndReturn(run func() v1alpha1.ExecutionConfig) *ExecutionContext_GetExecutionConfig_Call { + _c.Call.Return(run) + return _c } // GetExecutionID provides a mock function with given fields: func (_m *ExecutionContext) GetExecutionID() v1alpha1.WorkflowExecutionIdentifier { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetExecutionID") + } + var r0 v1alpha1.WorkflowExecutionIdentifier if rf, ok := ret.Get(0).(func() v1alpha1.WorkflowExecutionIdentifier); ok { r0 = rf() @@ -344,28 +501,41 @@ func (_m *ExecutionContext) GetExecutionID() v1alpha1.WorkflowExecutionIdentifie return r0 } -type ExecutionContext_GetID struct { +// ExecutionContext_GetExecutionID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetExecutionID' +type ExecutionContext_GetExecutionID_Call struct { *mock.Call } -func (_m ExecutionContext_GetID) Return(_a0 string) *ExecutionContext_GetID { - return &ExecutionContext_GetID{Call: _m.Call.Return(_a0)} +// GetExecutionID is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) GetExecutionID() *ExecutionContext_GetExecutionID_Call { + return &ExecutionContext_GetExecutionID_Call{Call: _e.mock.On("GetExecutionID")} } -func (_m *ExecutionContext) OnGetID() *ExecutionContext_GetID { - c_call := _m.On("GetID") - return &ExecutionContext_GetID{Call: c_call} +func (_c *ExecutionContext_GetExecutionID_Call) Run(run func()) *ExecutionContext_GetExecutionID_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnGetIDMatch(matchers ...interface{}) *ExecutionContext_GetID { - c_call := _m.On("GetID", matchers...) - return &ExecutionContext_GetID{Call: c_call} +func (_c *ExecutionContext_GetExecutionID_Call) Return(_a0 v1alpha1.WorkflowExecutionIdentifier) *ExecutionContext_GetExecutionID_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ExecutionContext_GetExecutionID_Call) RunAndReturn(run func() v1alpha1.WorkflowExecutionIdentifier) *ExecutionContext_GetExecutionID_Call { + _c.Call.Return(run) + return _c } // GetID provides a mock function with given fields: func (_m *ExecutionContext) GetID() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetID") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -376,28 +546,41 @@ func (_m *ExecutionContext) GetID() string { return r0 } -type ExecutionContext_GetK8sWorkflowID struct { +// ExecutionContext_GetID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetID' +type ExecutionContext_GetID_Call struct { *mock.Call } -func (_m ExecutionContext_GetK8sWorkflowID) Return(_a0 types.NamespacedName) *ExecutionContext_GetK8sWorkflowID { - return &ExecutionContext_GetK8sWorkflowID{Call: _m.Call.Return(_a0)} +// GetID is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) GetID() *ExecutionContext_GetID_Call { + return &ExecutionContext_GetID_Call{Call: _e.mock.On("GetID")} +} + +func (_c *ExecutionContext_GetID_Call) Run(run func()) *ExecutionContext_GetID_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnGetK8sWorkflowID() *ExecutionContext_GetK8sWorkflowID { - c_call := _m.On("GetK8sWorkflowID") - return &ExecutionContext_GetK8sWorkflowID{Call: c_call} +func (_c *ExecutionContext_GetID_Call) Return(_a0 string) *ExecutionContext_GetID_Call { + _c.Call.Return(_a0) + return _c } -func (_m *ExecutionContext) OnGetK8sWorkflowIDMatch(matchers ...interface{}) *ExecutionContext_GetK8sWorkflowID { - c_call := _m.On("GetK8sWorkflowID", matchers...) - return &ExecutionContext_GetK8sWorkflowID{Call: c_call} +func (_c *ExecutionContext_GetID_Call) RunAndReturn(run func() string) *ExecutionContext_GetID_Call { + _c.Call.Return(run) + return _c } // GetK8sWorkflowID provides a mock function with given fields: func (_m *ExecutionContext) GetK8sWorkflowID() types.NamespacedName { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetK8sWorkflowID") + } + var r0 types.NamespacedName if rf, ok := ret.Get(0).(func() types.NamespacedName); ok { r0 = rf() @@ -408,28 +591,41 @@ func (_m *ExecutionContext) GetK8sWorkflowID() types.NamespacedName { return r0 } -type ExecutionContext_GetLabels struct { +// ExecutionContext_GetK8sWorkflowID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetK8sWorkflowID' +type ExecutionContext_GetK8sWorkflowID_Call struct { *mock.Call } -func (_m ExecutionContext_GetLabels) Return(_a0 map[string]string) *ExecutionContext_GetLabels { - return &ExecutionContext_GetLabels{Call: _m.Call.Return(_a0)} +// GetK8sWorkflowID is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) GetK8sWorkflowID() *ExecutionContext_GetK8sWorkflowID_Call { + return &ExecutionContext_GetK8sWorkflowID_Call{Call: _e.mock.On("GetK8sWorkflowID")} +} + +func (_c *ExecutionContext_GetK8sWorkflowID_Call) Run(run func()) *ExecutionContext_GetK8sWorkflowID_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnGetLabels() *ExecutionContext_GetLabels { - c_call := _m.On("GetLabels") - return &ExecutionContext_GetLabels{Call: c_call} +func (_c *ExecutionContext_GetK8sWorkflowID_Call) Return(_a0 types.NamespacedName) *ExecutionContext_GetK8sWorkflowID_Call { + _c.Call.Return(_a0) + return _c } -func (_m *ExecutionContext) OnGetLabelsMatch(matchers ...interface{}) *ExecutionContext_GetLabels { - c_call := _m.On("GetLabels", matchers...) - return &ExecutionContext_GetLabels{Call: c_call} +func (_c *ExecutionContext_GetK8sWorkflowID_Call) RunAndReturn(run func() types.NamespacedName) *ExecutionContext_GetK8sWorkflowID_Call { + _c.Call.Return(run) + return _c } // GetLabels provides a mock function with given fields: func (_m *ExecutionContext) GetLabels() map[string]string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetLabels") + } + var r0 map[string]string if rf, ok := ret.Get(0).(func() map[string]string); ok { r0 = rf() @@ -442,28 +638,41 @@ func (_m *ExecutionContext) GetLabels() map[string]string { return r0 } -type ExecutionContext_GetName struct { +// ExecutionContext_GetLabels_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLabels' +type ExecutionContext_GetLabels_Call struct { *mock.Call } -func (_m ExecutionContext_GetName) Return(_a0 string) *ExecutionContext_GetName { - return &ExecutionContext_GetName{Call: _m.Call.Return(_a0)} +// GetLabels is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) GetLabels() *ExecutionContext_GetLabels_Call { + return &ExecutionContext_GetLabels_Call{Call: _e.mock.On("GetLabels")} } -func (_m *ExecutionContext) OnGetName() *ExecutionContext_GetName { - c_call := _m.On("GetName") - return &ExecutionContext_GetName{Call: c_call} +func (_c *ExecutionContext_GetLabels_Call) Run(run func()) *ExecutionContext_GetLabels_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnGetNameMatch(matchers ...interface{}) *ExecutionContext_GetName { - c_call := _m.On("GetName", matchers...) - return &ExecutionContext_GetName{Call: c_call} +func (_c *ExecutionContext_GetLabels_Call) Return(_a0 map[string]string) *ExecutionContext_GetLabels_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ExecutionContext_GetLabels_Call) RunAndReturn(run func() map[string]string) *ExecutionContext_GetLabels_Call { + _c.Call.Return(run) + return _c } // GetName provides a mock function with given fields: func (_m *ExecutionContext) GetName() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetName") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -474,28 +683,41 @@ func (_m *ExecutionContext) GetName() string { return r0 } -type ExecutionContext_GetNamespace struct { +// ExecutionContext_GetName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetName' +type ExecutionContext_GetName_Call struct { *mock.Call } -func (_m ExecutionContext_GetNamespace) Return(_a0 string) *ExecutionContext_GetNamespace { - return &ExecutionContext_GetNamespace{Call: _m.Call.Return(_a0)} +// GetName is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) GetName() *ExecutionContext_GetName_Call { + return &ExecutionContext_GetName_Call{Call: _e.mock.On("GetName")} } -func (_m *ExecutionContext) OnGetNamespace() *ExecutionContext_GetNamespace { - c_call := _m.On("GetNamespace") - return &ExecutionContext_GetNamespace{Call: c_call} +func (_c *ExecutionContext_GetName_Call) Run(run func()) *ExecutionContext_GetName_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnGetNamespaceMatch(matchers ...interface{}) *ExecutionContext_GetNamespace { - c_call := _m.On("GetNamespace", matchers...) - return &ExecutionContext_GetNamespace{Call: c_call} +func (_c *ExecutionContext_GetName_Call) Return(_a0 string) *ExecutionContext_GetName_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ExecutionContext_GetName_Call) RunAndReturn(run func() string) *ExecutionContext_GetName_Call { + _c.Call.Return(run) + return _c } // GetNamespace provides a mock function with given fields: func (_m *ExecutionContext) GetNamespace() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetNamespace") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -506,28 +728,41 @@ func (_m *ExecutionContext) GetNamespace() string { return r0 } -type ExecutionContext_GetOnFailurePolicy struct { +// ExecutionContext_GetNamespace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNamespace' +type ExecutionContext_GetNamespace_Call struct { *mock.Call } -func (_m ExecutionContext_GetOnFailurePolicy) Return(_a0 v1alpha1.WorkflowOnFailurePolicy) *ExecutionContext_GetOnFailurePolicy { - return &ExecutionContext_GetOnFailurePolicy{Call: _m.Call.Return(_a0)} +// GetNamespace is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) GetNamespace() *ExecutionContext_GetNamespace_Call { + return &ExecutionContext_GetNamespace_Call{Call: _e.mock.On("GetNamespace")} +} + +func (_c *ExecutionContext_GetNamespace_Call) Run(run func()) *ExecutionContext_GetNamespace_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnGetOnFailurePolicy() *ExecutionContext_GetOnFailurePolicy { - c_call := _m.On("GetOnFailurePolicy") - return &ExecutionContext_GetOnFailurePolicy{Call: c_call} +func (_c *ExecutionContext_GetNamespace_Call) Return(_a0 string) *ExecutionContext_GetNamespace_Call { + _c.Call.Return(_a0) + return _c } -func (_m *ExecutionContext) OnGetOnFailurePolicyMatch(matchers ...interface{}) *ExecutionContext_GetOnFailurePolicy { - c_call := _m.On("GetOnFailurePolicy", matchers...) - return &ExecutionContext_GetOnFailurePolicy{Call: c_call} +func (_c *ExecutionContext_GetNamespace_Call) RunAndReturn(run func() string) *ExecutionContext_GetNamespace_Call { + _c.Call.Return(run) + return _c } // GetOnFailurePolicy provides a mock function with given fields: func (_m *ExecutionContext) GetOnFailurePolicy() v1alpha1.WorkflowOnFailurePolicy { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetOnFailurePolicy") + } + var r0 v1alpha1.WorkflowOnFailurePolicy if rf, ok := ret.Get(0).(func() v1alpha1.WorkflowOnFailurePolicy); ok { r0 = rf() @@ -538,28 +773,41 @@ func (_m *ExecutionContext) GetOnFailurePolicy() v1alpha1.WorkflowOnFailurePolic return r0 } -type ExecutionContext_GetOwnerReference struct { +// ExecutionContext_GetOnFailurePolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetOnFailurePolicy' +type ExecutionContext_GetOnFailurePolicy_Call struct { *mock.Call } -func (_m ExecutionContext_GetOwnerReference) Return(_a0 v1.OwnerReference) *ExecutionContext_GetOwnerReference { - return &ExecutionContext_GetOwnerReference{Call: _m.Call.Return(_a0)} +// GetOnFailurePolicy is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) GetOnFailurePolicy() *ExecutionContext_GetOnFailurePolicy_Call { + return &ExecutionContext_GetOnFailurePolicy_Call{Call: _e.mock.On("GetOnFailurePolicy")} +} + +func (_c *ExecutionContext_GetOnFailurePolicy_Call) Run(run func()) *ExecutionContext_GetOnFailurePolicy_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnGetOwnerReference() *ExecutionContext_GetOwnerReference { - c_call := _m.On("GetOwnerReference") - return &ExecutionContext_GetOwnerReference{Call: c_call} +func (_c *ExecutionContext_GetOnFailurePolicy_Call) Return(_a0 v1alpha1.WorkflowOnFailurePolicy) *ExecutionContext_GetOnFailurePolicy_Call { + _c.Call.Return(_a0) + return _c } -func (_m *ExecutionContext) OnGetOwnerReferenceMatch(matchers ...interface{}) *ExecutionContext_GetOwnerReference { - c_call := _m.On("GetOwnerReference", matchers...) - return &ExecutionContext_GetOwnerReference{Call: c_call} +func (_c *ExecutionContext_GetOnFailurePolicy_Call) RunAndReturn(run func() v1alpha1.WorkflowOnFailurePolicy) *ExecutionContext_GetOnFailurePolicy_Call { + _c.Call.Return(run) + return _c } // GetOwnerReference provides a mock function with given fields: func (_m *ExecutionContext) GetOwnerReference() v1.OwnerReference { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetOwnerReference") + } + var r0 v1.OwnerReference if rf, ok := ret.Get(0).(func() v1.OwnerReference); ok { r0 = rf() @@ -570,28 +818,41 @@ func (_m *ExecutionContext) GetOwnerReference() v1.OwnerReference { return r0 } -type ExecutionContext_GetParentInfo struct { +// ExecutionContext_GetOwnerReference_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetOwnerReference' +type ExecutionContext_GetOwnerReference_Call struct { *mock.Call } -func (_m ExecutionContext_GetParentInfo) Return(_a0 executors.ImmutableParentInfo) *ExecutionContext_GetParentInfo { - return &ExecutionContext_GetParentInfo{Call: _m.Call.Return(_a0)} +// GetOwnerReference is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) GetOwnerReference() *ExecutionContext_GetOwnerReference_Call { + return &ExecutionContext_GetOwnerReference_Call{Call: _e.mock.On("GetOwnerReference")} } -func (_m *ExecutionContext) OnGetParentInfo() *ExecutionContext_GetParentInfo { - c_call := _m.On("GetParentInfo") - return &ExecutionContext_GetParentInfo{Call: c_call} +func (_c *ExecutionContext_GetOwnerReference_Call) Run(run func()) *ExecutionContext_GetOwnerReference_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnGetParentInfoMatch(matchers ...interface{}) *ExecutionContext_GetParentInfo { - c_call := _m.On("GetParentInfo", matchers...) - return &ExecutionContext_GetParentInfo{Call: c_call} +func (_c *ExecutionContext_GetOwnerReference_Call) Return(_a0 v1.OwnerReference) *ExecutionContext_GetOwnerReference_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ExecutionContext_GetOwnerReference_Call) RunAndReturn(run func() v1.OwnerReference) *ExecutionContext_GetOwnerReference_Call { + _c.Call.Return(run) + return _c } // GetParentInfo provides a mock function with given fields: func (_m *ExecutionContext) GetParentInfo() executors.ImmutableParentInfo { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetParentInfo") + } + var r0 executors.ImmutableParentInfo if rf, ok := ret.Get(0).(func() executors.ImmutableParentInfo); ok { r0 = rf() @@ -604,28 +865,41 @@ func (_m *ExecutionContext) GetParentInfo() executors.ImmutableParentInfo { return r0 } -type ExecutionContext_GetRawOutputDataConfig struct { +// ExecutionContext_GetParentInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetParentInfo' +type ExecutionContext_GetParentInfo_Call struct { *mock.Call } -func (_m ExecutionContext_GetRawOutputDataConfig) Return(_a0 v1alpha1.RawOutputDataConfig) *ExecutionContext_GetRawOutputDataConfig { - return &ExecutionContext_GetRawOutputDataConfig{Call: _m.Call.Return(_a0)} +// GetParentInfo is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) GetParentInfo() *ExecutionContext_GetParentInfo_Call { + return &ExecutionContext_GetParentInfo_Call{Call: _e.mock.On("GetParentInfo")} +} + +func (_c *ExecutionContext_GetParentInfo_Call) Run(run func()) *ExecutionContext_GetParentInfo_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnGetRawOutputDataConfig() *ExecutionContext_GetRawOutputDataConfig { - c_call := _m.On("GetRawOutputDataConfig") - return &ExecutionContext_GetRawOutputDataConfig{Call: c_call} +func (_c *ExecutionContext_GetParentInfo_Call) Return(_a0 executors.ImmutableParentInfo) *ExecutionContext_GetParentInfo_Call { + _c.Call.Return(_a0) + return _c } -func (_m *ExecutionContext) OnGetRawOutputDataConfigMatch(matchers ...interface{}) *ExecutionContext_GetRawOutputDataConfig { - c_call := _m.On("GetRawOutputDataConfig", matchers...) - return &ExecutionContext_GetRawOutputDataConfig{Call: c_call} +func (_c *ExecutionContext_GetParentInfo_Call) RunAndReturn(run func() executors.ImmutableParentInfo) *ExecutionContext_GetParentInfo_Call { + _c.Call.Return(run) + return _c } // GetRawOutputDataConfig provides a mock function with given fields: func (_m *ExecutionContext) GetRawOutputDataConfig() v1alpha1.RawOutputDataConfig { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetRawOutputDataConfig") + } + var r0 v1alpha1.RawOutputDataConfig if rf, ok := ret.Get(0).(func() v1alpha1.RawOutputDataConfig); ok { r0 = rf() @@ -636,28 +910,41 @@ func (_m *ExecutionContext) GetRawOutputDataConfig() v1alpha1.RawOutputDataConfi return r0 } -type ExecutionContext_GetSecurityContext struct { +// ExecutionContext_GetRawOutputDataConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRawOutputDataConfig' +type ExecutionContext_GetRawOutputDataConfig_Call struct { *mock.Call } -func (_m ExecutionContext_GetSecurityContext) Return(_a0 core.SecurityContext) *ExecutionContext_GetSecurityContext { - return &ExecutionContext_GetSecurityContext{Call: _m.Call.Return(_a0)} +// GetRawOutputDataConfig is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) GetRawOutputDataConfig() *ExecutionContext_GetRawOutputDataConfig_Call { + return &ExecutionContext_GetRawOutputDataConfig_Call{Call: _e.mock.On("GetRawOutputDataConfig")} } -func (_m *ExecutionContext) OnGetSecurityContext() *ExecutionContext_GetSecurityContext { - c_call := _m.On("GetSecurityContext") - return &ExecutionContext_GetSecurityContext{Call: c_call} +func (_c *ExecutionContext_GetRawOutputDataConfig_Call) Run(run func()) *ExecutionContext_GetRawOutputDataConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnGetSecurityContextMatch(matchers ...interface{}) *ExecutionContext_GetSecurityContext { - c_call := _m.On("GetSecurityContext", matchers...) - return &ExecutionContext_GetSecurityContext{Call: c_call} +func (_c *ExecutionContext_GetRawOutputDataConfig_Call) Return(_a0 v1alpha1.RawOutputDataConfig) *ExecutionContext_GetRawOutputDataConfig_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ExecutionContext_GetRawOutputDataConfig_Call) RunAndReturn(run func() v1alpha1.RawOutputDataConfig) *ExecutionContext_GetRawOutputDataConfig_Call { + _c.Call.Return(run) + return _c } // GetSecurityContext provides a mock function with given fields: func (_m *ExecutionContext) GetSecurityContext() core.SecurityContext { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetSecurityContext") + } + var r0 core.SecurityContext if rf, ok := ret.Get(0).(func() core.SecurityContext); ok { r0 = rf() @@ -668,28 +955,41 @@ func (_m *ExecutionContext) GetSecurityContext() core.SecurityContext { return r0 } -type ExecutionContext_GetServiceAccountName struct { +// ExecutionContext_GetSecurityContext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSecurityContext' +type ExecutionContext_GetSecurityContext_Call struct { *mock.Call } -func (_m ExecutionContext_GetServiceAccountName) Return(_a0 string) *ExecutionContext_GetServiceAccountName { - return &ExecutionContext_GetServiceAccountName{Call: _m.Call.Return(_a0)} +// GetSecurityContext is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) GetSecurityContext() *ExecutionContext_GetSecurityContext_Call { + return &ExecutionContext_GetSecurityContext_Call{Call: _e.mock.On("GetSecurityContext")} } -func (_m *ExecutionContext) OnGetServiceAccountName() *ExecutionContext_GetServiceAccountName { - c_call := _m.On("GetServiceAccountName") - return &ExecutionContext_GetServiceAccountName{Call: c_call} +func (_c *ExecutionContext_GetSecurityContext_Call) Run(run func()) *ExecutionContext_GetSecurityContext_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnGetServiceAccountNameMatch(matchers ...interface{}) *ExecutionContext_GetServiceAccountName { - c_call := _m.On("GetServiceAccountName", matchers...) - return &ExecutionContext_GetServiceAccountName{Call: c_call} +func (_c *ExecutionContext_GetSecurityContext_Call) Return(_a0 core.SecurityContext) *ExecutionContext_GetSecurityContext_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ExecutionContext_GetSecurityContext_Call) RunAndReturn(run func() core.SecurityContext) *ExecutionContext_GetSecurityContext_Call { + _c.Call.Return(run) + return _c } // GetServiceAccountName provides a mock function with given fields: func (_m *ExecutionContext) GetServiceAccountName() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetServiceAccountName") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -700,29 +1000,46 @@ func (_m *ExecutionContext) GetServiceAccountName() string { return r0 } -type ExecutionContext_GetTask struct { +// ExecutionContext_GetServiceAccountName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetServiceAccountName' +type ExecutionContext_GetServiceAccountName_Call struct { *mock.Call } -func (_m ExecutionContext_GetTask) Return(_a0 v1alpha1.ExecutableTask, _a1 error) *ExecutionContext_GetTask { - return &ExecutionContext_GetTask{Call: _m.Call.Return(_a0, _a1)} +// GetServiceAccountName is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) GetServiceAccountName() *ExecutionContext_GetServiceAccountName_Call { + return &ExecutionContext_GetServiceAccountName_Call{Call: _e.mock.On("GetServiceAccountName")} } -func (_m *ExecutionContext) OnGetTask(id string) *ExecutionContext_GetTask { - c_call := _m.On("GetTask", id) - return &ExecutionContext_GetTask{Call: c_call} +func (_c *ExecutionContext_GetServiceAccountName_Call) Run(run func()) *ExecutionContext_GetServiceAccountName_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnGetTaskMatch(matchers ...interface{}) *ExecutionContext_GetTask { - c_call := _m.On("GetTask", matchers...) - return &ExecutionContext_GetTask{Call: c_call} +func (_c *ExecutionContext_GetServiceAccountName_Call) Return(_a0 string) *ExecutionContext_GetServiceAccountName_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ExecutionContext_GetServiceAccountName_Call) RunAndReturn(run func() string) *ExecutionContext_GetServiceAccountName_Call { + _c.Call.Return(run) + return _c } // GetTask provides a mock function with given fields: id func (_m *ExecutionContext) GetTask(id string) (v1alpha1.ExecutableTask, error) { ret := _m.Called(id) + if len(ret) == 0 { + panic("no return value specified for GetTask") + } + var r0 v1alpha1.ExecutableTask + var r1 error + if rf, ok := ret.Get(0).(func(string) (v1alpha1.ExecutableTask, error)); ok { + return rf(id) + } if rf, ok := ret.Get(0).(func(string) v1alpha1.ExecutableTask); ok { r0 = rf(id) } else { @@ -731,7 +1048,6 @@ func (_m *ExecutionContext) GetTask(id string) (v1alpha1.ExecutableTask, error) } } - var r1 error if rf, ok := ret.Get(1).(func(string) error); ok { r1 = rf(id) } else { @@ -741,28 +1057,42 @@ func (_m *ExecutionContext) GetTask(id string) (v1alpha1.ExecutableTask, error) return r0, r1 } -type ExecutionContext_IncrementNodeExecutionCount struct { +// ExecutionContext_GetTask_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTask' +type ExecutionContext_GetTask_Call struct { *mock.Call } -func (_m ExecutionContext_IncrementNodeExecutionCount) Return(_a0 uint32) *ExecutionContext_IncrementNodeExecutionCount { - return &ExecutionContext_IncrementNodeExecutionCount{Call: _m.Call.Return(_a0)} +// GetTask is a helper method to define mock.On call +// - id string +func (_e *ExecutionContext_Expecter) GetTask(id interface{}) *ExecutionContext_GetTask_Call { + return &ExecutionContext_GetTask_Call{Call: _e.mock.On("GetTask", id)} +} + +func (_c *ExecutionContext_GetTask_Call) Run(run func(id string)) *ExecutionContext_GetTask_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c } -func (_m *ExecutionContext) OnIncrementNodeExecutionCount() *ExecutionContext_IncrementNodeExecutionCount { - c_call := _m.On("IncrementNodeExecutionCount") - return &ExecutionContext_IncrementNodeExecutionCount{Call: c_call} +func (_c *ExecutionContext_GetTask_Call) Return(_a0 v1alpha1.ExecutableTask, _a1 error) *ExecutionContext_GetTask_Call { + _c.Call.Return(_a0, _a1) + return _c } -func (_m *ExecutionContext) OnIncrementNodeExecutionCountMatch(matchers ...interface{}) *ExecutionContext_IncrementNodeExecutionCount { - c_call := _m.On("IncrementNodeExecutionCount", matchers...) - return &ExecutionContext_IncrementNodeExecutionCount{Call: c_call} +func (_c *ExecutionContext_GetTask_Call) RunAndReturn(run func(string) (v1alpha1.ExecutableTask, error)) *ExecutionContext_GetTask_Call { + _c.Call.Return(run) + return _c } // IncrementNodeExecutionCount provides a mock function with given fields: func (_m *ExecutionContext) IncrementNodeExecutionCount() uint32 { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for IncrementNodeExecutionCount") + } + var r0 uint32 if rf, ok := ret.Get(0).(func() uint32); ok { r0 = rf() @@ -773,28 +1103,41 @@ func (_m *ExecutionContext) IncrementNodeExecutionCount() uint32 { return r0 } -type ExecutionContext_IncrementParallelism struct { +// ExecutionContext_IncrementNodeExecutionCount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IncrementNodeExecutionCount' +type ExecutionContext_IncrementNodeExecutionCount_Call struct { *mock.Call } -func (_m ExecutionContext_IncrementParallelism) Return(_a0 uint32) *ExecutionContext_IncrementParallelism { - return &ExecutionContext_IncrementParallelism{Call: _m.Call.Return(_a0)} +// IncrementNodeExecutionCount is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) IncrementNodeExecutionCount() *ExecutionContext_IncrementNodeExecutionCount_Call { + return &ExecutionContext_IncrementNodeExecutionCount_Call{Call: _e.mock.On("IncrementNodeExecutionCount")} } -func (_m *ExecutionContext) OnIncrementParallelism() *ExecutionContext_IncrementParallelism { - c_call := _m.On("IncrementParallelism") - return &ExecutionContext_IncrementParallelism{Call: c_call} +func (_c *ExecutionContext_IncrementNodeExecutionCount_Call) Run(run func()) *ExecutionContext_IncrementNodeExecutionCount_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnIncrementParallelismMatch(matchers ...interface{}) *ExecutionContext_IncrementParallelism { - c_call := _m.On("IncrementParallelism", matchers...) - return &ExecutionContext_IncrementParallelism{Call: c_call} +func (_c *ExecutionContext_IncrementNodeExecutionCount_Call) Return(_a0 uint32) *ExecutionContext_IncrementNodeExecutionCount_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ExecutionContext_IncrementNodeExecutionCount_Call) RunAndReturn(run func() uint32) *ExecutionContext_IncrementNodeExecutionCount_Call { + _c.Call.Return(run) + return _c } // IncrementParallelism provides a mock function with given fields: func (_m *ExecutionContext) IncrementParallelism() uint32 { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for IncrementParallelism") + } + var r0 uint32 if rf, ok := ret.Get(0).(func() uint32); ok { r0 = rf() @@ -805,28 +1148,41 @@ func (_m *ExecutionContext) IncrementParallelism() uint32 { return r0 } -type ExecutionContext_IncrementTaskExecutionCount struct { +// ExecutionContext_IncrementParallelism_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IncrementParallelism' +type ExecutionContext_IncrementParallelism_Call struct { *mock.Call } -func (_m ExecutionContext_IncrementTaskExecutionCount) Return(_a0 uint32) *ExecutionContext_IncrementTaskExecutionCount { - return &ExecutionContext_IncrementTaskExecutionCount{Call: _m.Call.Return(_a0)} +// IncrementParallelism is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) IncrementParallelism() *ExecutionContext_IncrementParallelism_Call { + return &ExecutionContext_IncrementParallelism_Call{Call: _e.mock.On("IncrementParallelism")} } -func (_m *ExecutionContext) OnIncrementTaskExecutionCount() *ExecutionContext_IncrementTaskExecutionCount { - c_call := _m.On("IncrementTaskExecutionCount") - return &ExecutionContext_IncrementTaskExecutionCount{Call: c_call} +func (_c *ExecutionContext_IncrementParallelism_Call) Run(run func()) *ExecutionContext_IncrementParallelism_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnIncrementTaskExecutionCountMatch(matchers ...interface{}) *ExecutionContext_IncrementTaskExecutionCount { - c_call := _m.On("IncrementTaskExecutionCount", matchers...) - return &ExecutionContext_IncrementTaskExecutionCount{Call: c_call} +func (_c *ExecutionContext_IncrementParallelism_Call) Return(_a0 uint32) *ExecutionContext_IncrementParallelism_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ExecutionContext_IncrementParallelism_Call) RunAndReturn(run func() uint32) *ExecutionContext_IncrementParallelism_Call { + _c.Call.Return(run) + return _c } // IncrementTaskExecutionCount provides a mock function with given fields: func (_m *ExecutionContext) IncrementTaskExecutionCount() uint32 { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for IncrementTaskExecutionCount") + } + var r0 uint32 if rf, ok := ret.Get(0).(func() uint32); ok { r0 = rf() @@ -837,28 +1193,41 @@ func (_m *ExecutionContext) IncrementTaskExecutionCount() uint32 { return r0 } -type ExecutionContext_IsInterruptible struct { +// ExecutionContext_IncrementTaskExecutionCount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IncrementTaskExecutionCount' +type ExecutionContext_IncrementTaskExecutionCount_Call struct { *mock.Call } -func (_m ExecutionContext_IsInterruptible) Return(_a0 bool) *ExecutionContext_IsInterruptible { - return &ExecutionContext_IsInterruptible{Call: _m.Call.Return(_a0)} +// IncrementTaskExecutionCount is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) IncrementTaskExecutionCount() *ExecutionContext_IncrementTaskExecutionCount_Call { + return &ExecutionContext_IncrementTaskExecutionCount_Call{Call: _e.mock.On("IncrementTaskExecutionCount")} } -func (_m *ExecutionContext) OnIsInterruptible() *ExecutionContext_IsInterruptible { - c_call := _m.On("IsInterruptible") - return &ExecutionContext_IsInterruptible{Call: c_call} +func (_c *ExecutionContext_IncrementTaskExecutionCount_Call) Run(run func()) *ExecutionContext_IncrementTaskExecutionCount_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c } -func (_m *ExecutionContext) OnIsInterruptibleMatch(matchers ...interface{}) *ExecutionContext_IsInterruptible { - c_call := _m.On("IsInterruptible", matchers...) - return &ExecutionContext_IsInterruptible{Call: c_call} +func (_c *ExecutionContext_IncrementTaskExecutionCount_Call) Return(_a0 uint32) *ExecutionContext_IncrementTaskExecutionCount_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ExecutionContext_IncrementTaskExecutionCount_Call) RunAndReturn(run func() uint32) *ExecutionContext_IncrementTaskExecutionCount_Call { + _c.Call.Return(run) + return _c } // IsInterruptible provides a mock function with given fields: func (_m *ExecutionContext) IsInterruptible() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for IsInterruptible") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -868,3 +1237,44 @@ func (_m *ExecutionContext) IsInterruptible() bool { return r0 } + +// ExecutionContext_IsInterruptible_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsInterruptible' +type ExecutionContext_IsInterruptible_Call struct { + *mock.Call +} + +// IsInterruptible is a helper method to define mock.On call +func (_e *ExecutionContext_Expecter) IsInterruptible() *ExecutionContext_IsInterruptible_Call { + return &ExecutionContext_IsInterruptible_Call{Call: _e.mock.On("IsInterruptible")} +} + +func (_c *ExecutionContext_IsInterruptible_Call) Run(run func()) *ExecutionContext_IsInterruptible_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ExecutionContext_IsInterruptible_Call) Return(_a0 bool) *ExecutionContext_IsInterruptible_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ExecutionContext_IsInterruptible_Call) RunAndReturn(run func() bool) *ExecutionContext_IsInterruptible_Call { + _c.Call.Return(run) + return _c +} + +// NewExecutionContext creates a new instance of ExecutionContext. 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 NewExecutionContext(t interface { + mock.TestingT + Cleanup(func()) +}) *ExecutionContext { + mock := &ExecutionContext{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/flytepropeller/pkg/controller/nodes/array/handler_test.go b/flytepropeller/pkg/controller/nodes/array/handler_test.go index ba0815fee6..e906318975 100644 --- a/flytepropeller/pkg/controller/nodes/array/handler_test.go +++ b/flytepropeller/pkg/controller/nodes/array/handler_test.go @@ -91,11 +91,11 @@ func createNodeExecutionContext(dataStore *storage.DataStore, eventRecorder inte // ExecutionContext executionContext := &execmocks.ExecutionContext{} - executionContext.OnGetEventVersion().Return(1) - executionContext.OnGetExecutionConfig().Return(v1alpha1.ExecutionConfig{ + executionContext.EXPECT().GetEventVersion().Return(1) + executionContext.EXPECT().GetExecutionConfig().Return(v1alpha1.ExecutionConfig{ MaxParallelism: maxParallelism, }) - executionContext.OnGetExecutionID().Return( + executionContext.EXPECT().GetExecutionID().Return( v1alpha1.ExecutionID{ WorkflowExecutionIdentifier: &idlcore.WorkflowExecutionIdentifier{ Project: "project", @@ -103,15 +103,15 @@ func createNodeExecutionContext(dataStore *storage.DataStore, eventRecorder inte Name: "name", }, }) - executionContext.OnGetLabels().Return(nil) - executionContext.OnGetRawOutputDataConfig().Return(v1alpha1.RawOutputDataConfig{}) - executionContext.OnIsInterruptible().Return(false) - executionContext.OnGetParentInfo().Return(nil) + executionContext.EXPECT().GetLabels().Return(nil) + executionContext.EXPECT().GetRawOutputDataConfig().Return(v1alpha1.RawOutputDataConfig{}) + executionContext.EXPECT().IsInterruptible().Return(false) + executionContext.EXPECT().GetParentInfo().Return(nil) outputVariableMap := make(map[string]*idlcore.Variable) for _, outputVariable := range outputVariables { outputVariableMap[outputVariable] = &idlcore.Variable{} } - executionContext.OnGetTaskMatch(taskRef).Return( + executionContext.EXPECT().GetTask(taskRef).Return( &v1alpha1.TaskSpec{ TaskTemplate: &idlcore.TaskTemplate{ Interface: &idlcore.TypedInterface{ @@ -123,12 +123,12 @@ func createNodeExecutionContext(dataStore *storage.DataStore, eventRecorder inte }, nil, ) - executionContext.OnCurrentParallelism().Return(currentParallelism) + executionContext.EXPECT().CurrentParallelism().Return(currentParallelism) executionContext.On("IncrementParallelism").Run(func(args mock.Arguments) {}).Return(currentParallelism) - executionContext.OnIncrementNodeExecutionCount().Return(1) - executionContext.OnIncrementTaskExecutionCount().Return(1) - executionContext.OnCurrentNodeExecutionCount().Return(1) - executionContext.OnCurrentTaskExecutionCount().Return(1) + executionContext.EXPECT().IncrementNodeExecutionCount().Return(1) + executionContext.EXPECT().IncrementTaskExecutionCount().Return(1) + executionContext.EXPECT().CurrentNodeExecutionCount().Return(1) + executionContext.EXPECT().CurrentTaskExecutionCount().Return(1) nCtx.OnExecutionContext().Return(executionContext) // EventsRecorder diff --git a/flytepropeller/pkg/controller/nodes/branch/handler_test.go b/flytepropeller/pkg/controller/nodes/branch/handler_test.go index dfe0338fc1..b26dd004c4 100644 --- a/flytepropeller/pkg/controller/nodes/branch/handler_test.go +++ b/flytepropeller/pkg/controller/nodes/branch/handler_test.go @@ -181,7 +181,7 @@ func TestBranchHandler_RecurseDownstream(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { eCtx := &execMocks.ExecutionContext{} - eCtx.OnGetParentInfo().Return(parentInfo{}) + eCtx.EXPECT().GetParentInfo().Return(parentInfo{}) mockNodeLookup := &execMocks.NodeLookup{} if len(test.upstreamNodeID) > 0 { @@ -305,7 +305,7 @@ func TestBranchHandler_AbortNode(t *testing.T) { mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(fmt.Errorf("err")) eCtx := &execMocks.ExecutionContext{} - eCtx.OnGetParentInfo().Return(nil) + eCtx.EXPECT().GetParentInfo().Return(nil) nCtx, _ := createNodeContext(v1alpha1.BranchNodeError, nil, n, nil, nil, eCtx) branch := New(mockNodeExecutor, eventConfig, promutils.NewTestScope()) err := branch.Abort(ctx, nCtx, "") @@ -317,7 +317,7 @@ func TestBranchHandler_AbortNode(t *testing.T) { mockNodeLookup := &execMocks.NodeLookup{} mockNodeLookup.OnToNodeMatch(mock.Anything).Return(nil, nil) eCtx := &execMocks.ExecutionContext{} - eCtx.OnGetParentInfo().Return(parentInfo{}) + eCtx.EXPECT().GetParentInfo().Return(parentInfo{}) nCtx, s := createNodeContext(v1alpha1.BranchNodeSuccess, &n1, n, nil, mockNodeLookup, eCtx) newParentInfo, _ := common.CreateParentInfo(parentInfo{}, nCtx.NodeID(), nCtx.CurrentAttempt()) expectedExecContext := executors.NewExecutionContextWithParentInfo(nCtx.ExecutionContext(), newParentInfo) @@ -378,7 +378,7 @@ func TestBranchHandler_HandleNode(t *testing.T) { n.OnGetBranchNode().Return(nil) n.OnGetID().Return("n1") eCtx := &execMocks.ExecutionContext{} - eCtx.OnGetParentInfo().Return(nil) + eCtx.EXPECT().GetParentInfo().Return(nil) nCtx, _ := createNodeContext(v1alpha1.BranchNodeSuccess, &childNodeID, n, inputs, nil, eCtx) s, err := branch.Handle(ctx, nCtx) diff --git a/flytepropeller/pkg/controller/nodes/cache_test.go b/flytepropeller/pkg/controller/nodes/cache_test.go index 1f2c615af2..05d6ecfeaa 100644 --- a/flytepropeller/pkg/controller/nodes/cache_test.go +++ b/flytepropeller/pkg/controller/nodes/cache_test.go @@ -61,8 +61,8 @@ func setupCacheableNodeExecutionContext(dataStore *storage.DataStore, taskTempla mockParentInfo.OnGetUniqueIDMatch().Return(uniqueID) mockExecutionContext := &executorsmocks.ExecutionContext{} - mockExecutionContext.OnGetParentInfoMatch(mock.Anything).Return(mockParentInfo) - mockExecutionContext.OnGetExecutionConfigMatch().Return(v1alpha1.ExecutionConfig{}) + mockExecutionContext.EXPECT().GetParentInfo().Return(mockParentInfo) + mockExecutionContext.EXPECT().GetExecutionConfig().Return(v1alpha1.ExecutionConfig{}) mockNodeExecutionMetadata := &interfacesmocks.NodeExecutionMetadata{} mockNodeExecutionMetadata.OnGetOwnerID().Return( @@ -75,6 +75,7 @@ func setupCacheableNodeExecutionContext(dataStore *storage.DataStore, taskTempla NodeId: nodeID, }, ) + mockNodeExecutionMetadata.OnGetConsoleURL().Return("") var taskReader interfaces.TaskReader if taskTemplate != nil { diff --git a/flytepropeller/pkg/controller/nodes/dynamic/dynamic_workflow_test.go b/flytepropeller/pkg/controller/nodes/dynamic/dynamic_workflow_test.go index 389ea0439b..526f41977a 100644 --- a/flytepropeller/pkg/controller/nodes/dynamic/dynamic_workflow_test.go +++ b/flytepropeller/pkg/controller/nodes/dynamic/dynamic_workflow_test.go @@ -193,8 +193,8 @@ func Test_dynamicNodeHandler_buildContextualDynamicWorkflow_withLaunchPlans(t *t immutableParentInfo := mocks4.ImmutableParentInfo{} immutableParentInfo.OnGetUniqueID().Return("c1") immutableParentInfo.OnCurrentAttempt().Return(uint32(2)) - execContext.OnGetParentInfo().Return(&immutableParentInfo) - execContext.OnGetEventVersion().Return(v1alpha1.EventVersion1) + execContext.EXPECT().GetParentInfo().Return(&immutableParentInfo) + execContext.EXPECT().GetEventVersion().Return(v1alpha1.EventVersion1) nCtx.OnExecutionContext().Return(execContext) dCtx, err := d.buildContextualDynamicWorkflow(ctx, nCtx) @@ -262,8 +262,8 @@ func Test_dynamicNodeHandler_buildContextualDynamicWorkflow_withLaunchPlans(t *t } execContext := &mocks4.ExecutionContext{} - execContext.OnGetParentInfo().Return(nil) - execContext.OnGetEventVersion().Return(v1alpha1.EventVersion0) + execContext.EXPECT().GetParentInfo().Return(nil) + execContext.EXPECT().GetEventVersion().Return(v1alpha1.EventVersion0) nCtx.OnExecutionContext().Return(execContext) dCtx, err := d.buildContextualDynamicWorkflow(ctx, nCtx) @@ -330,8 +330,8 @@ func Test_dynamicNodeHandler_buildContextualDynamicWorkflow_withLaunchPlans(t *t metrics: newMetrics(promutils.NewTestScope()), } execContext := &mocks4.ExecutionContext{} - execContext.OnGetParentInfo().Return(nil) - execContext.OnGetEventVersion().Return(v1alpha1.EventVersion0) + execContext.EXPECT().GetParentInfo().Return(nil) + execContext.EXPECT().GetEventVersion().Return(v1alpha1.EventVersion0) nCtx.OnExecutionContext().Return(execContext) _, err = d.buildContextualDynamicWorkflow(ctx, nCtx) @@ -417,8 +417,8 @@ func Test_dynamicNodeHandler_buildContextualDynamicWorkflow_withLaunchPlans(t *t immutableParentInfo := mocks4.ImmutableParentInfo{} immutableParentInfo.OnGetUniqueID().Return("c1") immutableParentInfo.OnCurrentAttempt().Return(uint32(2)) - execContext.OnGetParentInfo().Return(&immutableParentInfo) - execContext.OnGetEventVersion().Return(v1alpha1.EventVersion1) + execContext.EXPECT().GetParentInfo().Return(&immutableParentInfo) + execContext.EXPECT().GetEventVersion().Return(v1alpha1.EventVersion1) nCtx.OnExecutionContext().Return(execContext) dCtx, err := d.buildContextualDynamicWorkflow(ctx, nCtx) @@ -471,8 +471,8 @@ func Test_dynamicNodeHandler_buildContextualDynamicWorkflow_withLaunchPlans(t *t immutableParentInfo := mocks4.ImmutableParentInfo{} immutableParentInfo.OnGetUniqueID().Return("c1") immutableParentInfo.OnCurrentAttempt().Return(uint32(2)) - execContext.OnGetParentInfo().Return(&immutableParentInfo) - execContext.OnGetEventVersion().Return(v1alpha1.EventVersion1) + execContext.EXPECT().GetParentInfo().Return(&immutableParentInfo) + execContext.EXPECT().GetEventVersion().Return(v1alpha1.EventVersion1) nCtx.OnExecutionContext().Return(execContext) _, err := d.buildContextualDynamicWorkflow(ctx, nCtx) @@ -560,9 +560,9 @@ func Test_dynamicNodeHandler_buildContextualDynamicWorkflow_withLaunchPlans(t *t immutableParentInfo := mocks4.ImmutableParentInfo{} immutableParentInfo.OnGetUniqueID().Return("c1") immutableParentInfo.OnCurrentAttempt().Return(uint32(2)) - execContext.OnGetParentInfo().Return(&immutableParentInfo) - execContext.OnGetEventVersion().Return(v1alpha1.EventVersion1) - execContext.OnGetExecutionConfig().Return(v1alpha1.ExecutionConfig{ + execContext.EXPECT().GetParentInfo().Return(&immutableParentInfo) + execContext.EXPECT().GetEventVersion().Return(v1alpha1.EventVersion1) + execContext.EXPECT().GetExecutionConfig().Return(v1alpha1.ExecutionConfig{ RecoveryExecution: v1alpha1.WorkflowExecutionIdentifier{}, }) nCtx.OnExecutionContext().Return(execContext) diff --git a/flytepropeller/pkg/controller/nodes/dynamic/handler_test.go b/flytepropeller/pkg/controller/nodes/dynamic/handler_test.go index bab7b48f1b..16acd4b699 100644 --- a/flytepropeller/pkg/controller/nodes/dynamic/handler_test.go +++ b/flytepropeller/pkg/controller/nodes/dynamic/handler_test.go @@ -576,12 +576,12 @@ func Test_dynamicNodeHandler_Handle_SubTaskV1(t *testing.T) { assert.NoError(t, nCtx.DataStore().WriteProtobuf(context.TODO(), endF, storage.Options{}, &core.LiteralMap{})) } execContext := executorMocks.ExecutionContext{} - execContext.OnGetEventVersion().Return(v1alpha1.EventVersion1) + execContext.EXPECT().GetEventVersion().Return(v1alpha1.EventVersion1) immutableParentInfo := executorMocks.ImmutableParentInfo{} immutableParentInfo.OnGetUniqueID().Return("c1") immutableParentInfo.OnCurrentAttempt().Return(uint32(2)) - execContext.OnGetParentInfo().Return(&immutableParentInfo) - execContext.OnGetExecutionConfig().Return(v1alpha1.ExecutionConfig{}) + execContext.EXPECT().GetParentInfo().Return(&immutableParentInfo) + execContext.EXPECT().GetExecutionConfig().Return(v1alpha1.ExecutionConfig{}) nCtx.OnExecutionContext().Return(&execContext) d := New(h, n, mockLPLauncher, eventConfig, promutils.NewTestScope()) got, err := d.Handle(context.TODO(), nCtx) @@ -766,9 +766,9 @@ func Test_dynamicNodeHandler_Handle_SubTask(t *testing.T) { assert.NoError(t, nCtx.DataStore().WriteProtobuf(context.TODO(), endF, storage.Options{}, &core.LiteralMap{})) } execContext := executorMocks.ExecutionContext{} - execContext.OnGetEventVersion().Return(v1alpha1.EventVersion0) - execContext.OnGetParentInfo().Return(nil) - execContext.OnGetExecutionConfig().Return(v1alpha1.ExecutionConfig{}) + execContext.EXPECT().GetEventVersion().Return(v1alpha1.EventVersion0) + execContext.EXPECT().GetParentInfo().Return(nil) + execContext.EXPECT().GetExecutionConfig().Return(v1alpha1.ExecutionConfig{}) nCtx.OnExecutionContext().Return(&execContext) d := New(h, n, mockLPLauncher, eventConfig, promutils.NewTestScope()) got, err := d.Handle(context.TODO(), nCtx) @@ -913,8 +913,8 @@ func TestDynamicNodeTaskNodeHandler_Finalize(t *testing.T) { nCtx.OnEnqueueOwnerFunc().Return(func() error { return nil }) nCtx.OnDataStore().Return(dataStore) execContext := executorMocks.ExecutionContext{} - execContext.OnGetEventVersion().Return(v1alpha1.EventVersion0) - execContext.OnGetParentInfo().Return(nil) + execContext.EXPECT().GetEventVersion().Return(v1alpha1.EventVersion0) + execContext.EXPECT().GetParentInfo().Return(nil) nCtx.OnExecutionContext().Return(&execContext) endNodeStatus := &flyteMocks.ExecutableNodeStatus{} diff --git a/flytepropeller/pkg/controller/nodes/executor_test.go b/flytepropeller/pkg/controller/nodes/executor_test.go index 227f3e5f1b..194458d2b8 100644 --- a/flytepropeller/pkg/controller/nodes/executor_test.go +++ b/flytepropeller/pkg/controller/nodes/executor_test.go @@ -1299,18 +1299,20 @@ func TestNodeExecutor_RecursiveNodeHandler_BranchNode(t *testing.T) { tid := "tid" eCtx := &mocks4.ExecutionContext{} - eCtx.OnGetTask(tid).Return(tk, nil) - eCtx.OnIsInterruptible().Return(true) - eCtx.OnGetExecutionID().Return(v1alpha1.WorkflowExecutionIdentifier{WorkflowExecutionIdentifier: &core.WorkflowExecutionIdentifier{}}) - eCtx.OnGetLabels().Return(nil) - eCtx.OnGetEventVersion().Return(v1alpha1.EventVersion0) - eCtx.OnGetParentInfo().Return(nil) - eCtx.OnGetRawOutputDataConfig().Return(v1alpha1.RawOutputDataConfig{ + eCtx.EXPECT().GetTask(tid).Return(tk, nil) + + eCtx.EXPECT().IsInterruptible().Return(true) + eCtx.EXPECT().GetExecutionID().Return(v1alpha1.WorkflowExecutionIdentifier{WorkflowExecutionIdentifier: &core.WorkflowExecutionIdentifier{}}) + eCtx.EXPECT().GetLabels().Return(nil) + eCtx.EXPECT().GetEventVersion().Return(v1alpha1.EventVersion0) + eCtx.EXPECT().GetParentInfo().Return(nil) + eCtx.EXPECT().GetRawOutputDataConfig().Return(v1alpha1.RawOutputDataConfig{ RawOutputDataConfig: &admin.RawOutputDataConfig{OutputLocationPrefix: ""}, }) - eCtx.OnIncrementParallelism().Return(0) - eCtx.OnCurrentParallelism().Return(0) - eCtx.OnGetExecutionConfig().Return(v1alpha1.ExecutionConfig{}) + eCtx.EXPECT().IncrementParallelism().Return(0) + eCtx.EXPECT().CurrentParallelism().Return(0) + eCtx.EXPECT().GetExecutionConfig().Return(v1alpha1.ExecutionConfig{}) + eCtx.EXPECT().GetConsoleURL().Return("") branchTakenNodeID := "branchTakenNode" branchTakenNode := &mocks.ExecutableNode{} @@ -1674,12 +1676,12 @@ func TestNodeExecutor_AbortHandler(t *testing.T) { dag.OnFromNode(id).Return(make([]string, 0), nil) execContext := mocks4.ExecutionContext{} - execContext.OnIsInterruptible().Return(false) + execContext.EXPECT().IsInterruptible().Return(false) r := v1alpha1.RawOutputDataConfig{} - execContext.OnGetRawOutputDataConfig().Return(r) - execContext.OnGetExecutionID().Return(v1alpha1.WorkflowExecutionIdentifier{}) - execContext.OnGetLabels().Return(nil) - execContext.OnGetEventVersion().Return(v1alpha1.EventVersion0) + execContext.EXPECT().GetRawOutputDataConfig().Return(r) + execContext.EXPECT().GetExecutionID().Return(v1alpha1.WorkflowExecutionIdentifier{}) + execContext.EXPECT().GetLabels().Return(nil) + execContext.EXPECT().GetEventVersion().Return(v1alpha1.EventVersion0) assert.NoError(t, nExec.AbortHandler(ctx, &execContext, &dag, nl, n, "aborting")) }) @@ -2040,12 +2042,12 @@ func TestRecover(t *testing.T) { } execContext := &mocks4.ExecutionContext{} - execContext.OnGetExecutionConfig().Return(v1alpha1.ExecutionConfig{ + execContext.EXPECT().GetExecutionConfig().Return(v1alpha1.ExecutionConfig{ RecoveryExecution: v1alpha1.WorkflowExecutionIdentifier{ WorkflowExecutionIdentifier: recoveryID, }, }) - execContext.OnGetEventVersion().Return(v1alpha1.EventVersion0) + execContext.EXPECT().GetEventVersion().Return(v1alpha1.EventVersion0) nm := &nodemocks.NodeExecutionMetadata{} nm.OnGetNodeExecutionID().Return(&core.NodeExecutionIdentifier{ @@ -2477,10 +2479,10 @@ func TestIsMaxParallelismAchieved(t *testing.T) { // Creates an execution context for the test createExecContext := func(maxParallelism, currentParallelism uint32) executors.ExecutionContext { m := &mocks4.ExecutionContext{} - m.OnGetExecutionConfig().Return(v1alpha1.ExecutionConfig{ + m.EXPECT().GetExecutionConfig().Return(v1alpha1.ExecutionConfig{ MaxParallelism: maxParallelism, }) - m.OnCurrentParallelism().Return(currentParallelism) + m.EXPECT().CurrentParallelism().Return(currentParallelism) return m } diff --git a/flytepropeller/pkg/controller/nodes/gate/handler_test.go b/flytepropeller/pkg/controller/nodes/gate/handler_test.go index 488cb58a07..d988e8cb74 100644 --- a/flytepropeller/pkg/controller/nodes/gate/handler_test.go +++ b/flytepropeller/pkg/controller/nodes/gate/handler_test.go @@ -106,7 +106,7 @@ func createNodeExecutionContext(gateNode *v1alpha1.GateNodeSpec) *nodeMocks.Node dataStore, _ := storage.NewDataStore(&storage.Config{Type: storage.TypeMemory}, promutils.NewTestScope()) eCtx := &executormocks.ExecutionContext{} - eCtx.OnGetExecutionID().Return(wfExecID) + eCtx.EXPECT().GetExecutionID().Return(wfExecID) nCtx := &nodeMocks.NodeExecutionContext{} nCtx.OnNodeExecutionMetadata().Return(nm) diff --git a/flytepropeller/pkg/controller/nodes/resolve_test.go b/flytepropeller/pkg/controller/nodes/resolve_test.go index 19a8be1e7d..10b9e4e45d 100644 --- a/flytepropeller/pkg/controller/nodes/resolve_test.go +++ b/flytepropeller/pkg/controller/nodes/resolve_test.go @@ -172,6 +172,8 @@ func (d *dummyBaseWorkflow) GetExecutionConfig() v1alpha1.ExecutionConfig { return v1alpha1.ExecutionConfig{} } +func (d *dummyBaseWorkflow) GetConsoleURL() string { return "" } + func createDummyBaseWorkflow(dataStore *storage.DataStore) *dummyBaseWorkflow { return &dummyBaseWorkflow{ ID: "w1", diff --git a/flytepropeller/pkg/controller/nodes/subworkflow/handler_test.go b/flytepropeller/pkg/controller/nodes/subworkflow/handler_test.go index c47c39cde8..cd67b96466 100644 --- a/flytepropeller/pkg/controller/nodes/subworkflow/handler_test.go +++ b/flytepropeller/pkg/controller/nodes/subworkflow/handler_test.go @@ -112,16 +112,16 @@ func createNodeContextWithVersion(phase v1alpha1.WorkflowNodePhase, n v1alpha1.E nCtx.OnNodeStateWriter().Return(state) ex := &execMocks.ExecutionContext{} - ex.OnGetEventVersion().Return(version) - ex.OnGetParentInfo().Return(nil) - ex.OnGetName().Return("name") - ex.OnGetExecutionConfig().Return(v1alpha1.ExecutionConfig{}) - ex.OnIncrementParallelism().Return(1) - ex.OnGetSecurityContext().Return(core.SecurityContext{}) - ex.OnGetAnnotations().Return(nil) - ex.OnGetLabels().Return(nil) - ex.OnGetRawOutputDataConfig().Return(v1alpha1.RawOutputDataConfig{}) - ex.OnGetDefinitionVersion().Return(v1alpha1.WorkflowDefinitionVersion1) + ex.EXPECT().GetEventVersion().Return(version) + ex.EXPECT().GetParentInfo().Return(nil) + ex.EXPECT().GetName().Return("name") + ex.EXPECT().GetExecutionConfig().Return(v1alpha1.ExecutionConfig{}) + ex.EXPECT().IncrementParallelism().Return(1) + ex.EXPECT().GetSecurityContext().Return(core.SecurityContext{}) + ex.EXPECT().GetAnnotations().Return(nil) + ex.EXPECT().GetLabels().Return(nil) + ex.EXPECT().GetRawOutputDataConfig().Return(v1alpha1.RawOutputDataConfig{}) + ex.EXPECT().GetDefinitionVersion().Return(v1alpha1.WorkflowDefinitionVersion1) nCtx.OnExecutionContext().Return(ex) @@ -329,9 +329,9 @@ func TestWorkflowNodeHandler_AbortNode(t *testing.T) { ).Return(nil) eCtx := &execMocks.ExecutionContext{} - eCtx.OnGetDefinitionVersion().Return(v1alpha1.WorkflowDefinitionVersion1) + eCtx.EXPECT().GetDefinitionVersion().Return(v1alpha1.WorkflowDefinitionVersion1) + eCtx.EXPECT().GetName().Return("test") nCtx.OnExecutionContext().Return(eCtx) - eCtx.OnGetName().Return("test") err := h.Abort(ctx, nCtx, "test") assert.NoError(t, err) }) @@ -351,9 +351,9 @@ func TestWorkflowNodeHandler_AbortNode(t *testing.T) { ).Return(nil) eCtx := &execMocks.ExecutionContext{} - eCtx.OnGetDefinitionVersion().Return(v1alpha1.WorkflowDefinitionVersion1) + eCtx.EXPECT().GetDefinitionVersion().Return(v1alpha1.WorkflowDefinitionVersion1) + eCtx.EXPECT().GetName().Return("test") nCtx.OnExecutionContext().Return(eCtx) - eCtx.OnGetName().Return("test") err := h.Abort(ctx, nCtx, "test") assert.NoError(t, err) }) @@ -372,9 +372,9 @@ func TestWorkflowNodeHandler_AbortNode(t *testing.T) { nCtx := createNodeContext(v1alpha1.WorkflowNodePhaseExecuting, mockNode, mockNodeStatus) eCtx := &execMocks.ExecutionContext{} - eCtx.OnGetDefinitionVersion().Return(v1alpha1.WorkflowDefinitionVersion1) + eCtx.EXPECT().GetDefinitionVersion().Return(v1alpha1.WorkflowDefinitionVersion1) + eCtx.EXPECT().GetName().Return("test") nCtx.OnExecutionContext().Return(eCtx) - eCtx.OnGetName().Return("test") err := h.Abort(ctx, nCtx, "test") assert.Error(t, err) diff --git a/flytepropeller/pkg/controller/nodes/subworkflow/launchplan_test.go b/flytepropeller/pkg/controller/nodes/subworkflow/launchplan_test.go index 2e042d72a4..96acf46d78 100644 --- a/flytepropeller/pkg/controller/nodes/subworkflow/launchplan_test.go +++ b/flytepropeller/pkg/controller/nodes/subworkflow/launchplan_test.go @@ -245,19 +245,19 @@ func TestSubWorkflowHandler_StartLaunchPlan(t *testing.T) { nCtx.OnNodeExecutionMetadata().Return(nm) ectx := &execMocks.ExecutionContext{} - ectx.OnGetDefinitionVersion().Return(v1alpha1.WorkflowDefinitionVersion1) - ectx.OnGetEventVersion().Return(1) - ectx.OnGetParentInfo().Return(nil) - ectx.OnGetExecutionConfig().Return(v1alpha1.ExecutionConfig{ + ectx.EXPECT().GetDefinitionVersion().Return(v1alpha1.WorkflowDefinitionVersion1) + ectx.EXPECT().GetEventVersion().Return(1) + ectx.EXPECT().GetParentInfo().Return(nil) + ectx.EXPECT().GetExecutionConfig().Return(v1alpha1.ExecutionConfig{ RecoveryExecution: v1alpha1.WorkflowExecutionIdentifier{ WorkflowExecutionIdentifier: recoveredExecID, }, }) - ectx.OnIncrementParallelism().Return(1) - ectx.OnGetSecurityContext().Return(core.SecurityContext{}) - ectx.OnGetRawOutputDataConfig().Return(v1alpha1.RawOutputDataConfig{}) - ectx.OnGetLabels().Return(nil) - ectx.OnGetAnnotations().Return(nil) + ectx.EXPECT().IncrementParallelism().Return(1) + ectx.EXPECT().GetSecurityContext().Return(core.SecurityContext{}) + ectx.EXPECT().GetRawOutputDataConfig().Return(v1alpha1.RawOutputDataConfig{}) + ectx.EXPECT().GetLabels().Return(nil) + ectx.EXPECT().GetAnnotations().Return(nil) nCtx.OnExecutionContext().Return(ectx) nCtx.OnCurrentAttempt().Return(uint32(1)) @@ -671,7 +671,7 @@ func TestLaunchPlanHandler_HandleAbort(t *testing.T) { } nCtx := createNodeContext(v1alpha1.WorkflowNodePhaseExecuting, mockNode, mockNodeStatus) eCtx := &execMocks.ExecutionContext{} - eCtx.OnGetName().Return("name") + eCtx.EXPECT().GetName().Return("name") nCtx.OnExecutionContext().Return(eCtx) err := h.HandleAbort(ctx, nCtx, "some reason") assert.NoError(t, err) diff --git a/flytepropeller/pkg/controller/nodes/subworkflow/subworkflow_test.go b/flytepropeller/pkg/controller/nodes/subworkflow/subworkflow_test.go index dc00efacdc..02de593463 100644 --- a/flytepropeller/pkg/controller/nodes/subworkflow/subworkflow_test.go +++ b/flytepropeller/pkg/controller/nodes/subworkflow/subworkflow_test.go @@ -30,7 +30,7 @@ func TestGetSubWorkflow(t *testing.T) { ectx := &execMocks.ExecutionContext{} swf := &coreMocks.ExecutableSubWorkflow{} - ectx.OnFindSubWorkflow("x").Return(swf) + ectx.EXPECT().FindSubWorkflow("x").Return(swf) nCtx := &mocks.NodeExecutionContext{} nCtx.OnNode().Return(node) @@ -60,7 +60,7 @@ func TestGetSubWorkflow(t *testing.T) { swf := &coreMocks.ExecutableSubWorkflow{} swf.OnGetOnFailureNode().Return(failureNode) - ectx.OnFindSubWorkflow("x").Return(swf) + ectx.EXPECT().FindSubWorkflow("x").Return(swf) nCtx := &mocks.NodeExecutionContext{} nCtx.OnNode().Return(node) @@ -82,7 +82,7 @@ func TestGetSubWorkflow(t *testing.T) { ectx := &execMocks.ExecutionContext{} - ectx.OnFindSubWorkflow("x").Return(nil) + ectx.EXPECT().FindSubWorkflow("x").Return(nil) nCtx := &mocks.NodeExecutionContext{} nCtx.OnNode().Return(node) @@ -107,7 +107,7 @@ func Test_subworkflowHandler_HandleAbort(t *testing.T) { swf := &coreMocks.ExecutableSubWorkflow{} ectx := &execMocks.ExecutionContext{} - ectx.OnFindSubWorkflow("x").Return(swf) + ectx.EXPECT().FindSubWorkflow("x").Return(swf) ns := &coreMocks.ExecutableNodeStatus{} nCtx := &mocks.NodeExecutionContext{} @@ -138,8 +138,8 @@ func Test_subworkflowHandler_HandleAbort(t *testing.T) { swf.OnStartNode().Return(&coreMocks.ExecutableNode{}) ectx := &execMocks.ExecutionContext{} - ectx.OnFindSubWorkflow("x").Return(swf) - ectx.OnGetParentInfo().Return(nil) + ectx.EXPECT().FindSubWorkflow("x").Return(swf) + ectx.EXPECT().GetParentInfo().Return(nil) ns := &coreMocks.ExecutableNodeStatus{} nCtx := &mocks.NodeExecutionContext{} @@ -172,8 +172,8 @@ func Test_subworkflowHandler_HandleAbort(t *testing.T) { swf.OnStartNode().Return(&coreMocks.ExecutableNode{}) ectx := &execMocks.ExecutionContext{} - ectx.OnFindSubWorkflow("x").Return(swf) - ectx.OnGetParentInfo().Return(nil) + ectx.EXPECT().FindSubWorkflow("x").Return(swf) + ectx.EXPECT().GetParentInfo().Return(nil) ns := &coreMocks.ExecutableNodeStatus{} nCtx := &mocks.NodeExecutionContext{} diff --git a/flytepropeller/pkg/controller/nodes/task/handler_test.go b/flytepropeller/pkg/controller/nodes/task/handler_test.go index f0e177838f..27e377236f 100644 --- a/flytepropeller/pkg/controller/nodes/task/handler_test.go +++ b/flytepropeller/pkg/controller/nodes/task/handler_test.go @@ -499,11 +499,11 @@ func Test_task_Handle_NoCatalog(t *testing.T) { nCtx.OnOutputShardSelector().Return(ioutils.NewConstantShardSelector([]string{"x"})) executionContext := &mocks.ExecutionContext{} - executionContext.OnGetExecutionConfig().Return(v1alpha1.ExecutionConfig{}) - executionContext.OnGetEventVersion().Return(v1alpha1.EventVersion0) - executionContext.OnGetParentInfo().Return(nil) + executionContext.EXPECT().GetExecutionConfig().Return(v1alpha1.ExecutionConfig{}) + executionContext.EXPECT().GetEventVersion().Return(v1alpha1.EventVersion0) + executionContext.EXPECT().GetParentInfo().Return(nil) if allowIncrementParallelism { - executionContext.OnIncrementParallelism().Return(1) + executionContext.EXPECT().IncrementParallelism().Return(1) } nCtx.OnExecutionContext().Return(executionContext) @@ -811,9 +811,9 @@ func Test_task_Abort(t *testing.T) { nCtx.OnEventsRecorder().Return(ev) executionContext := &mocks.ExecutionContext{} - executionContext.OnGetExecutionConfig().Return(v1alpha1.ExecutionConfig{}) - executionContext.OnGetParentInfo().Return(nil) - executionContext.OnGetEventVersion().Return(v1alpha1.EventVersion0) + executionContext.EXPECT().GetExecutionConfig().Return(v1alpha1.ExecutionConfig{}) + executionContext.EXPECT().GetParentInfo().Return(nil) + executionContext.EXPECT().GetEventVersion().Return(v1alpha1.EventVersion0) nCtx.OnExecutionContext().Return(executionContext) nCtx.OnRawOutputPrefix().Return("s3://sandbox/") @@ -972,9 +972,9 @@ func Test_task_Abort_v1(t *testing.T) { nCtx.OnEventsRecorder().Return(ev) executionContext := &mocks.ExecutionContext{} - executionContext.OnGetExecutionConfig().Return(v1alpha1.ExecutionConfig{}) - executionContext.OnGetParentInfo().Return(nil) - executionContext.OnGetEventVersion().Return(v1alpha1.EventVersion1) + executionContext.EXPECT().GetExecutionConfig().Return(v1alpha1.ExecutionConfig{}) + executionContext.EXPECT().GetParentInfo().Return(nil) + executionContext.EXPECT().GetEventVersion().Return(v1alpha1.EventVersion1) nCtx.OnExecutionContext().Return(executionContext) nCtx.OnRawOutputPrefix().Return("s3://sandbox/") @@ -1153,9 +1153,9 @@ func Test_task_Finalize(t *testing.T) { nCtx.OnEnqueueOwnerFunc().Return(nil) executionContext := &mocks.ExecutionContext{} - executionContext.OnGetExecutionConfig().Return(v1alpha1.ExecutionConfig{}) - executionContext.OnGetParentInfo().Return(nil) - executionContext.OnGetEventVersion().Return(v1alpha1.EventVersion0) + executionContext.EXPECT().GetExecutionConfig().Return(v1alpha1.ExecutionConfig{}) + executionContext.EXPECT().GetParentInfo().Return(nil) + executionContext.EXPECT().GetEventVersion().Return(v1alpha1.EventVersion0) nCtx.OnExecutionContext().Return(executionContext) nCtx.OnRawOutputPrefix().Return("s3://sandbox/") diff --git a/flytepropeller/pkg/controller/nodes/task/taskexec_context_test.go b/flytepropeller/pkg/controller/nodes/task/taskexec_context_test.go index e798f82a04..5f5f3d68c5 100644 --- a/flytepropeller/pkg/controller/nodes/task/taskexec_context_test.go +++ b/flytepropeller/pkg/controller/nodes/task/taskexec_context_test.go @@ -93,9 +93,9 @@ func dummyNodeExecutionContext(t *testing.T, parentInfo executors.ImmutableParen nCtx.OnEnqueueOwnerFunc().Return(nil) executionContext := &mocks2.ExecutionContext{} - executionContext.OnGetExecutionConfig().Return(v1alpha1.ExecutionConfig{}) - executionContext.OnGetParentInfo().Return(parentInfo) - executionContext.OnGetEventVersion().Return(eventVersion) + executionContext.EXPECT().GetExecutionConfig().Return(v1alpha1.ExecutionConfig{}) + executionContext.EXPECT().GetParentInfo().Return(parentInfo) + executionContext.EXPECT().GetEventVersion().Return(eventVersion) nCtx.OnExecutionContext().Return(executionContext) ds, err := storage.NewDataStore( diff --git a/flytepropeller/pkg/controller/nodes/task/transformer_test.go b/flytepropeller/pkg/controller/nodes/task/transformer_test.go index db89dda3e6..0fdab91907 100644 --- a/flytepropeller/pkg/controller/nodes/task/transformer_test.go +++ b/flytepropeller/pkg/controller/nodes/task/transformer_test.go @@ -60,8 +60,8 @@ func TestToTaskExecutionEvent(t *testing.T) { nodeExecutionMetadata.OnIsInterruptible().Return(true) mockExecContext := &mocks2.ExecutionContext{} - mockExecContext.OnGetEventVersion().Return(v1alpha1.EventVersion0) - mockExecContext.OnGetParentInfo().Return(nil) + mockExecContext.EXPECT().GetEventVersion().Return(v1alpha1.EventVersion0) + mockExecContext.EXPECT().GetParentInfo().Return(nil) tID := &pluginMocks.TaskExecutionID{} generatedName := "generated_name" @@ -252,11 +252,11 @@ func TestToTaskExecutionEventWithParent(t *testing.T) { nodeExecutionMetadata.OnIsInterruptible().Return(true) mockExecContext := &mocks2.ExecutionContext{} - mockExecContext.OnGetEventVersion().Return(v1alpha1.EventVersion1) + mockExecContext.EXPECT().GetEventVersion().Return(v1alpha1.EventVersion1) mockParentInfo := &mocks2.ImmutableParentInfo{} mockParentInfo.OnGetUniqueID().Return("np1") mockParentInfo.OnCurrentAttempt().Return(uint32(2)) - mockExecContext.OnGetParentInfo().Return(mockParentInfo) + mockExecContext.EXPECT().GetParentInfo().Return(mockParentInfo) tID := &pluginMocks.TaskExecutionID{} generatedName := "generated_name"