From b6850849579a8c7238dc74ce3e10cd65afff60b9 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquart Date: Thu, 12 Jun 2025 14:13:51 +0200 Subject: [PATCH] fix(benchmark): Archive workflow before deleting them (#16273) --- .../@n8n/benchmark/src/n8n-api-client/workflows-api-client.ts | 4 ++++ .../benchmark/src/test-execution/scenario-data-importer.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/packages/@n8n/benchmark/src/n8n-api-client/workflows-api-client.ts b/packages/@n8n/benchmark/src/n8n-api-client/workflows-api-client.ts index 92bcfad89f..9d6ab30229 100644 --- a/packages/@n8n/benchmark/src/n8n-api-client/workflows-api-client.ts +++ b/packages/@n8n/benchmark/src/n8n-api-client/workflows-api-client.ts @@ -26,6 +26,10 @@ export class WorkflowApiClient { return response.data.data; } + async archiveWorkflow(workflowId: Workflow['id']): Promise { + await this.apiClient.post(`/workflows/${workflowId}/archive`, {}); + } + async deleteWorkflow(workflowId: Workflow['id']): Promise { await this.apiClient.delete(`/workflows/${workflowId}`); } diff --git a/packages/@n8n/benchmark/src/test-execution/scenario-data-importer.ts b/packages/@n8n/benchmark/src/test-execution/scenario-data-importer.ts index cf6029834a..885178c409 100644 --- a/packages/@n8n/benchmark/src/test-execution/scenario-data-importer.ts +++ b/packages/@n8n/benchmark/src/test-execution/scenario-data-importer.ts @@ -27,6 +27,7 @@ export class ScenarioDataImporter { const existingWorkflows = this.findExistingWorkflows(opts.existingWorkflows, opts.workflow); if (existingWorkflows.length > 0) { for (const toDelete of existingWorkflows) { + await this.workflowApiClient.archiveWorkflow(toDelete.id); await this.workflowApiClient.deleteWorkflow(toDelete.id); } }