Skip to content

Commit

Permalink
Spsh 1371 (#20)
Browse files Browse the repository at this point in the history
* Update README.md

fixed formatting

* add scenario

* adapt action

* add plateau config

* temp fix for login

* adapt some config

* setup for alg test

* tag requests simpler

* increase setup timeout

* simplify tag

* label batch delete properly

* disable setup in login

* reenable tls check

* quick fix for uc

* Update README.md

* clean up for merge

* formatting

* file extensions

* update readme
  • Loading branch information
clauyan authored Dec 10, 2024
1 parent 8d7744e commit 61c46ef
Show file tree
Hide file tree
Showing 151 changed files with 28,899 additions and 19,691 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/trigger-loadtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
description: "Branch to take test code and helm/cron setup from"
required: false
type: string
default: "main"
default: main
branch_img:
description: "Branch to take Dockerfile/img from"
required: false
Expand Down
49 changes: 47 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ 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 |
| Field | Value |
| --- | --- |
| Use workflow from | main |
| Branch to take tests and helm/cron setup from | main |
| sets PATTERN env var used as k6 input | PATTERN |
| sets CONFIG env var used as k6 input | CONFIG |
Expand All @@ -17,10 +19,52 @@ In the dialog enter the following and replace the UPPERCASE words in the right c

### 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
129 changes: 57 additions & 72 deletions loadtest/api-client/generated/AuthApi.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 61c46ef

Please sign in to comment.