Merge pull request #35863 from BerriAI/litellm_/vigilant-bell-8e5b37
Some checks are pending
Unit Tests: Documentation Validation / documentation (push) Waiting to run
Unit Tests: Proxy DB Operations / proxy-server-core (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / proxy-utils (push) Blocked by required conditions
Unit Tests: Proxy Legacy Tests / proxy-server-extras (push) Waiting to run
Unit Tests: Responses, Caching & Types / responses-caching-types (push) Waiting to run
CodSpeed Benchmarks / benchmarks (push) Waiting to run
Code Quality Checks / code-quality (push) Waiting to run
UI Unit Tests / ui-unit-tests (push) Waiting to run
Unit Tests: Core Utilities / core-utils (push) Waiting to run
Unit Tests: Enterprise, Google GenAI & Routing / enterprise-routing (push) Waiting to run
Unit Tests: Integrations (Callbacks & Logging) / integrations (push) Waiting to run
Unit Tests: LLM Provider Transformations / Vertex AI (push) Waiting to run
Unit Tests: LLM Provider Transformations / All Other Providers (push) Waiting to run
Unit Tests: MCP, Secrets, Containers & Misc / misc (push) Waiting to run
Unit Tests: Proxy Auth & Key Management / proxy-auth (push) Waiting to run
Unit Tests: Proxy DB Operations / assert-shard-coverage (push) Waiting to run
Unit Tests: Proxy DB Operations / auth-checks (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / budgets (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / custom-logging (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / db-and-spend (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / endpoints-and-responses (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / guardrails-hooks (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / jwt-and-keys (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / key-generation (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / logging-misc (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / proxy-runtime (push) Blocked by required conditions
Unit Tests: Proxy API Endpoints / proxy-endpoints (push) Waiting to run
Unit Tests: Proxy API Endpoints / proxy-server (push) Waiting to run
Unit Tests: Proxy Infrastructure / proxy-infra (push) Waiting to run
Unit Tests: Proxy Legacy Tests / auth-and-jwt (push) Waiting to run
Unit Tests: Proxy Legacy Tests / key-generation (push) Waiting to run
Unit Tests: Proxy Legacy Tests / proxy-config (push) Waiting to run
Unit Tests: Proxy Legacy Tests / proxy-response-and-misc (push) Waiting to run
Unit Tests: Proxy Legacy Tests / proxy-server (push) Waiting to run
Unit Tests: Proxy Legacy Tests / proxy-token-counter (push) Waiting to run
Unit Tests: Proxy Legacy Tests / proxy-user-auth-and-spend (push) Waiting to run
Unit Tests: Proxy Legacy Tests / proxy-utils (push) Waiting to run
GitHub Actions Security Analysis / zizmor (push) Waiting to run

test(e2e): self-seed the ui suite's password-login users in global setup
This commit is contained in:
yuneng-jiang 2026-08-04 18:17:10 -07:00 • committed by GitHub
commit 24dbd2b2db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 1 deletions

View file

@ -14,7 +14,9 @@ export enum Role {
TeamAdmin = "team_admin",
}
export const users: Record<Role, { email: string; password: string }> = {
export type SeedApiRole = "proxy_admin_viewer" | "internal_user" | "internal_user_viewer";
export const users: Record<Role, { email: string; password: string; seedApiRole?: SeedApiRole }> = {
[Role.ProxyAdmin]: {
email: "admin",
password: process.env.LITELLM_MASTER_KEY || "sk-1234",
@ -22,18 +24,22 @@ export const users: Record<Role, { email: string; password: string }> = {
[Role.ProxyAdminViewer]: {
email: "adminviewer@test.local",
password: "test",
seedApiRole: "proxy_admin_viewer",
},
[Role.InternalUser]: {
email: "internal@test.local",
password: "test",
seedApiRole: "internal_user",
},
[Role.InternalUserViewer]: {
email: "viewer@test.local",
password: "test",
seedApiRole: "internal_user_viewer",
},
[Role.TeamAdmin]: {
email: "teamadmin@test.local",
password: "test",
seedApiRole: "internal_user",
},
};

View file

@ -29,6 +29,26 @@ async function globalSetup() {
if (!settingsRes.ok()) {
throw new Error(`Enabling enable_projects_ui failed (${settingsRes.status()}): ${await settingsRes.text()}`);
}
for (const { email, password, seedApiRole } of Object.values(users)) {
if (!seedApiRole) {
continue;
}
const createRes = await api.post(`${UI_BASE_URL}${rootPath}/user/new`, {
headers: { Authorization: `Bearer ${masterKey}` },
data: { user_email: email, user_role: seedApiRole, auto_create_key: false },
});
if (!createRes.ok() && createRes.status() !== 409) {
throw new Error(`Seeding user ${email} failed (${createRes.status()}): ${await createRes.text()}`);
}
const passwordRes = await api.post(`${UI_BASE_URL}${rootPath}/user/update`, {
headers: { Authorization: `Bearer ${masterKey}` },
data: { user_email: email, password },
});
if (!passwordRes.ok()) {
throw new Error(`Setting password for ${email} failed (${passwordRes.status()}): ${await passwordRes.text()}`);
}
}
await api.dispose();
for (const role of Object.values(Role)) {