fix: Fix scenario prefix not being passed (no-changelog) (#10575)

This commit is contained in:
Tomi Turtiainen 2024-08-28 10:46:17 +03:00 committed by GitHub
parent bc958be93b
commit 6017bf5af1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 3 deletions

View file

@ -26,14 +26,13 @@ async function main() {
N8N_VERSION: n8nTag, N8N_VERSION: n8nTag,
BENCHMARK_VERSION: benchmarkTag, BENCHMARK_VERSION: benchmarkTag,
K6_API_TOKEN: k6ApiToken, K6_API_TOKEN: k6ApiToken,
N8N_BENCHMARK_SCENARIO_NAME_PREFIX: n8nSetupToUse,
}, },
}); });
try { try {
await $$`docker-compose up -d n8n`; await $$`docker-compose up -d n8n`;
await $$`docker-compose run benchmark run`; await $$`docker-compose run benchmark run --scenarioNamePrefix=${n8nSetupToUse} `;
} catch (error) { } catch (error) {
console.error('An error occurred while running the benchmarks:'); console.error('An error occurred while running the benchmarks:');
console.error(error); console.error(error);

View file

@ -16,10 +16,14 @@ export default class RunCommand extends Command {
description: 'Comma-separated list of test scenarios to run', description: 'Comma-separated list of test scenarios to run',
required: false, required: false,
}), }),
scenarioNamePrefix: Flags.string({
description: 'Prefix for the scenario name. Defaults to Unnamed',
required: false,
}),
}; };
async run() { async run() {
const config = loadConfig(); const config = await this.loadConfigAndMergeWithFlags();
const scenarioLoader = new ScenarioLoader(); const scenarioLoader = new ScenarioLoader();
const scenarioRunner = new ScenarioRunner( const scenarioRunner = new ScenarioRunner(
@ -41,4 +45,15 @@ export default class RunCommand extends Command {
await scenarioRunner.runManyScenarios(allScenarios); 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;
}
} }