From ea164b73ed519f4c9264ba3dd91dadcce50399ab Mon Sep 17 00:00:00 2001 From: Rafael Raposo Date: Mon, 30 Sep 2024 18:29:06 +0200 Subject: [PATCH] lints and test Signed-off-by: Rafael Raposo --- .../pkg/workflowengine/impl/k8s_executor_test.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/flyteadmin/pkg/workflowengine/impl/k8s_executor_test.go b/flyteadmin/pkg/workflowengine/impl/k8s_executor_test.go index 21846a7c4a..8017d1e473 100644 --- a/flyteadmin/pkg/workflowengine/impl/k8s_executor_test.go +++ b/flyteadmin/pkg/workflowengine/impl/k8s_executor_test.go @@ -315,6 +315,7 @@ func TestAbort(t *testing.T) { } func TestAbort_Notfound(t *testing.T) { + mockEventWriter := &eventMock.WorkflowExecutionEventWriter{} fakeFlyteWorkflow := FakeFlyteWorkflow{} fakeFlyteWorkflow.deleteCallback = func(name string, options *v1.DeleteOptions) error { return k8apierr.NewNotFound(schema.GroupResource{ @@ -327,8 +328,19 @@ func TestAbort_Notfound(t *testing.T) { return &fakeFlyteWorkflow } executor := K8sWorkflowExecutor{ - executionCluster: getFakeExecutionCluster(), + executionCluster: getFakeExecutionCluster(), + executionEventWriter: mockEventWriter, } + + mockEventWriter.On("Write", mock.MatchedBy(func(req *admin.WorkflowExecutionEventRequest) bool { + return req.Event.ExecutionId.Project == execID.Project && + req.Event.ExecutionId.Domain == execID.Domain && + req.Event.ExecutionId.Name == execID.Name && + req.Event.Phase == core.WorkflowExecution_ABORTED && + req.Event.ProducerId == "k8s_executor" && + req.Event.OutputResult.(*event.WorkflowExecutionEvent_Error).Error.Code == "ExecutionAborted" && + req.Event.OutputResult.(*event.WorkflowExecutionEvent_Error).Error.Message == "Execution aborted" + })).Return(nil) err := executor.Abort(context.TODO(), interfaces.AbortData{ Namespace: namespace, ExecutionID: execID,