@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.
- package/README.md +63 -0
- package/bin/run +29 -0
- package/bin/run.cmd +3 -0
- package/changes.json +138 -0
- package/console-reporter.js +1 -0
- package/lib/artillery-global.js +33 -0
- package/lib/cli/banner.js +8 -0
- package/lib/cli/common-flags.js +80 -0
- package/lib/cli/hooks/version.js +20 -0
- package/lib/cmds/dino.js +109 -0
- package/lib/cmds/quick.js +122 -0
- package/lib/cmds/report.js +34 -0
- package/lib/cmds/run-aci.js +91 -0
- package/lib/cmds/run-fargate.js +192 -0
- package/lib/cmds/run-lambda.js +96 -0
- package/lib/cmds/run.js +671 -0
- package/lib/console-capture.js +92 -0
- package/lib/console-reporter.js +438 -0
- package/lib/create-bom/built-in-plugins.js +12 -0
- package/lib/create-bom/create-bom.js +301 -0
- package/lib/dispatcher.js +9 -0
- package/lib/dist.js +222 -0
- package/lib/index.js +5 -0
- package/lib/launch-platform.js +439 -0
- package/lib/load-plugins.js +113 -0
- package/lib/platform/aws/aws-cloudwatch.js +106 -0
- package/lib/platform/aws/aws-create-sqs-queue.js +58 -0
- package/lib/platform/aws/aws-ensure-s3-bucket-exists.js +78 -0
- package/lib/platform/aws/aws-get-account-id.js +26 -0
- package/lib/platform/aws/aws-get-bucket-region.js +18 -0
- package/lib/platform/aws/aws-get-credentials.js +28 -0
- package/lib/platform/aws/aws-get-default-region.js +26 -0
- package/lib/platform/aws/aws-whoami.js +15 -0
- package/lib/platform/aws/constants.js +7 -0
- package/lib/platform/aws/iam-cf-templates/aws-iam-fargate-cf-template.yml +219 -0
- package/lib/platform/aws/iam-cf-templates/aws-iam-lambda-cf-template.yml +125 -0
- package/lib/platform/aws/iam-cf-templates/gh-oidc-fargate.yml +241 -0
- package/lib/platform/aws/iam-cf-templates/gh-oidc-lambda.yml +153 -0
- package/lib/platform/aws-ecs/ecs.js +247 -0
- package/lib/platform/aws-ecs/legacy/aws-util.js +134 -0
- package/lib/platform/aws-ecs/legacy/bom.js +528 -0
- package/lib/platform/aws-ecs/legacy/constants.js +27 -0
- package/lib/platform/aws-ecs/legacy/create-s3-client.js +24 -0
- package/lib/platform/aws-ecs/legacy/create-test.js +247 -0
- package/lib/platform/aws-ecs/legacy/errors.js +34 -0
- package/lib/platform/aws-ecs/legacy/find-public-subnets.js +149 -0
- package/lib/platform/aws-ecs/legacy/plugins/artillery-plugin-inspect-script/index.js +27 -0
- package/lib/platform/aws-ecs/legacy/plugins/artillery-plugin-sqs-reporter/azure-aqs.js +80 -0
- package/lib/platform/aws-ecs/legacy/plugins/artillery-plugin-sqs-reporter/index.js +202 -0
- package/lib/platform/aws-ecs/legacy/plugins.js +16 -0
- package/lib/platform/aws-ecs/legacy/run-cluster.js +1994 -0
- package/lib/platform/aws-ecs/legacy/sqs-reporter.js +401 -0
- package/lib/platform/aws-ecs/legacy/tags.js +22 -0
- package/lib/platform/aws-ecs/legacy/test-run-status.js +9 -0
- package/lib/platform/aws-ecs/legacy/time.js +67 -0
- package/lib/platform/aws-ecs/legacy/util.js +97 -0
- package/lib/platform/aws-ecs/worker/Dockerfile +64 -0
- package/lib/platform/aws-ecs/worker/helpers.sh +80 -0
- package/lib/platform/aws-ecs/worker/loadgen-worker +656 -0
- package/lib/platform/aws-lambda/dependencies.js +130 -0
- package/lib/platform/aws-lambda/index.js +734 -0
- package/lib/platform/aws-lambda/lambda-handler/a9-handler-dependencies.js +73 -0
- package/lib/platform/aws-lambda/lambda-handler/a9-handler-helpers.js +43 -0
- package/lib/platform/aws-lambda/lambda-handler/a9-handler-index.js +235 -0
- package/lib/platform/aws-lambda/lambda-handler/package.json +15 -0
- package/lib/platform/aws-lambda/prices.js +29 -0
- package/lib/platform/az/aci.js +694 -0
- package/lib/platform/az/aqs-queue-consumer.js +88 -0
- package/lib/platform/az/regions.js +52 -0
- package/lib/platform/cloud/api.js +72 -0
- package/lib/platform/cloud/cloud.js +448 -0
- package/lib/platform/cloud/http-client.js +19 -0
- package/lib/platform/local/artillery-worker-local.js +154 -0
- package/lib/platform/local/index.js +174 -0
- package/lib/platform/local/worker.js +261 -0
- package/lib/platform/worker-states.js +13 -0
- package/lib/queue-consumer/index.js +56 -0
- package/lib/stash.js +41 -0
- package/lib/telemetry.js +78 -0
- package/lib/util/await-on-ee.js +24 -0
- package/lib/util/generate-id.js +9 -0
- package/lib/util/parse-tag-string.js +21 -0
- package/lib/util/prepare-test-execution-plan.js +216 -0
- package/lib/util/sleep.js +7 -0
- package/lib/util/validate-script.js +132 -0
- package/lib/util.js +294 -0
- package/lib/utils-config.js +31 -0
- package/package.json +323 -0
- package/types.d.ts +317 -0
- package/util.js +1 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
|
+
const { PutObjectCommand } = require('@aws-sdk/client-s3');
|
|
3
|
+
const debug = require('debug')('platform:aws-lambda');
|
|
4
|
+
const Table = require('cli-table3');
|
|
5
|
+
const { promisify } = require('node:util');
|
|
6
|
+
const { createBOM } = require('../aws-ecs/legacy/bom');
|
|
7
|
+
const createS3Client = require('../aws-ecs/legacy/create-s3-client');
|
|
8
|
+
|
|
9
|
+
const _createLambdaBom = async (
|
|
10
|
+
absoluteScriptPath,
|
|
11
|
+
absoluteConfigPath,
|
|
12
|
+
flags
|
|
13
|
+
) => {
|
|
14
|
+
const createBomOpts = {};
|
|
15
|
+
let entryPoint = absoluteScriptPath;
|
|
16
|
+
const extraFiles = [];
|
|
17
|
+
createBomOpts.scenarioPath = absoluteScriptPath;
|
|
18
|
+
if (absoluteConfigPath) {
|
|
19
|
+
entryPoint = absoluteConfigPath;
|
|
20
|
+
extraFiles.push(absoluteScriptPath);
|
|
21
|
+
createBomOpts.entryPointIsConfig = true;
|
|
22
|
+
}
|
|
23
|
+
// TODO: custom package.json path here
|
|
24
|
+
if (flags) {
|
|
25
|
+
createBomOpts.flags = flags;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const bom = await promisify(createBOM)(entryPoint, extraFiles, createBomOpts);
|
|
29
|
+
|
|
30
|
+
return bom;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
async function _uploadFileToS3(item, testRunId, bucketName) {
|
|
34
|
+
const s3 = createS3Client();
|
|
35
|
+
const prefix = `tests/${testRunId}`;
|
|
36
|
+
let body;
|
|
37
|
+
try {
|
|
38
|
+
body = fs.readFileSync(item.orig);
|
|
39
|
+
} catch (fsErr) {
|
|
40
|
+
console.log(fsErr);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (!body) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const key = `${prefix}/${item.noPrefixPosix}`;
|
|
48
|
+
await s3.send(
|
|
49
|
+
new PutObjectCommand({
|
|
50
|
+
Bucket: bucketName,
|
|
51
|
+
Key: key,
|
|
52
|
+
// TODO: stream, not readFileSync
|
|
53
|
+
Body: body
|
|
54
|
+
})
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
debug(`Uploaded ${key}`);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function _syncS3(bomManifest, testRunId, bucketName) {
|
|
62
|
+
const metadata = {
|
|
63
|
+
createdOn: Date.now(),
|
|
64
|
+
name: testRunId,
|
|
65
|
+
modules: bomManifest.modules
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
//TODO: parallelise this
|
|
69
|
+
let fileCount = 0;
|
|
70
|
+
for (const file of bomManifest.files) {
|
|
71
|
+
await _uploadFileToS3(file, testRunId, bucketName);
|
|
72
|
+
fileCount++;
|
|
73
|
+
}
|
|
74
|
+
metadata.fileCount = fileCount;
|
|
75
|
+
|
|
76
|
+
const plainS3 = createS3Client();
|
|
77
|
+
const prefix = `tests/${testRunId}`;
|
|
78
|
+
const key = `${prefix}/metadata.json`;
|
|
79
|
+
await plainS3.send(
|
|
80
|
+
new PutObjectCommand({
|
|
81
|
+
Bucket: bucketName,
|
|
82
|
+
Key: key,
|
|
83
|
+
// TODO: stream, not readFileSync
|
|
84
|
+
Body: JSON.stringify(metadata)
|
|
85
|
+
})
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
debug(`Uploaded ${key}`);
|
|
89
|
+
return `s3://${bucketName}/${key}`;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const createAndUploadTestDependencies = async (
|
|
93
|
+
bucketName,
|
|
94
|
+
testRunId,
|
|
95
|
+
absoluteScriptPath,
|
|
96
|
+
absoluteConfigPath,
|
|
97
|
+
flags
|
|
98
|
+
) => {
|
|
99
|
+
const bom = await _createLambdaBom(
|
|
100
|
+
absoluteScriptPath,
|
|
101
|
+
absoluteConfigPath,
|
|
102
|
+
flags
|
|
103
|
+
);
|
|
104
|
+
artillery.log('Test bundle contents:');
|
|
105
|
+
const t = new Table({ head: ['Name', 'Type', 'Notes'] });
|
|
106
|
+
for (const f of bom.files) {
|
|
107
|
+
t.push([f.noPrefix, 'file']);
|
|
108
|
+
}
|
|
109
|
+
for (const m of bom.modules) {
|
|
110
|
+
t.push([
|
|
111
|
+
m,
|
|
112
|
+
'package',
|
|
113
|
+
bom.pkgDeps.indexOf(m) === -1 ? 'not in package.json' : ''
|
|
114
|
+
]);
|
|
115
|
+
}
|
|
116
|
+
//TODO: add dotenv file if specified
|
|
117
|
+
artillery.log(t.toString());
|
|
118
|
+
artillery.log();
|
|
119
|
+
|
|
120
|
+
const s3Path = await _syncS3(bom, testRunId, bucketName);
|
|
121
|
+
|
|
122
|
+
return {
|
|
123
|
+
bom,
|
|
124
|
+
s3Path
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
module.exports = {
|
|
129
|
+
createAndUploadTestDependencies
|
|
130
|
+
};
|