From 6017bf5af159149ecea7cad80c7c85e9e2143b49 Mon Sep 17 00:00:00 2001 From: Tomi Turtiainen <10324676+tomi@users.noreply.github.com> Date: Wed, 28 Aug 2024 10:46:17 +0300 Subject: [PATCH] fix: Fix scenario prefix not being passed (no-changelog) (#10575) --- .../@n8n/benchmark/scripts/runOnVm/runOnVm.mjs | 3 +-- packages/@n8n/benchmark/src/commands/run.ts | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/@n8n/benchmark/scripts/runOnVm/runOnVm.mjs b/packages/@n8n/benchmark/scripts/runOnVm/runOnVm.mjs index d8d3537dec..fd853203ac 100755 --- a/packages/@n8n/benchmark/scripts/runOnVm/runOnVm.mjs +++ b/packages/@n8n/benchmark/scripts/runOnVm/runOnVm.mjs @@ -26,14 +26,13 @@ async function main() { N8N_VERSION: n8nTag, BENCHMARK_VERSION: benchmarkTag, K6_API_TOKEN: k6ApiToken, - N8N_BENCHMARK_SCENARIO_NAME_PREFIX: n8nSetupToUse, }, }); try { await $$`docker-compose up -d n8n`; - await $$`docker-compose run benchmark run`; + await $$`docker-compose run benchmark run --scenarioNamePrefix=${n8nSetupToUse} `; } catch (error) { console.error('An error occurred while running the benchmarks:'); console.error(error); diff --git a/packages/@n8n/benchmark/src/commands/run.ts b/packages/@n8n/benchmark/src/commands/run.ts index 4476dbfbe0..5e2c1d3dc6 100644 --- a/packages/@n8n/benchmark/src/commands/run.ts +++ b/packages/@n8n/benchmark/src/commands/run.ts @@ -16,10 +16,14 @@ export default class RunCommand extends Command { description: 'Comma-separated list of test scenarios to run', required: false, }), + scenarioNamePrefix: Flags.string({ + description: 'Prefix for the scenario name. Defaults to Unnamed', + required: false, + }), }; async run() { - const config = loadConfig(); + const config = await this.loadConfigAndMergeWithFlags(); const scenarioLoader = new ScenarioLoader(); const scenarioRunner = new ScenarioRunner( @@ -41,4 +45,15 @@ export default class RunCommand extends Command { await scenarioRunner.runManyScenarios(allScenarios); } + + private async loadConfigAndMergeWithFlags() { + const config = loadConfig(); + const { flags } = await this.parse(RunCommand); + + if (flags.scenarioNamePrefix) { + config.set('scenarioNamePrefix', flags.scenarioNamePrefix); + } + + return config; + } }