Skip to content

Commit

Permalink
fix race condition
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Wu <[email protected]>
  • Loading branch information
popojk committed Feb 4, 2025
1 parent b12cfdc commit e3f200b
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions flyteadmin/pkg/manager/impl/execution_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2410,18 +2410,28 @@ func TestCreateWorkflowEvent_CurrentlyAborting(t *testing.T) {
assert.NotNil(t, resp)
assert.NoError(t, err)

mockDbEventWriter.On("Write", req)
req.Event.Phase = core.WorkflowExecution_QUEUED
req = &admin.WorkflowExecutionEventRequest{
RequestId: "1",
Event: &event.WorkflowExecutionEvent{
ExecutionId: &executionIdentifier,
Phase: core.WorkflowExecution_QUEUED,
OccurredAt: timestamppb.New(time.Now()),
},
}
resp, err = execManager.CreateWorkflowEvent(context.Background(), req)
assert.Nil(t, resp)
assert.NotNil(t, err)
adminError := err.(flyteAdminErrors.FlyteAdminError)
assert.Equal(t, adminError.Code(), codes.FailedPrecondition)

mockDbEventWriter = &eventWriterMocks.WorkflowExecutionEventWriter{}
mockDbEventWriter.On("Write", req)
execManager = NewExecutionManager(repository, r, getMockExecutionsConfigProvider(), getMockStorageForExecTest(context.Background()), mockScope.NewTestScope(), mockScope.NewTestScope(), &mockPublisher, mockExecutionRemoteURL, nil, nil, &mockPublisher, &mockPublisher, mockDbEventWriter)
req.Event.Phase = core.WorkflowExecution_RUNNING
req = &admin.WorkflowExecutionEventRequest{
RequestId: "1",
Event: &event.WorkflowExecutionEvent{
ExecutionId: &executionIdentifier,
Phase: core.WorkflowExecution_RUNNING,
OccurredAt: timestamppb.New(time.Now()),
},
}
resp, err = execManager.CreateWorkflowEvent(context.Background(), req)
assert.Nil(t, resp)
assert.NotNil(t, err)
Expand Down

0 comments on commit e3f200b

Please sign in to comment.