@depup/artillery 2.0.30-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/README.md +63 -0
  2. package/bin/run +29 -0
  3. package/bin/run.cmd +3 -0
  4. package/changes.json +138 -0
  5. package/console-reporter.js +1 -0
  6. package/lib/artillery-global.js +33 -0
  7. package/lib/cli/banner.js +8 -0
  8. package/lib/cli/common-flags.js +80 -0
  9. package/lib/cli/hooks/version.js +20 -0
  10. package/lib/cmds/dino.js +109 -0
  11. package/lib/cmds/quick.js +122 -0
  12. package/lib/cmds/report.js +34 -0
  13. package/lib/cmds/run-aci.js +91 -0
  14. package/lib/cmds/run-fargate.js +192 -0
  15. package/lib/cmds/run-lambda.js +96 -0
  16. package/lib/cmds/run.js +671 -0
  17. package/lib/console-capture.js +92 -0
  18. package/lib/console-reporter.js +438 -0
  19. package/lib/create-bom/built-in-plugins.js +12 -0
  20. package/lib/create-bom/create-bom.js +301 -0
  21. package/lib/dispatcher.js +9 -0
  22. package/lib/dist.js +222 -0
  23. package/lib/index.js +5 -0
  24. package/lib/launch-platform.js +439 -0
  25. package/lib/load-plugins.js +113 -0
  26. package/lib/platform/aws/aws-cloudwatch.js +106 -0
  27. package/lib/platform/aws/aws-create-sqs-queue.js +58 -0
  28. package/lib/platform/aws/aws-ensure-s3-bucket-exists.js +78 -0
  29. package/lib/platform/aws/aws-get-account-id.js +26 -0
  30. package/lib/platform/aws/aws-get-bucket-region.js +18 -0
  31. package/lib/platform/aws/aws-get-credentials.js +28 -0
  32. package/lib/platform/aws/aws-get-default-region.js +26 -0
  33. package/lib/platform/aws/aws-whoami.js +15 -0
  34. package/lib/platform/aws/constants.js +7 -0
  35. package/lib/platform/aws/iam-cf-templates/aws-iam-fargate-cf-template.yml +219 -0
  36. package/lib/platform/aws/iam-cf-templates/aws-iam-lambda-cf-template.yml +125 -0
  37. package/lib/platform/aws/iam-cf-templates/gh-oidc-fargate.yml +241 -0
  38. package/lib/platform/aws/iam-cf-templates/gh-oidc-lambda.yml +153 -0
  39. package/lib/platform/aws-ecs/ecs.js +247 -0
  40. package/lib/platform/aws-ecs/legacy/aws-util.js +134 -0
  41. package/lib/platform/aws-ecs/legacy/bom.js +528 -0
  42. package/lib/platform/aws-ecs/legacy/constants.js +27 -0
  43. package/lib/platform/aws-ecs/legacy/create-s3-client.js +24 -0
  44. package/lib/platform/aws-ecs/legacy/create-test.js +247 -0
  45. package/lib/platform/aws-ecs/legacy/errors.js +34 -0
  46. package/lib/platform/aws-ecs/legacy/find-public-subnets.js +149 -0
  47. package/lib/platform/aws-ecs/legacy/plugins/artillery-plugin-inspect-script/index.js +27 -0
  48. package/lib/platform/aws-ecs/legacy/plugins/artillery-plugin-sqs-reporter/azure-aqs.js +80 -0
  49. package/lib/platform/aws-ecs/legacy/plugins/artillery-plugin-sqs-reporter/index.js +202 -0
  50. package/lib/platform/aws-ecs/legacy/plugins.js +16 -0
  51. package/lib/platform/aws-ecs/legacy/run-cluster.js +1994 -0
  52. package/lib/platform/aws-ecs/legacy/sqs-reporter.js +401 -0
  53. package/lib/platform/aws-ecs/legacy/tags.js +22 -0
  54. package/lib/platform/aws-ecs/legacy/test-run-status.js +9 -0
  55. package/lib/platform/aws-ecs/legacy/time.js +67 -0
  56. package/lib/platform/aws-ecs/legacy/util.js +97 -0
  57. package/lib/platform/aws-ecs/worker/Dockerfile +64 -0
  58. package/lib/platform/aws-ecs/worker/helpers.sh +80 -0
  59. package/lib/platform/aws-ecs/worker/loadgen-worker +656 -0
  60. package/lib/platform/aws-lambda/dependencies.js +130 -0
  61. package/lib/platform/aws-lambda/index.js +734 -0
  62. package/lib/platform/aws-lambda/lambda-handler/a9-handler-dependencies.js +73 -0
  63. package/lib/platform/aws-lambda/lambda-handler/a9-handler-helpers.js +43 -0
  64. package/lib/platform/aws-lambda/lambda-handler/a9-handler-index.js +235 -0
  65. package/lib/platform/aws-lambda/lambda-handler/package.json +15 -0
  66. package/lib/platform/aws-lambda/prices.js +29 -0
  67. package/lib/platform/az/aci.js +694 -0
  68. package/lib/platform/az/aqs-queue-consumer.js +88 -0
  69. package/lib/platform/az/regions.js +52 -0
  70. package/lib/platform/cloud/api.js +72 -0
  71. package/lib/platform/cloud/cloud.js +448 -0
  72. package/lib/platform/cloud/http-client.js +19 -0
  73. package/lib/platform/local/artillery-worker-local.js +154 -0
  74. package/lib/platform/local/index.js +174 -0
  75. package/lib/platform/local/worker.js +261 -0
  76. package/lib/platform/worker-states.js +13 -0
  77. package/lib/queue-consumer/index.js +56 -0
  78. package/lib/stash.js +41 -0
  79. package/lib/telemetry.js +78 -0
  80. package/lib/util/await-on-ee.js +24 -0
  81. package/lib/util/generate-id.js +9 -0
  82. package/lib/util/parse-tag-string.js +21 -0
  83. package/lib/util/prepare-test-execution-plan.js +216 -0
  84. package/lib/util/sleep.js +7 -0
  85. package/lib/util/validate-script.js +132 -0
  86. package/lib/util.js +294 -0
  87. package/lib/utils-config.js +31 -0
  88. package/package.json +323 -0
  89. package/types.d.ts +317 -0
  90. package/util.js +1 -0
