Skip to content

Commit

Permalink
Merge pull request #3430 from artilleryio/fix/gh-3361
Browse files Browse the repository at this point in the history
  • Loading branch information
hassy authored Dec 11, 2024
2 parents 7ae41b4 + d706dfd commit 4c5e43b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/artillery/lib/util/prepare-test-execution-plan.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ async function prepareTestExecutionPlan(inputFiles, flags, _args) {
script1 = _.merge(script1, parsedData);
}

// We run the check here because subsequent steps can overwrite the target to undefined in
// cases where the value of config.target is set to a value from the environment which
// is not available at this point in time. Example: target is set to an environment variable
// the value of which is only available at runtime in AWS Fargate
const hasOriginalTarget =
typeof script1.config.target !== 'undefined' ||
typeof script1.config.environments?.[flags.environment]?.target !==
'undefined';

script1 = await checkConfig(script1, scriptPath, flags);

const script2 = await resolveConfigPath(script1, flags, scriptPath);
Expand All @@ -42,7 +51,7 @@ async function prepareTestExecutionPlan(inputFiles, flags, _args) {
script4._scriptPath
);

if (!script5.config.target) {
if (!script5.config.target && !hasOriginalTarget) {
throw new Error('No target specified and no environment chosen');
}

Expand Down

0 comments on commit 4c5e43b

Please sign in to comment.