Skip to content

Commit

Permalink
add plateau config
Browse files Browse the repository at this point in the history
  • Loading branch information
clauyan committed Nov 27, 2024
1 parent 60ff9c7 commit 2aa1e71
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions loadtest/util/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ export const MAX_VUS = Number.parseInt(__ENV["MAX_VUS"]);
export enum CONFIG {
SPIKE = "spike",
STRESS = "stress",
PLATEAU = "plateau",
BREAKPOINT = "breakpoint",
DEBUG = "debug",
}
export function getConfig(): CONFIG {
const config = __ENV["CONFIG"];
if (config == CONFIG.SPIKE.toString()) return CONFIG.SPIKE;
if (config == CONFIG.STRESS.toString()) return CONFIG.STRESS;
if (config == CONFIG.PLATEAU.toString()) return CONFIG.PLATEAU;
if (config == CONFIG.BREAKPOINT.toString()) return CONFIG.BREAKPOINT;
if (config == CONFIG.DEBUG.toString()) return CONFIG.DEBUG;
throw Error(`Invalid value for config '${config}'`);
Expand Down Expand Up @@ -40,6 +42,14 @@ export function getDefaultOptions() {
{ duration: "1m", target: 0 }, // ramp down 3
],
};
case CONFIG.PLATEAU:
return {
stages: [
{ duration: "1m", target: maxVUs }, // ramp up
{ duration: "5m", target: maxVUs }, // plateau
{ duration: "1m", target: 0 }, // ramp down
],
};
case CONFIG.BREAKPOINT:
return {
stages: [{ duration: "10m", target: 10 * maxVUs }],
Expand Down

0 comments on commit 2aa1e71

Please sign in to comment.