package/types.d.ts ADDED
@@ -0,0 +1,317 @@
1
+ import { Redis } from '@upstash/redis';
2
+ import { type Page } from 'playwright';
3
+
4
+ /**
5
+ * Artillery Stash client
6
+ *
7
+ * Represents the Artillery Cloud Stash API client which is Redis-compatible.
8
+ * Will be null if stash is not available (e.g., no API key, not on Business/Enterprise plan).
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import { Stash } from 'artillery';
13
+ *
14
+ * const stash: Stash = global.artillery.stash;
15
+ * if (stash) {
16
+ * await stash.set('key', 'value');
17
+ * const value = await stash.get('key');
18
+ * }
19
+ * ```
20
+ */
21
+ export type Stash = Redis | null;
22
+
23
+ declare global {
24
+ var artillery: {
25
+ /**
26
+ * Artillery Cloud Stash API client (Redis-compatible)
27
+ * Available when Artillery is run with --key flag, on Business and Enterprise plans
28
+ * Set to null otherwise.
29
+ */
30
+ stash: Stash;
31
+ };
32
+ }
33
+
34
+ /**
35
+ * Options for configuring the Artillery stash client
36
+ */
37
+ export interface GetStashOptions {
38
+ /**
39
+ * Artillery Cloud API key. If not provided, will use ARTILLERY_CLOUD_API_KEY environment variable
40
+ */
41
+ apiKey?: string;
42
+ }
43
+
44
+ /**
45
+ * Get an Artillery Stash client instance
46
+ *
47
+ * This function connects to Artillery Cloud and returns a configured Stash client instance
48
+ *
49
+ * @param options - Configuration options
50
+ * @returns Promise that resolves to Stash client instance or null if not available
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * import { getStash } from 'artillery';
55
+ *
56
+ * const stash = await getStash();
57
+ * if (stash) {
58
+ * await stash.set('key', 'value');
59
+ * const value = await stash.get('key');
60
+ * }
61
+ * ```
62
+ */
63
+ export function getStash(options?: GetStashOptions): Promise<Stash>;
64
+
65
+ export type Config = {
66
+ [key: string]: any;
67
+
68
+ /**
69
+ * Endpoint of the system under test, such as a hostname or IP address.
70
+ * https://www.artillery.io/docs/reference/test-script#target---target-service
71
+ */
72
+ target: string;
73
+ engines?: {
74
+ playwright?: PlaywrightEngineConfig;
75
+ };
76
+ /**
77
+ * A load phase defines how Artillery generates new virtual users (VUs) in a specified time period.
78
+ * https://www.artillery.io/docs/reference/test-script#phases---load-phases
79
+ */
80
+ phases?: Array<TestPhase>;
81
+ /**
82
+ * Map of variables to expose to the test run.
83
+ * https://www.artillery.io/docs/reference/test-script#variables---inline-variables
84
+ */
85
+ variables?: object;
86
+ /**
87
+ * List of Artillery plugins to use.
88
+ */
89
+ plugins?: {
90
+ [key: string]: any;
91
+ };
92
+ ensure?: {
93
+ [key: string]: any;
94
+ };
95
+ /**
96
+ * Path to a CommonJS/ESM/TypeScript module to load for this test run.
97
+ * @deprecated
98
+ */
99
+ processor?: string;
100
+ /**
101
+ * CSV payload definition
102
+ */
103
+ payload?: PayloadConfig | Array<PayloadConfig>;
104
+ /**
105
+ * TLS settings
106
+ */
107
+ tls?: {
108
+ /**
109
+ * Set this setting to `false` to tell Artillery to accept
110
+ * self-signed TLS certificates.
111
+ * Reject unauthorized connections
112
+ * @default true
113
+ */
114
+ rejectUnauthorized?: boolean;
115
+ };
116
+ };
117
+
118
+ export type Scenario = {
119
+ /**
120
+ * Scenario name
121
+ */
122
+ name?: string;
123
+ /**
124
+ * Functions to run before each scenario.
125
+ */
126
+ beforeScenario?: string | Array<string>;
127
+ /**
128
+ * Functions to run after each scenario.
129
+ */
130
+ afterScenario?: string | Array<string>;
131
+ /**
132
+ * The probability of how often this scenario will be picked up.
133
+ * The higher the number, the more likely it will be used
134
+ * compared to other scenarios.
135
+ * @default 1
136
+ */
137
+ weight?: number;
138
+ } & {
139
+ /**
140
+ * Playwright engine
141
+ */
142
+ engine: 'playwright';
143
+ /**
144
+ * Test function
145
+ */
146
+ testFunction?: PlaywrightEngineScenarioTestFunction;
147
+ /**
148
+ * Flow function
149
+ * @deprecated Use testFunction attribute instead
150
+ */
151
+ flowFunction?: PlaywrightEngineScenarioTestFunction;
152
+ };
153
+
154
+ export type PlaywrightEngineScenarioTestFunction = string | ((page: Page, userContext: VUContext, events: VUEvents, test: PlaywrightEngineTestParam) => Promise<void>);
155
+
156
+ export type VUContext = {
157
+ [key: string]: any;
158
+ vars: Record<string, any>;
159
+ };
160
+
161
+ export type VUEvents = {
162
+ emit: (metricType: 'counter' | 'histogram' | 'rate', metricName: string, metricValue: number) => void;
163
+ };
164
+
165
+ export type PlaywrightEngineTestParam = {
166
+ step: (stepName: string, userActions: () => void | Promise<void>) => Promise<void>
167
+ };
168
+
169
+ export type PlaywrightEngineConfig = {
170
+ /**
171
+ * Arguments for the `browser.launch()` call in Playwright.
172
+ * https://playwright.dev/docs/api/class-browsertype#browser-type-launch
173
+ */
174
+ launchOptions?: object;
175
+ /**
176
+ * Arguments for the `browser.newContext()` call in Playwright.
177
+ * https://playwright.dev/docs/api/class-browser#browser-new-context
178
+ */
179
+ contextOptions?: object;
180
+ /**
181
+ * Default maximum time (in seconds) for all Playwright methods
182
+ * accepting the `timeout` option.
183
+ * https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout
184
+ */
185
+ defaultTimeout?: number;
186
+ /**
187
+ * Default maximum navigation time (in seconds)
188
+ * for Playwright navigation methods, like `page.goto()`.
189
+ * https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-navigation-timeout
190
+ */
191
+ defaultNavigationTimeout?: number;
192
+ /**
193
+ * When set, changes the attribute used by locator `page.getByTestId` in Playwright.
194
+ * https://playwright.dev/docs/api/class-framelocator#frame-locator-get-by-test-id
195
+ */
196
+ testIdAttribute?: string;
197
+ /**
198
+ * Aggregate Artillery metrics by test scenario name.
199
+ * https://www.artillery.io/docs/reference/engines/playwright#aggregate-metrics-by-scenario-name
200
+ */
201
+ aggregateByName?: boolean;
202
+ /**
203
+ * Enable Playwright trace recordings.
204
+ * https://www.artillery.io/docs/reference/engines/playwright#tracing-configuration
205
+ */
206
+ trace?: boolean | PlaywrightEngineTraceConfig;
207
+ /**
208
+ * Report additional browser metrics
209
+ * https://www.artillery.io/docs/reference/engines/playwright#extended-metrics
210
+ */
211
+ extendedMetrics?: boolean;
212
+ /**
213
+ * Show metrics for all domains & pages. When enabled, metrics for iframes and pages not hosted on the base URL will be reported.
214
+ * https://www.artillery.io/docs/reference/engines/playwright#playwright--browser-configuration-options
215
+ */
216
+ showAllPageMetrics?: boolean;
217
+ /**
218
+ * Launch a separate browser for each new VU, rather than using a new Playwright browser context for each VU.
219
+ * Enabling this setting is not recommended as it will increase CPU and memory usage.
220
+ * https://www.artillery.io/docs/reference/engines/playwright#playwright--browser-configuration-options
221
+ */
222
+ useSeparateBrowserPerVU?: boolean;
223
+ };
224
+
225
+ type PlaywrightEngineTraceConfig = {
226
+ /**
227
+ * Enable Playwright trace recording
228
+ * @default false
229
+ */
230
+ enabled?: boolean;
231
+ /**
232
+ * Max number of active VUs recording a trace
233
+ * @default 3
234
+ */
235
+ maxConcurrentRecordings: number;
236
+ }
237
+
238
+ export type TestPhase = {
239
+ /**
240
+ * Test phase name
241
+ */
242
+ name?: string;
243
+ } & (
244
+ | {
245
+ /**
246
+ * Test phase duration (in seconds).
247
+ * Can also be any valid [human-readable duration](https://www.npmjs.com/package/ms).
248
+ */
249
+ duration: number | string;
250
+ /**
251
+ * Constant arrival rate.
252
+ * The number of virtual users generated every second.
253
+ */
254
+ arrivalRate?: number | string;
255
+ /**
256
+ * Fixed number of virtual users.
257
+ */
258
+ arrivalCount?: number | string;
259
+ /**
260
+ * Ramp rate
261
+ */
262
+ rampTo?: number | string;
263
+ /**
264
+ * Maximum number of virtual users active at once
265
+ */
266
+ maxVusers?: number | string;
267
+ }
268
+ | {
269
+ /**
270
+ * Pause the test phase execution for given duration (in seconds).
271
+ * Can also be any valid [human-readable duration](https://www.npmjs.com/package/ms).
272
+ */
273
+ pause: number | string;
274
+ }
275
+ );
276
+
277
+ export type PayloadConfig = {
278
+ /**
279
+ * Path to the CSV file.
280
+ */
281
+ path: string;
282
+ fields: Array<string>;
283
+ /**
284
+ * Controls how the CSV rows are selected for each virtual user.
285
+ * @default "random"
286
+ */
287
+ random?: 'random' | 'sequence';
288
+ /**
289
+ * Set to `true` to make Artillery skip the first row in the CSV file
290
+ * (typically the header row).
291
+ * @default false
292
+ */
293
+ skipHeader?: boolean;
294
+ /**
295
+ * Custom delimiter character to use in the payload.
296
+ * @default ","
297
+ */
298
+ delimiter?: string;
299
+ /**
300
+ * Controls whether Artillery converts fields to native types
301
+ * (e.g. numbers or booleans). To keep those fields as strings,
302
+ * set this option to `false`.
303
+ * @default true
304
+ */
305
+ cast?: boolean;
306
+ /**
307
+ * Controls whether Artillery should skip empty lines in the payload.
308
+ * @default true
309
+ */
310
+ skipEmptyLines?: boolean;
311
+ } & (
312
+ | { loadAll?: never; name?: never }
313
+ | {
314
+ loadAll: true;
315
+ name: string;
316
+ }
317
+ );
package/util.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./lib/util');