Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions test/e2e/soak/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,29 @@ async function soakTest() {

log.info('Setup complete. Starting soak tests...');

await doSoakTest('randomSubmission', 50, 1_000, 30_000, 100, n => randomSubmission(n, projectId, formId));
await doSoakTest({
name: 'randomSubmission',
throughput: 50,
throughputPeriod: 1_000,
testDuration: 30_000,
minimumSuccessThreshold: 100,
fn: n => randomSubmission(n, projectId, formId),
});

// TODO work out a more scientific sleep duration
const backgroundJobPause = 20_000;
log.info(`Sleeping ${durationForHumans(backgroundJobPause)} to allow central-backend to complete background jobs...`);
await new Promise(resolve => { setTimeout(resolve, backgroundJobPause); });
log.info('Woke up.');

await doSoakTest('exportZipWithDataAndMedia', 10, 3_000, 300_000, 0, n => exportZipWithDataAndMedia(n, projectId, formId));
await doSoakTest({
name: 'exportZipWithDataAndMedia',
throughput: 10,
throughputPeriod: 3_000,
testDuration: 300_000,
minimumSuccessThreshold: 0,
fn: n => exportZipWithDataAndMedia(n, projectId, formId),
});

log.info(`Check for extra logs at ${logPath}`);

Expand All @@ -74,7 +88,7 @@ async function soakTest() {
process.exit(0);
}

function doSoakTest(name, throughput, throughputPeriod, testDuration, minimumSuccessThreshold, fn) {
function doSoakTest({ name, throughput, throughputPeriod, testDuration, minimumSuccessThreshold, fn }) {
log.info('Starting soak test:', name);
log.info(' throughput:', throughput, 'per period');
log.info(' throughputPeriod:', throughputPeriod, 'ms');
Expand Down