K6 scripts to run load tests against Keycloak
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

24 lines
723 B

import { check } from 'k6';
import { wrapWithErrorCounting, Keycloak, getTestConfig, setupOpenSessions, pickRandom } from "./lib/keycloak.js";
import { randomSeed } from 'k6';
export let options = {
stages: [
{ duration: "20s", target: 5 },
{ duration: "2m", target: 300 }
],
};
const config = getTestConfig();
randomSeed(__VU);
let keycloak = new Keycloak(config.keycloakURL, { offlineTokens: config.offlineTokens });
export const setup = setupOpenSessions(keycloak, config.realmCount, config.sessionCount);
function testKCUserInfo(mySessions) {
let session = pickRandom(mySessions);
keycloak.userinfo(session.realm.id, session.tokens, check);
}
export default wrapWithErrorCounting(testKCUserInfo);