Skip to content

Commit

Permalink
fix(core): Fix payload property in workflow-post-execute event (#10413
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ivov authored Aug 15, 2024
1 parent 39c8e50 commit d98e29e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,12 @@ describe('LogStreamingEventRelay', () => {
executionId: 'some-id',
userId: 'some-id',
workflow: mock<IWorkflowBase>({ id: 'some-id', name: 'some-name' }),
runData: mock<IRun>({ status: 'success', mode: 'manual', data: { resultData: {} } }),
runData: mock<IRun>({
finished: true,
status: 'success',
mode: 'manual',
data: { resultData: {} },
}),
});

eventService.emit('workflow-post-execute', payload);
Expand All @@ -153,18 +158,19 @@ describe('LogStreamingEventRelay', () => {
eventName: 'n8n.workflow.success',
payload: {
...rest,
success: true,
success: true, // same as finished
isManual: true,
workflowName: 'some-name',
workflowId: 'some-id',
},
});
});

it('should log on `workflow-post-execute` event for unsuccessful execution', () => {
it('should log on `workflow-post-execute` event for failed execution', () => {
const runData = mock<IRun>({
status: 'error',
mode: 'manual',
finished: false,
data: {
resultData: {
lastNodeExecuted: 'some-node',
Expand Down Expand Up @@ -193,7 +199,7 @@ describe('LogStreamingEventRelay', () => {
eventName: 'n8n.workflow.failed',
payload: {
...rest,
success: false,
success: false, // same as finished
isManual: true,
workflowName: 'some-name',
workflowId: 'some-id',
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/events/log-streaming-event-relay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class LogStreamingEventRelay extends EventRelay {

const payload = {
...rest,
success: runData?.status === 'success',
success: !!runData?.finished, // despite the `success` name, this reports `finished` state
isManual: runData?.mode === 'manual',
workflowId: workflow.id,
workflowName: workflow.name,
Expand Down

0 comments on commit d98e29e

Please sign in to comment.