feat: Added k6 performance tests

This commit is contained in:
2026-05-10 22:00:24 +02:00
commit 5f7dd2e281
9 changed files with 290 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
import { chessUserJourney } from '../scenarios/chessUserScenario.js';
import { thresholds } from '../config.js';
const CONCURRENT_USERS = parseInt(__ENV.CONCURRENT_USERS || '3', 10);
const DURATION = parseInt(__ENV.DURATION || '300', 10);
export const options = {
vus: CONCURRENT_USERS,
duration: `${DURATION}s`,
thresholds,
};
export default function () {
chessUserJourney();
}
+16
View File
@@ -0,0 +1,16 @@
import { chessUserJourney } from '../scenarios/chessUserScenario.js';
import { thresholds } from '../config.js';
const MAX_USERS = parseInt(__ENV.MAX_USERS || '5', 10);
const RAMP_DURATION = parseInt(__ENV.RAMP_DURATION || '60', 10);
export const options = {
stages: [
{ duration: `${RAMP_DURATION}s`, target: MAX_USERS },
],
thresholds,
};
export default function () {
chessUserJourney();
}
+12
View File
@@ -0,0 +1,12 @@
import { chessUserJourney } from '../scenarios/chessUserScenario.js';
import { thresholds } from '../config.js';
export const options = {
vus: 1,
duration: '1m',
thresholds,
};
export default function () {
chessUserJourney();
}
+21
View File
@@ -0,0 +1,21 @@
import { chessUserJourney } from '../scenarios/chessUserScenario.js';
import { thresholds } from '../config.js';
const BASELINE_USERS = parseInt(__ENV.BASELINE_USERS || '2', 10);
const BASELINE_DURATION = parseInt(__ENV.BASELINE_DURATION || '20', 10);
const SPIKE_USERS = parseInt(__ENV.SPIKE_USERS || '15', 10);
export const options = {
stages: [
{ duration: `${BASELINE_DURATION}s`, target: BASELINE_USERS },
{ duration: '1s', target: BASELINE_USERS + SPIKE_USERS },
{ duration: '5s', target: BASELINE_USERS + SPIKE_USERS },
{ duration: '1s', target: BASELINE_USERS },
{ duration: `${BASELINE_DURATION}s`, target: BASELINE_USERS },
],
thresholds,
};
export default function () {
chessUserJourney();
}
+34
View File
@@ -0,0 +1,34 @@
import { chessUserJourney } from '../scenarios/chessUserScenario.js';
import { thresholds } from '../config.js';
const START_USERS = parseInt(__ENV.START_USERS || '2', 10);
const USERS_INCREMENT = parseInt(__ENV.USERS_INCREMENT || '2', 10);
const STEPS = parseInt(__ENV.STEPS || '2', 10);
const STEP_DURATION = parseInt(__ENV.STEP_DURATION || '30', 10);
const RAMP_DURATION = parseInt(__ENV.RAMP_DURATION || '10', 10);
const stages = [];
let currentUsers = START_USERS;
for (let i = 0; i < STEPS; i++) {
// Ramp up
stages.push({
duration: `${RAMP_DURATION}s`,
target: currentUsers,
});
// Hold at level
stages.push({
duration: `${STEP_DURATION}s`,
target: currentUsers,
});
currentUsers += USERS_INCREMENT;
}
export const options = {
stages,
thresholds,
};
export default function () {
chessUserJourney();
}