Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #17

Closed
wants to merge 3 commits into from
Closed
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
51 changes: 48 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,63 @@ Go to Actions > Trigger Loadtest > Run workflow.

In the dialog enter the following and replace the UPPERCASE words in the right column with the appropriate values (see explanation below).

| Use workflow from | DBP-1012-setup-loadtest-env |
| Branch to take tests and helm/cron setup from | main |
| Field | Value |
| --- | --- |
| Use workflow from | SPSH-1371 |
| Branch to take tests and helm/cron setup from | SPSH-1371 |
| sets PATTERN env var used as k6 input | PATTERN |
| sets CONFIG env var used as k6 input | CONFIG |
| name of test scenario defined in values.yaml | SCENARIO |
| execute cronjob scenario after install | true |

### Values explained

| Value | Description |
| --- | --- |
| PATTERN | a glob that matches a file in `loadtest/usecases`, i.e. `1` or `login` |
| CONFIG | one of spike, stress, breakpoint, debug; see `loadtest/util/config.ts` |
| CONFIG | one of spike, stress, breakpoint, debug, plateau; see `loadtest/util/config.ts` |
| SCENARIO | target environment; one of dev-scenario, staging-scenario, prod-scenario; see `charts/schulportal-load-tests/values.yaml` |

### Notes
#### Adding different load patterns
In `loadtest/util/config.ts` define an entry in the enum, extend the function that converts strings into enum values and add your desired configs.

```typescript
export enum CONFIG {
YOURCONFIG = "yourconfig",
// ...
}
export function getConfig(): CONFIG {
const config = __ENV["CONFIG"];
if (config == CONFIG.YOURCONFIG.toString()) return CONFIG.YOURCONFIG;
// ...
}

export function getDefaultOptions() {
const config = getConfig();
const maxVUs = MAX_VUS ?? 10;
switch (config) {
case CONFIG.YOURCONFIG:
return {
stages: [
{ duration: "30s", target: maxVUs }, // ramp up to maxVUs
{ duration: "30s", target: maxVUs }, // hold
{ duration: "10s", target: 0 }, // ramp down
],
// OPTIONAL: conditions to stop the test early
thresholds: {
http_req_failed: [{ threshold: "rate<0.10", abortOnFail: true }],
http_req_duration: [{ threshold: "p(95)<5000", abortOnFail: true }],
},
};
// ...
}
}
```

#### Running against different environments
In `charts/schulportal-load-tests/values.yaml` define a scenario with your desired base-url.

## Local

### Setup
Expand All @@ -45,6 +89,7 @@ Tests are categorized as
spike
stress
breakpoint
plateau
```

To run all usecases with the stress-configuration against `https://example.env/`:
Expand Down
Loading