Skip to content

Commit 8cf5741

Browse files
test(lambda): make lambda test report to cloud with tags
1 parent 2760ec0 commit 8cf5741

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

packages/artillery/test/cli/_helpers.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,18 @@ async function getRootPath(filename) {
3030
return path.resolve(__dirname, '..', '..', filename);
3131
}
3232

33-
module.exports = { execute, deleteFile, getRootPath, returnTmpPath };
33+
function getTestTags(additionalTags) {
34+
const actorTag = `actor:${process.env.GITHUB_ACTOR || 'localhost'}`;
35+
const repoTag = `repo:${process.env.GITHUB_REPO || 'artilleryio/artillery'}`;
36+
const ciTag = `ci:${process.env.GITHUB_ACTIONS ? 'true' : 'false'}`;
37+
38+
return `${repoTag},${actorTag},${ciTag},${additionalTags.join(',')}`;
39+
}
40+
41+
module.exports = {
42+
execute,
43+
deleteFile,
44+
getRootPath,
45+
returnTmpPath,
46+
getTestTags
47+
};

packages/artillery/test/cloud-e2e/lambda/run-lambda.test.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
const tap = require('tap');
22
const { $ } = require('zx');
3+
const { getTestTags } = require('../../cli/_helpers.js');
34

45
tap.test('Run a test on AWS Lambda', async (t) => {
6+
const tags = getTestTags(['type:acceptance']);
57
const configPath = `${__dirname}/fixtures/quick-loop-with-csv/config.yml`;
68
const scenarioPath = `${__dirname}/fixtures/quick-loop-with-csv/blitz.yml`;
79

810
const output =
9-
await $`artillery run-lambda --count 10 --region eu-west-1 --config ${configPath} ${scenarioPath}`;
11+
await $`artillery run-lambda --count 10 --region eu-west-1 --config ${configPath} --record --tags ${tags} ${scenarioPath}`;
1012

1113
t.equal(output.exitCode, 0, 'CLI should exit with code 0');
1214

0 commit comments

Comments
 (0)