Skip to content

Commit 4c5e43b

Browse files
authored
Merge pull request #3430 from artilleryio/fix/gh-3361
2 parents 7ae41b4 + d706dfd commit 4c5e43b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/artillery/lib/util/prepare-test-execution-plan.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ async function prepareTestExecutionPlan(inputFiles, flags, _args) {
2828
script1 = _.merge(script1, parsedData);
2929
}
3030

31+
// We run the check here because subsequent steps can overwrite the target to undefined in
32+
// cases where the value of config.target is set to a value from the environment which
33+
// is not available at this point in time. Example: target is set to an environment variable
34+
// the value of which is only available at runtime in AWS Fargate
35+
const hasOriginalTarget =
36+
typeof script1.config.target !== 'undefined' ||
37+
typeof script1.config.environments?.[flags.environment]?.target !==
38+
'undefined';
39+
3140
script1 = await checkConfig(script1, scriptPath, flags);
3241

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

45-
if (!script5.config.target) {
54+
if (!script5.config.target && !hasOriginalTarget) {
4655
throw new Error('No target specified and no environment chosen');
4756
}
4857

0 commit comments

Comments
 (0)