Skip to content

Commit

Permalink
Merge pull request #2408 from artilleryio/bernardobridge/art-1479-sen…
Browse files Browse the repository at this point in the history
…d-aws-tests-to-artillery-cloud-dashboard

test(aws): send aws tests to artillery cloud dashboard
  • Loading branch information
bernardobridge authored Jan 11, 2024
2 parents aaaf4d7 + 8cf5741 commit 84b6b14
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/run-aws-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,8 @@ jobs:
- run: npm run test:aws --workspace artillery
env:
FORCE_COLOR: 1
ECR_IMAGE_VERSION: ${{ github.sha }} # the image is published with the sha of the commit within this repo
ECR_IMAGE_VERSION: ${{ github.sha }} # the image is published with the sha of the commit within this repo
ARTILLERY_CLOUD_ENDPOINT: ${{ secrets.ARTILLERY_CLOUD_ENDPOINT_TEST }}
ARTILLERY_CLOUD_API_KEY: ${{ secrets.ARTILLERY_CLOUD_API_KEY_TEST }}
GITHUB_REPO: ${{ github.repository }}
GITHUB_ACTOR: ${{ github.actor }}
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
};
21 changes: 9 additions & 12 deletions packages/artillery/test/cloud-e2e/lambda/run-lambda.test.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
const tap = require('tap');
const { execute } = require('../../cli/_helpers.js');
const { $ } = require('zx');
const { getTestTags } = require('../../cli/_helpers.js');

tap.test('Run a test on AWS Lambda', async (t) => {
const [exitCode, output] = await execute([
'run:lambda',
'--count',
'10',
'--region',
'eu-west-1',
'--config',
'./test/cloud-e2e/lambda/fixtures/quick-loop-with-csv/config.yml',
'./test/cloud-e2e/lambda/fixtures/quick-loop-with-csv/blitz.yml'
]);
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`;

t.equal(exitCode, 0, 'CLI should exit with code 0');
const output =
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');

t.ok(
output.stdout.indexOf('Summary report') > 0,
Expand Down

0 comments on commit 84b6b14

Please sign in to comment.