mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 22:07:31 +00:00
test(session): load tests for session api (#9212)
# Which Problems Are Solved We currently are not able to benchmark the performance of the session api # How the Problems Are Solved Load tests were added to - use sessions in oidc tokens analog https://zitadel.com/docs/guides/integrate/login-ui/oidc-standard # Additional Context - Closes https://github.com/zitadel/zitadel/issues/7847
This commit is contained in:
25
load-test/src/membership.ts
Normal file
25
load-test/src/membership.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import http from 'k6/http';
|
||||
import { Trend } from 'k6/metrics';
|
||||
import url from './url';
|
||||
import { check, fail } from 'k6';
|
||||
|
||||
const addIAMMemberTrend = new Trend('membership_iam_member', true);
|
||||
export async function addIAMMember(userId: string, roles: string[], accessToken: string): Promise<void> {
|
||||
const res = await http.post(
|
||||
url('/admin/v1/members'),
|
||||
JSON.stringify({
|
||||
userId: userId,
|
||||
roles: roles,
|
||||
}),
|
||||
{
|
||||
headers: {
|
||||
authorization: `Bearer ${accessToken}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
);
|
||||
check(res, {
|
||||
'member added successful': (r) => r.status == 200 || fail(`unable add member: ${JSON.stringify(res)}`),
|
||||
});
|
||||
addIAMMemberTrend.add(res.timings.duration);
|
||||
}
|
Reference in New Issue
Block a user