Skip to content

Commit

Permalink
fix(runner): stop runner if test time exceeds the duration given (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
syncush committed Dec 26, 2020
1 parent e16a596 commit 387b552
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const runner = require('./models/runner'),
errorHandler = require('./handler/errorHandler'),
{ version: PREDATOR_RUNNER_VERSION } = require('../package.json');

const RUNNER_TIMEOUT_GRACE_MS = 300;

const getContainerId = () => {
let containerId = uuid();
if (process.env.MARATHON_APP_ID) {
Expand Down Expand Up @@ -45,7 +47,18 @@ let start = async () => {
});
process.exit(1);
});
process.on('SIGUSR1', async function() {
logger.info('Runner exceeded test duration, sending DONE status and existing');
await reporterConnector.postStats(jobConfig, {
phase_status: 'done',
data: JSON.stringify({ message: 'Test Finished' })
});
process.exit(1);
});
verifyPredatorVersion();
setTimeout(function() {
process.kill(process.pid, 'SIGUSR1');
}, (jobConfig.duration * 1000) + jobConfig.delayRunnerMs + RUNNER_TIMEOUT_GRACE_MS);
await runner.runTest(jobConfig);
logger.info('Finished running test successfully');
process.exit(0);
Expand Down

1 comment on commit 387b552

@roychri
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes the test to fail and the results to become unavailable with "The test failed, there is no data to present. Please check test logs".
But I was doing a test with a single scenario with 2 simple GET requests.
Wouldn't it timeout often if some of the last requests of the scenario happens took more than RUNNER_TIMEOUT_GRACE_MS ?
The grace period should be at least configurable, 300ms is way too low.
I used for my test:
Duration: 10m
RPS: 1
Ramp to: 2
Parallelism: 1

I see someone already reported similar problem in #56

Please sign in to comment.