Skip to content

Commit

Permalink
clean up + updates
Browse files Browse the repository at this point in the history
  • Loading branch information
clauyan committed Nov 19, 2024
1 parent 2343f33 commit eb7649c
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 4,508 deletions.
4,495 changes: 1 addition & 4,494 deletions loadtest/api-client/openapispec.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions loadtest/pages/user-list.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
DBiamPersonenuebersichtResponse,
FindRollenResponse,
OrganisationResponse,
RolleWithServiceProvidersResponse,
} from "../api-client/generated/index.ts";
import {
getLoginInfo,
Expand All @@ -17,7 +17,7 @@ import { PageObject } from "./index.ts";
type FetchedData = {
organisationen: OrganisationResponse[];
personenuebersichten: DBiamPersonenuebersichtResponse[];
rollen: RolleWithServiceProvidersResponse[];
rollen: FindRollenResponse;
};
class UserListPage implements PageObject {
name = "UserList";
Expand Down
4 changes: 2 additions & 2 deletions loadtest/usecases/1_login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { loginPage } from "../pages/login.ts";
import { defaultHttpCheck, defaultTimingCheck } from "../util/checks.ts";
import { getDefaultOptions } from "../util/config.ts";
import { wrapTestFunction } from "../util/usecase-wrapper.ts";
import { getDefaultUserMix } from "../util/users.ts";
import { getDefaultAdminMix } from "../util/users.ts";

const successfulLoginCounter = new Counter("successful_logins_counter");
const successfulLoginDuration = new Trend("successful_logins_duration", true);
const users = getDefaultUserMix();
const users = getDefaultAdminMix();

export const options = {
...getDefaultOptions(),
Expand Down
6 changes: 3 additions & 3 deletions loadtest/usecases/1_show-start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { group, sleep } from "k6";
import { getDefaultOptions } from "../util/config.ts";
import { login } from "../util/page.ts";
import { wrapTestFunction } from "../util/usecase-wrapper.ts";
import { getDefaultUserMix } from "../util/users.ts";
import { getDefaultAdminMix } from "../util/users.ts";

const users = getDefaultUserMix();
const users = getDefaultAdminMix();

export const options = {
...getDefaultOptions(users),
...getDefaultOptions(),
};

export default wrapTestFunction(main);
Expand Down
4 changes: 2 additions & 2 deletions loadtest/usecases/1_show-user-list.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { group, sleep } from "k6";
import { group } from "k6";
import { DBiamPersonenuebersichtResponse } from "../api-client/generated/index.ts";
import { userListPage } from "../pages/user-list.ts";
import {
Expand Down Expand Up @@ -34,7 +34,7 @@ function main(users = getDefaultAdminMix()) {
getLoginInfo();
orgId = pickRandomItem(organisationen).id;
personenuebersicht = pickRandomItem(personenuebersichten);
rolleId = pickRandomItem(rollen).id;
rolleId = pickRandomItem(rollen.moeglicheRollen).id;
});

group("hit pages", () => {
Expand Down
3 changes: 1 addition & 2 deletions loadtest/util/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export function deleteKlasse(id: string) {
export function getPersonenIds(
personen?: PersonFrontendControllerFindPersons200Response,
): Set<string> {
if (!personen) personen = getPersonen();
if (!personen) personen = getPersonen(["limit=30"]);
return new Set(personen.items.map(({ person }) => person.id));
}

Expand Down Expand Up @@ -322,7 +322,6 @@ export function getResetPassword(query: Array<string>) {
}

export function putPersonLock(personId: string, lock: boolean) {
// TODO: befristung
const lockUserBodyParams: LockUserBodyParams = {
lock,
//@ts-expect-error openapi generator converts this to camelcase
Expand Down
2 changes: 1 addition & 1 deletion loadtest/util/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function getDefaultOptions() {
};
case CONFIG.BREAKPOINT:
return {
stages: [{ duration: "10m", target: 10 * maxVUs }],
stages: [{ duration: "10m", target: maxVUs }],
thresholds: {
http_req_failed: [{ threshold: "rate<0.10", abortOnFail: true }],
http_req_duration: [{ threshold: "p(95)<5000", abortOnFail: true }],
Expand Down
4 changes: 2 additions & 2 deletions loadtest/util/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ export class UserMix {

getUser(): User {
const currentRole = this.getCurrentRole();
const user = groupedUsers.get(currentRole);
const user = groupedUsers.get(currentRole)?.next();
if (!user)
throw new Error(
`user with requested role ${currentRole} is not present in ${DATAPATH}`,
);
return user.next();
return user;
}

getCurrentRole(): ROLE {
Expand Down

0 comments on commit eb7649c

Please sign in to comment.