Skip to content

Commit

Permalink
feat: send extra metadata to Artillery Cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
hassy committed Aug 20, 2024
1 parent 244a61e commit 4cdadc9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
10 changes: 9 additions & 1 deletion packages/artillery/lib/cmds/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,15 @@ RunCommand.runCommandImplementation = async function (flags, argv, args) {
artilleryVersion: {
core: global.artillery.version
},
targetUrl: script.config.target
// Properties from the runnable script object:
testConfig: {
target: script.config.target,
phases: script.config.phases,
plugins: script.config.plugins,
environment: script._environment,
scriptPath: script._scriptPath,
configPath: script._configPath
}
}
});

Expand Down
19 changes: 16 additions & 3 deletions packages/artillery/lib/platform/aws-ecs/legacy/run-cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ const dotenv = require('dotenv');

const util = require('./util');

const generateId = require('../../../util/generate-id');

const setDefaultAWSCredentials = require('../../aws/aws-set-default-credentials');

module.exports = runCluster;
Expand Down Expand Up @@ -76,6 +74,7 @@ const {
let IS_FARGATE = false;

const TEST_RUN_STATUS = require('./test-run-status');
const prepareTestExecutionPlan = require('../../../util/prepare-test-execution-plan');

function setupConsoleReporter(quiet) {
const reporterOpts = {
Expand Down Expand Up @@ -218,6 +217,11 @@ async function tryRunCluster(scriptPath, options, artilleryReporter) {
}

let context = {};
const inputFiles = [].concat(scriptPath, options.config || []);
const runnableScript = await prepareTestExecutionPlan(inputFiles, options);

context.runnableScript = runnableScript;

let absoluteScriptPath;
if (typeof scriptPath !== 'undefined') {
absoluteScriptPath = path.resolve(process.cwd(), scriptPath);
Expand Down Expand Up @@ -1622,7 +1626,16 @@ async function launchLeadTask(context) {
}),
artilleryVersion: JSON.stringify({
core: global.artillery.version
})
}),
// Properties from the runnable script object:
testConfig: {
target: context.runnableScript.config.target,
phases: context.runnableScript.config.phases,
plugins: context.runnableScript.config.plugins,
environment: context.runnableScript._environment,
scriptPath: context.runnableScript._scriptPath,
configPath: context.runnableScript._configPath,
}
};

artillery.globalEvents.emit('metadata', metadata);
Expand Down

0 comments on commit 4cdadc9

Please sign in to comment.