support other than localhost
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
@ -25,6 +25,8 @@ from authentik.tenants.models import Domain, Tenant
|
||||
|
||||
settings.CELERY["task_always_eager"] = True
|
||||
|
||||
host = environ.get("BENCH_HOST", "localhost")
|
||||
|
||||
|
||||
def user_list():
|
||||
# Number of users, groups per user, parents per groups
|
||||
@ -51,7 +53,7 @@ def user_list():
|
||||
tenant_name = f"user-list-{user_count}-{groups_per_user}-{parents_per_group}"
|
||||
|
||||
t = Tenant.objects.create(schema_name=f"t_{tenant_name.replace('-', '_')}", name=uuid4())
|
||||
Domain.objects.create(tenant=t, domain=f"{tenant_name}.localhost")
|
||||
Domain.objects.create(tenant=t, domain=f"{tenant_name}.{host}")
|
||||
|
||||
with t:
|
||||
Group.objects.bulk_create([Group(name=uuid4()) for _ in range(groups_per_user * 5)])
|
||||
@ -81,7 +83,7 @@ def user_list():
|
||||
|
||||
def login():
|
||||
t = Tenant.objects.create(schema_name=f"t_login_no_mfa", name=uuid4())
|
||||
Domain.objects.create(tenant=t, domain=f"login-no-mfa.localhost")
|
||||
Domain.objects.create(tenant=t, domain=f"login-no-mfa.{host}")
|
||||
|
||||
with t:
|
||||
user = User(username="test", name=uuid4())
|
||||
@ -89,7 +91,7 @@ def login():
|
||||
user.save()
|
||||
|
||||
t = Tenant.objects.create(schema_name=f"t_login_with_mfa", name=uuid4())
|
||||
Domain.objects.create(tenant=t, domain=f"login-with-mfa.localhost")
|
||||
Domain.objects.create(tenant=t, domain=f"login-with-mfa.{host}")
|
||||
|
||||
with t:
|
||||
user = User(username="test", name=uuid4())
|
||||
@ -127,7 +129,7 @@ def provider_oauth2():
|
||||
tenant_name = f"provider-oauth2-{user_policies_count}-{group_policies_count}-{expression_policies_count}"
|
||||
|
||||
t = Tenant.objects.create(schema_name=f"t_{tenant_name.replace('-', '_')}", name=uuid4())
|
||||
Domain.objects.create(tenant=t, domain=f"{tenant_name}.localhost")
|
||||
Domain.objects.create(tenant=t, domain=f"{tenant_name}.{host}")
|
||||
|
||||
with t:
|
||||
user = User(username="test", name=uuid4())
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import http from "k6/http";
|
||||
import { check, fail } from "k6";
|
||||
|
||||
const host = __ENV.BENCH_HOST ? __ENV.BENCH_HOST : "localhost";
|
||||
|
||||
export const options = {
|
||||
scenarios: Object.fromEntries(
|
||||
["no-mfa", "with-mfa"].map((obj, i) => [
|
||||
@ -23,7 +25,7 @@ export const options = {
|
||||
|
||||
export default function () {
|
||||
const domain = __ENV.DOMAIN;
|
||||
const url = `http://${domain}.localhost:9000/api/v3/flows/executor/default-authentication-flow/`;
|
||||
const url = `http://${domain}.${host}:9000/api/v3/flows/executor/default-authentication-flow/`;
|
||||
const cookieJar = new http.CookieJar();
|
||||
const params = {
|
||||
jar: cookieJar,
|
||||
|
||||
@ -3,6 +3,8 @@ import exec from "k6/execution";
|
||||
import http from "k6/http";
|
||||
import { check, fail } from "k6";
|
||||
|
||||
const host = __ENV.BENCH_HOST ? __ENV.BENCH_HOST : "localhost";
|
||||
|
||||
const testcases = [
|
||||
[0, 0, 0],
|
||||
[10, 0, 0],
|
||||
@ -53,7 +55,7 @@ export function setup() {
|
||||
const user_policies_count = testcase[0];
|
||||
const group_policies_count = testcase[1];
|
||||
const expression_policies_count = testcase[2];
|
||||
const domain = `provider-oauth2-${user_policies_count}-${group_policies_count}-${expression_policies_count}.localhost:9000`;
|
||||
const domain = `provider-oauth2-${user_policies_count}-${group_policies_count}-${expression_policies_count}.${host}:9000`;
|
||||
const url = `http://${domain}/api/v3/flows/executor/default-authentication-flow/`;
|
||||
const params = {
|
||||
headers: {
|
||||
@ -119,7 +121,7 @@ export default function (data) {
|
||||
const user_policies_count = Number(__ENV.USER_POLICIES_COUNT);
|
||||
const group_policies_count = Number(__ENV.GROUP_POLICIES_COUNT);
|
||||
const expression_policies_count = Number(__ENV.EXPRESSION_POLICIES_COUNT);
|
||||
const domain = `provider-oauth2-${user_policies_count}-${group_policies_count}-${expression_policies_count}.localhost:9000`;
|
||||
const domain = `provider-oauth2-${user_policies_count}-${group_policies_count}-${expression_policies_count}.${host}:9000`;
|
||||
const params = {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
||||
@ -2,6 +2,8 @@ import exec from "k6/execution";
|
||||
import http from "k6/http";
|
||||
import { check } from "k6";
|
||||
|
||||
const host = __ENV.BENCH_HOST ? __ENV.BENCH_HOST : "localhost";
|
||||
|
||||
export const options = {
|
||||
discardResponseBodies: true,
|
||||
scenarios: Object.fromEntries(
|
||||
@ -64,7 +66,7 @@ export default function () {
|
||||
const groups_per_user = Number(__ENV.GROUPS_PER_USER);
|
||||
const parents_per_group = Number(__ENV.PARENTS_PER_GROUP);
|
||||
const with_groups = Number(__ENV.WITH_GROUPS);
|
||||
const domain = `user-list-${user_count}-${groups_per_user}-${parents_per_group}.localhost:9000`;
|
||||
const domain = `user-list-${user_count}-${groups_per_user}-${parents_per_group}.${host}:9000`;
|
||||
const page_size = Number(__ENV.PAGE_SIZE);
|
||||
const pages = Math.round(user_count / page_size);
|
||||
let requests = [];
|
||||
|
||||
Reference in New Issue
Block a user