Skip to content

Commit

Permalink
wip: start recreating logout-flow
Browse files Browse the repository at this point in the history
  • Loading branch information
clauyan committed Oct 16, 2024
1 parent dadaa9d commit 02cb8bb
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
44 changes: 44 additions & 0 deletions loadtest/usecases/0_saml-logout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { check, fail, sleep } from "k6";
import { makeHttpRequest } from "../util/api.ts";
import { defaultTimingCheck, getStatusChecker } from "../util/checks.ts";
import { getDefaultOptions } from "../util/config.ts";
import { prettyLog } from "../util/debug.ts";
import { loadPage, navigateToHomepage } from "../util/page.ts";
import { UserMix } from "../util/users.ts";
import http from "k6/http";

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

const serviceProviderName = "School-SH";

export default function main(users = new UserMix({ LEHR: 1 })) {
const providers = navigateToHomepage(users);
const target = providers.find((p) => p.name == serviceProviderName);
if (!target) fail(`could not find sp ${serviceProviderName}`);
loadPage(target.url);

// hit logout button in spsh
let res = makeHttpRequest("get", "auth/logout", {
params: { redirects: 0 },
});
check(res, {
"got 302": getStatusChecker(302),
...defaultTimingCheck,
});

res = http.get(res.headers["Location"], {
redirects: 0,
});

// WIP

check(res, {
// "got 302": getStatusChecker(302),
...defaultTimingCheck,
});

prettyLog(res);
sleep(1);
}
4 changes: 2 additions & 2 deletions loadtest/usecases/2_goto-sp-saml.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { fail, sleep } from "k6";
import { getDefaultOptions } from "../util/config.ts";
import { loadPage, navigateToHomepage } from "../util/page.ts";
import { getDefaultAdminMix } from "../util/users.ts";
import { UserMix } from "../util/users.ts";

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

const serviceProviderName = "School-SH";

export default function main(users = getDefaultAdminMix()) {
export default function main(users = new UserMix({ LEHR: 1 })) {
const providers = navigateToHomepage(users);
const target = providers.find((p) => p.name == serviceProviderName);
if (!target) fail(`could not find sp ${serviceProviderName}`);
Expand Down

0 comments on commit 02cb8bb

Please sign in to comment.