mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
feat(core): Don't store insights for sub workflow executions (#14384)
This commit is contained in:
@@ -153,30 +153,31 @@ describe('workflowExecuteAfterHandler', () => {
|
||||
expect(allInsights).toHaveLength(0);
|
||||
});
|
||||
|
||||
test.each<{ mode: WorkflowExecuteMode }>([{ mode: 'internal' }, { mode: 'manual' }])(
|
||||
'does not store events for executions with the mode `$mode`',
|
||||
async ({ mode }) => {
|
||||
// ARRANGE
|
||||
const ctx = mock<ExecutionLifecycleHooks>({ workflowData: workflow });
|
||||
const startedAt = DateTime.utc();
|
||||
const stoppedAt = startedAt.plus({ seconds: 5 });
|
||||
const run = mock<IRun>({
|
||||
mode,
|
||||
status: 'success',
|
||||
startedAt: startedAt.toJSDate(),
|
||||
stoppedAt: stoppedAt.toJSDate(),
|
||||
});
|
||||
test.each<{ mode: WorkflowExecuteMode }>([
|
||||
{ mode: 'internal' },
|
||||
{ mode: 'manual' },
|
||||
{ mode: 'integrated' },
|
||||
])('does not store events for executions with the mode `$mode`', async ({ mode }) => {
|
||||
// ARRANGE
|
||||
const ctx = mock<ExecutionLifecycleHooks>({ workflowData: workflow });
|
||||
const startedAt = DateTime.utc();
|
||||
const stoppedAt = startedAt.plus({ seconds: 5 });
|
||||
const run = mock<IRun>({
|
||||
mode,
|
||||
status: 'success',
|
||||
startedAt: startedAt.toJSDate(),
|
||||
stoppedAt: stoppedAt.toJSDate(),
|
||||
});
|
||||
|
||||
// ACT
|
||||
await insightsService.workflowExecuteAfterHandler(ctx, run);
|
||||
// ACT
|
||||
await insightsService.workflowExecuteAfterHandler(ctx, run);
|
||||
|
||||
// ASSERT
|
||||
const metadata = await insightsMetadataRepository.findOneBy({ workflowId: workflow.id });
|
||||
const allInsights = await insightsRawRepository.find();
|
||||
expect(metadata).toBeNull();
|
||||
expect(allInsights).toHaveLength(0);
|
||||
},
|
||||
);
|
||||
// ASSERT
|
||||
const metadata = await insightsMetadataRepository.findOneBy({ workflowId: workflow.id });
|
||||
const allInsights = await insightsRawRepository.find();
|
||||
expect(metadata).toBeNull();
|
||||
expect(allInsights).toHaveLength(0);
|
||||
});
|
||||
|
||||
test.each<{ mode: WorkflowExecuteMode }>([
|
||||
{ mode: 'evaluation' },
|
||||
@@ -185,7 +186,6 @@ describe('workflowExecuteAfterHandler', () => {
|
||||
{ mode: 'retry' },
|
||||
{ mode: 'trigger' },
|
||||
{ mode: 'webhook' },
|
||||
{ mode: 'integrated' },
|
||||
])('stores events for executions with the mode `$mode`', async ({ mode }) => {
|
||||
// ARRANGE
|
||||
const ctx = mock<ExecutionLifecycleHooks>({ workflowData: workflow });
|
||||
|
||||
@@ -37,13 +37,17 @@ const shouldSkipStatus: Record<ExecutionStatus, boolean> = {
|
||||
const shouldSkipMode: Record<WorkflowExecuteMode, boolean> = {
|
||||
cli: false,
|
||||
error: false,
|
||||
integrated: false,
|
||||
retry: false,
|
||||
trigger: false,
|
||||
webhook: false,
|
||||
evaluation: false,
|
||||
|
||||
// sub workflows
|
||||
integrated: true,
|
||||
|
||||
// error workflows
|
||||
internal: true,
|
||||
|
||||
manual: true,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user