mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-06 14:22:15 +00:00
test: add load test for session creation (#8088)
# Which Problems Are Solved Extends load tests by testing session creation. # How the Problems Are Solved The test creates a session including a check for user id. # Additional Context - part of https://github.com/zitadel/zitadel/issues/7639
This commit is contained in:
@@ -171,6 +171,32 @@ export function addMachinePat(userId: string, org: Org, accessToken: string): Pr
|
||||
});
|
||||
}
|
||||
|
||||
export type MachineSecret = {
|
||||
clientId: string;
|
||||
clientSecret: string;
|
||||
};
|
||||
|
||||
const addMachineSecretTrend = new Trend('user_add_machine_secret_duration', true);
|
||||
export function addMachineSecret(userId: string, org: Org, accessToken: string): Promise<MachineSecret> {
|
||||
return new Promise((resolve, reject) => {
|
||||
let response = http.asyncRequest('PUT', url(`/management/v1/users/${userId}/secret`), null, {
|
||||
headers: {
|
||||
authorization: `Bearer ${accessToken}`,
|
||||
'Content-Type': 'application/json',
|
||||
'x-zitadel-orgid': org.organizationId,
|
||||
},
|
||||
});
|
||||
response.then((res) => {
|
||||
check(res, {
|
||||
'generate machine secret status ok': (r) => r.status === 200,
|
||||
}) || reject(`unable to generate machine secret (user id: ${userId}) status: ${res.status} body: ${res.body}`);
|
||||
|
||||
addMachineSecretTrend.add(res.timings.duration);
|
||||
resolve(res.json()! as MachineSecret);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const lockUserTrend = new Trend('lock_user_duration', true);
|
||||
export function lockUser(userId: string, org: Org, accessToken: string): Promise<RefinedResponse<any>> {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
Reference in New Issue
Block a user