Skip to content

Commit

Permalink
fix: Fix scenario prefix not being passed (no-changelog) (#10575)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomi authored Aug 28, 2024
1 parent bc958be commit 6017bf5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
3 changes: 1 addition & 2 deletions packages/@n8n/benchmark/scripts/runOnVm/runOnVm.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
17 changes: 16 additions & 1 deletion packages/@n8n/benchmark/src/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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;
}
}

0 comments on commit 6017bf5

Please sign in to comment.