Skip to content

Commit

Permalink
test(lambda): make lambda test report to cloud with tags
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardobridge committed Jan 11, 2024
1 parent 2760ec0 commit 8cf5741
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 15 additions & 1 deletion packages/artillery/test/cli/_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,18 @@ async function getRootPath(filename) {
return path.resolve(__dirname, '..', '..', filename);
}

module.exports = { execute, deleteFile, getRootPath, returnTmpPath };
function getTestTags(additionalTags) {
const actorTag = `actor:${process.env.GITHUB_ACTOR || 'localhost'}`;
const repoTag = `repo:${process.env.GITHUB_REPO || 'artilleryio/artillery'}`;
const ciTag = `ci:${process.env.GITHUB_ACTIONS ? 'true' : 'false'}`;

return `${repoTag},${actorTag},${ciTag},${additionalTags.join(',')}`;
}

module.exports = {
execute,
deleteFile,
getRootPath,
returnTmpPath,
getTestTags
};
4 changes: 3 additions & 1 deletion packages/artillery/test/cloud-e2e/lambda/run-lambda.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
const tap = require('tap');
const { $ } = require('zx');
const { getTestTags } = require('../../cli/_helpers.js');

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

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

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

Expand Down

0 comments on commit 8cf5741

Please sign in to comment.