mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-11 00:25:12 +00:00
fix(load-tests): accept any 2xx status as success (#10450)
Adjust status checks across various functions to accept any 2xx HTTP response instead of only 200, improving the robustness of the API response validation. fixes #10436
This commit is contained in:
@@ -50,7 +50,7 @@ export function createHuman(username: string, org: Org, accessToken: string): Pr
|
||||
response
|
||||
.then((res) => {
|
||||
check(res, {
|
||||
'create user is status ok': (r) => r.status === 200,
|
||||
'create user is status ok': (r) => r.status >= 200 && r.status < 300,
|
||||
}) || reject(`unable to create user(username: ${username}) status: ${res.status} body: ${res.body}`);
|
||||
createHumanTrend.add(res.timings.duration);
|
||||
|
||||
@@ -79,7 +79,7 @@ export async function setEmailOTPOnHuman(user: User, org: Org, accessToken: stri
|
||||
},
|
||||
});
|
||||
check(response, {
|
||||
'set email otp status ok': (r) => r.status === 200,
|
||||
'set email otp status ok': (r) => r.status >= 200 && r.status < 300,
|
||||
});
|
||||
setEmailOTPOnHumanTrend.add(response.timings.duration);
|
||||
|
||||
@@ -144,7 +144,7 @@ export function createMachine(username: string, org: Org, accessToken: string):
|
||||
response
|
||||
.then((res) => {
|
||||
check(res, {
|
||||
'create user is status ok': (r) => r.status === 200,
|
||||
'create user is status ok': (r) => r.status >= 200 && r.status < 300,
|
||||
}) || reject(`unable to create user(username: ${username}) status: ${res.status} body: ${res.body}`);
|
||||
createMachineTrend.add(res.timings.duration);
|
||||
|
||||
@@ -179,7 +179,7 @@ export function addMachinePat(userId: string, org: Org, accessToken: string): Pr
|
||||
});
|
||||
response.then((res) => {
|
||||
check(res, {
|
||||
'add pat status ok': (r) => r.status === 200,
|
||||
'add pat status ok': (r) => r.status >= 200 && r.status < 300,
|
||||
}) || reject(`unable to add pat (user id: ${userId}) status: ${res.status} body: ${res.body}`);
|
||||
|
||||
addMachinePatTrend.add(res.timings.duration);
|
||||
@@ -205,7 +205,7 @@ export function addMachineSecret(userId: string, org: Org, accessToken: string):
|
||||
});
|
||||
response.then((res) => {
|
||||
check(res, {
|
||||
'generate machine secret status ok': (r) => r.status === 200,
|
||||
'generate machine secret status ok': (r) => r.status >= 200 && r.status < 300,
|
||||
}) || reject(`unable to generate machine secret (user id: ${userId}) status: ${res.status} body: ${res.body}`);
|
||||
|
||||
addMachineSecretTrend.add(res.timings.duration);
|
||||
@@ -240,7 +240,7 @@ export function addMachineKey(userId: string, org: Org, accessToken: string, pub
|
||||
);
|
||||
response.then((res) => {
|
||||
check(res, {
|
||||
'generate machine key status ok': (r) => r.status === 200,
|
||||
'generate machine key status ok': (r) => r.status >= 200 && r.status < 300,
|
||||
}) || reject(`unable to generate machine Key (user id: ${userId}) status: ${res.status} body: ${res.body}`);
|
||||
|
||||
addMachineKeyTrend.add(res.timings.duration);
|
||||
@@ -263,7 +263,7 @@ export function lockUser(userId: string, org: Org, accessToken: string): Promise
|
||||
response
|
||||
.then((res) => {
|
||||
check(res, {
|
||||
'update user is status ok': (r) => r.status === 201,
|
||||
'update user is status ok': (r) => r.status >= 200 && r.status < 300,
|
||||
});
|
||||
lockUserTrend.add(res.timings.duration);
|
||||
resolve(res);
|
||||
|
||||
Reference in New Issue
Block a user