Skip to content

Commit

Permalink
lints and test
Browse files Browse the repository at this point in the history
Signed-off-by: Rafael Raposo <[email protected]>
  • Loading branch information
RRap0so committed Sep 30, 2024
1 parent 7f16fd2 commit a48ce4d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion flyteadmin/pkg/workflowengine/impl/k8s_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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,
Expand Down

0 comments on commit a48ce4d

Please sign in to comment.