Files
openobserve/tests/ui-testing/playwright-tests/auth-warm.spec.js
T
Shrinath Rao 49448334ed test(alpha1): split shard logins across multiple Dex users (#13602)
## What
Lets alpha1 shards log in as **different Dex users** instead of all
hammering the cloud env as one user. Paired with
**openobserve/o2-enterprise#2333** (the workflow wiring).

## Why
- **Load distribution** — spreads API/session load across users if the
env rate-limits per user.
- **Blast radius** — one user's account/session issue stops ~1/3 of
shards, not all.
- Test **data isolation is unchanged** (still per-org); this is purely
about the login user.

## Changes (OSS)
- `global-setup-alpha1.js` — new `ALPHA1_USER_INDEX` (1|2|3) selects the
Dex user: email resolves from `ALPHA1_USER_EMAIL_<N>`, **falling back to
`ALPHA1_USER_EMAIL`** when the indexed secret isn't set (safe
incremental rollout). Password shared (`ALPHA1_USER_PASSWORD`).
- Auth **filenames stay canonical** (`user.json` / `cloud-config.json`)
— ~20 specs + shared utils read those exact paths. The per-user split
happens at the CI layer (each shard downloads only its user's artifact
into the canonical path), so no spec changes needed.
- New `auth-warm.spec.js` — a login-only spec the barrier uses to mint
auth artifacts for users 2..N **without** running the heavy org-wide
cleanup.

## Default behaviour
With no index set, everything resolves to user 1 — identical to today.

## Enterprise PR
openobserve/o2-enterprise#2333
2026-08-03 15:00:09 +00:00

36 lines
1.7 KiB
JavaScript

const { test, expect } = require('@playwright/test');
const testLogger = require('./utils/test-logger.js');
/**
* Auth-warm spec — mints a shared-auth artifact WITHOUT running the heavy
* org-wide cleanup.
*
* The alpha1 barrier (pre_test_cleanup job) splits its Dex logins across multiple
* users (ALPHA1_USER_INDEX). User 1 runs cleanup.spec.js (which also mints its
* artifact via globalSetup); users 2..N have no cleanup to do, so they run THIS
* spec instead. globalSetup already performed the Dex login and wrote
* user<N>.json / cloud-config<N>.json before this test executes — all this test
* does is confirm the session loads, so the job fails loudly if login didn't take.
*
* Runs with SKIP_INGESTION=true in the barrier (no per-shard ingestion here).
*/
test.describe('Alpha1 auth warm-up', () => {
test('minted session is usable', {
tag: ['@auth-warm', '@all']
}, async ({ page, baseURL }) => {
const userIndex = (process.env.ALPHA1_USER_INDEX || '1').trim();
testLogger.info(`[alpha1] auth-warm: verifying minted session for user index ${userIndex}`);
await page.goto(`${baseURL}/web/`, { timeout: 60000, waitUntil: 'domcontentloaded' });
// If the saved session were invalid we'd be bounced to Dex/login here.
const url = page.url();
expect(url, `expected an authenticated app URL, got ${url}`).not.toContain('dex');
expect(url, `expected an authenticated app URL, got ${url}`).not.toMatch(/\/web\/login$/);
// Home menu item is only present once the SPA has an authenticated session.
await expect(page.locator('[data-test="menu-link-\\/-item"]')).toBeVisible({ timeout: 30000 });
testLogger.info(`[alpha1] auth-warm: session for user index ${userIndex} is valid`);
});
});