Skip to content

Commit f47c14d

Browse files
committed
feat: remove @artilleryio/platform-fargate
1 parent 4429453 commit f47c14d

File tree

1 file changed

+103
-8
lines changed

1 file changed

+103
-8
lines changed

packages/artillery/lib/cmds/run-fargate.js

Lines changed: 103 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ const { Command, Flags, Args } = require('@oclif/core');
66
const telemetry = require('../telemetry').init();
77
const { Plugin: CloudPlugin } = require('../platform/cloud/cloud');
88

9-
const tryRequire = require('try-require');
10-
const PlatformFargateLegacy = tryRequire('@artilleryio/platform-fargate');
9+
const runCluster = require('../platform/aws-ecs/legacy/run-cluster');
1110
const PlatformECS = require('../platform/aws-ecs/ecs');
1211
const { ECS_WORKER_ROLE_NAME } = require('../platform/aws/constants');
1312

@@ -18,6 +17,11 @@ class RunCommand extends Command {
1817

1918
async run() {
2019
const { flags, _argv, args } = await this.parse(RunCommand);
20+
21+
flags['platform-opt'] = [`region=${flags.region}`];
22+
23+
flags.platform = 'aws:ecs';
24+
2125
new CloudPlugin(null, null, { flags });
2226

2327
const ECS = new PlatformECS(null, null, {}, { testRunId: 'foo' });
@@ -34,14 +38,105 @@ class RunCommand extends Command {
3438
});
3539

3640
// Delegate the rest to existing implementation:
37-
PlatformFargateLegacy.commands.runCluster(args.script, flags);
41+
runCluster(args.script, flags);
3842
}
3943
}
4044

41-
if (PlatformFargateLegacy) {
42-
RunCommand.description = PlatformFargateLegacy.oclif.runTest.description;
43-
RunCommand.flags = PlatformFargateLegacy.oclif.runTest.flags;
44-
RunCommand.args = PlatformFargateLegacy.oclif.runTest.args;
45-
}
45+
const runTestDescriptions = {
46+
count: 'Number of load generator workers to launch',
47+
cluster: 'Name of the Fargate/ECS cluster to run the test on',
48+
region: 'The AWS region to run in',
49+
packages:
50+
'Path to package.json file which lists dependencies for the test script',
51+
maxDuration: 'Maximum duration of the test run',
52+
dotenv: 'Path to a .env file to load environment variables from'
53+
};
54+
55+
RunCommand.description = `launch a test using AWS ECS/Fargate
56+
57+
Examples:
58+
59+
To launch a test with 10 load generating workers using AWS Fargate in us-east-1:
60+
61+
$ artillery run:fargate --count 10 --region us-east-1 my-test.yml
62+
`;
63+
64+
RunCommand.flags = {
65+
count: Flags.integer({
66+
description: runTestDescriptions.count
67+
}),
68+
cluster: Flags.string({
69+
description: runTestDescriptions.cluster
70+
}),
71+
region: Flags.string({
72+
char: 'r',
73+
description: runTestDescriptions.region
74+
}),
75+
secret: Flags.string({
76+
multiple: true
77+
}),
78+
// TODO: Descriptions
79+
'launch-type': Flags.string({}),
80+
'launch-config': Flags.string({}),
81+
'subnet-ids': Flags.string({}),
82+
'security-group-ids': Flags.string({}),
83+
'task-role-name': Flags.string({}),
84+
target: Flags.string({
85+
char: 't',
86+
description:
87+
'Set target endpoint. Overrides the target already set in the test script'
88+
}),
89+
output: Flags.string({
90+
char: 'o',
91+
description: 'Write a JSON report to file'
92+
}),
93+
insecure: Flags.boolean({
94+
char: 'k',
95+
description: 'Allow insecure TLS connections; do not use in production'
96+
}),
97+
environment: Flags.string({
98+
char: 'e',
99+
description: 'Use one of the environments specified in config.environments'
100+
}),
101+
config: Flags.string({
102+
description: 'Read configuration for the test from the specified file'
103+
}),
104+
'scenario-name': Flags.string({
105+
description: 'Name of the specific scenario to run'
106+
}),
107+
overrides: Flags.string({
108+
description: 'Dynamically override values in the test script; a JSON object'
109+
}),
110+
input: Flags.string({
111+
char: 'i',
112+
description: 'Input script file',
113+
multiple: true,
114+
hidden: true
115+
}),
116+
tags: Flags.string({
117+
description:
118+
'Comma-separated list of tags in key:value format to tag the test run, for example: --tags team:sre,service:foo'
119+
}),
120+
note: Flags.string({}), // TODO: description
121+
packages: Flags.string({
122+
description: runTestDescriptions.packages
123+
}),
124+
'max-duration': Flags.string({
125+
description: runTestDescriptions.maxDuration
126+
}),
127+
dotenv: Flags.string({
128+
description: runTestDescriptions.dotenv
129+
}),
130+
record: Flags.boolean({
131+
description: 'Record test run to Artillery Cloud'
132+
}),
133+
key: Flags.string({
134+
description: 'API key for Artillery Cloud'
135+
})
136+
};
137+
138+
RunCommand.args = {
139+
script: Args.string()
140+
};
46141

47142
module.exports = RunCommand;

0 commit comments

Comments
 (0)