Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: artilleryio/artillery
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5d64f5198ddcc34acab0b1910c124a512d473874
Choose a base ref
..
head repository: artilleryio/artillery
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fbd2705578d8bcb9868db1518cf9cbe9da42407b
Choose a head ref
Showing with 7 additions and 6 deletions.
  1. +7 −6 packages/artillery/test/cloud-e2e/fargate/sigterm-handle.test.js
13 changes: 7 additions & 6 deletions packages/artillery/test/cloud-e2e/fargate/sigterm-handle.test.js
Original file line number Diff line number Diff line change
@@ -33,6 +33,7 @@ beforeEach(async (t) => {
test('Correctly handles early task termination', async (t) => {
const scenarioPath = `${__dirname}/fixtures/sigterm.yml`;
process.env.ARTILLERY_TEST_RUN_ID = generateId('t');
process.env.ARTILLERY_CLOUD_API_KEY = 'a9_ZZI_BQJrpz_QyReQ0yBpycR26nYhlD3J';

let testRunProcess;
let exitCode;
@@ -67,7 +68,7 @@ test('Correctly handles early task termination', async (t) => {
throwHttpErrors: false
});
} catch (err) {
t.fail(`Error fetching data from Artillery Cloud API: ${err}`);
t.error(`Error fetching data from Artillery Cloud API: ${err}`);
}
// Make sure the workers have started before stopping the task
testStarted =
@@ -87,30 +88,30 @@ test('Correctly handles early task termination', async (t) => {
.promise();
console.log('Stopped Task: ', stoppedTask);
} catch (err) {
t.fail(`Error calling ecs.stopTask: ${err}`);
t.error(`Error calling ecs.stopTask: ${err}`);
}
});

// If testRunProcess takes longer than 60sec to finish, it means the process didn't exit early.

const timeout = new Promise((_, reject) => {
const timeout = new Promise((resolve) => {
setTimeout(() => {
reject(
resolve(
new Error('Artillery test run did not exit within 60s as expected.')
);
}, 60000);
});

try {
await Promise.race([testRunProcess, sleep(60000)]);
await Promise.race([testRunProcess, timeout]);
} catch (err) {
t.fail(err.message);
}

const reportExists = fs.existsSync(t.context.reportFilePath);
t.ok(exitCode && output, 'Artillery should exit early when task is stopped');
t.equal(exitCode, 7, 'Exit code should be 7');
t.ok(output.includes('Summary report @'), 'Should log the summary report');
t.ok(output.includes('Summary report'), 'Should log the summary report');
t.ok(reportExists, 'Should generate report file');

if (reportExists) {