mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
Three Playwright workers run three spec files at once, and on a fresh instance the first OIDC callback is what provisions the Nextcloud account. Concurrent callbacks then race on INSERT INTO oc_users for the same uid: one wins, the losers answer HTTP 500. The exception is SQLSTATE[23000] 1062 Duplicate entry 'keycloak-<sub>' for key 'PRIMARY', raised from the sociallogin app's ProviderService through OC\User\Manager::createUser, and it is visible both in the CI rescue bundle of run 34653754175 and in the container log of a local variant-1 deploy. The race is self-closing: once any insert wins, the window is shut for the rest of the run. It has never turned a job red, because Playwright's retries absorb it and a flaky-only run exits 0. What it costs is a rerun of the whole spec file, 1.8 minutes for fileslibreofficeedit against a 42 second first attempt, plus a flaky line in every report. Retrying inside the helper keeps that cost to one login. The base entry point now makes a second attempt after a five second pause, which resolveTimeout stretches to twenty five over Tor, and the observed failures abort after thirty to forty two seconds against a nine hundred second budget, so the second attempt has room. A persistent failure still fails, and the first attempt's message is appended to the second rather than swallowed, which the old wrapper's bare catch did not do. loginToStandaloneNextcloudWithRetry is gone: a helper of that name beside a base that retries is a trap, and its five callers now reach the same two attempts through the base. The other forty eight addon specs gain the retry without being touched. Rejected alternatives, each against a written constraint: a serial globalSetup would have to live in the playwright.config.js that 87 roles share and would force ignoreHTTPSErrors into the central use block; PLAYWRIGHT_WORKERS=1 reverses the measured Tor tuning in playwright_workers.py and leaks through an unnamed include_vars into every later role; pre-creating the account collides with prevent_create_email_exists and turns a one-off flake into a permanent login refusal. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
46 lines
1.9 KiB
JavaScript
46 lines
1.9 KiB
JavaScript
const { test, expect } = require("@playwright/test");
|
|
const { resolveTimeout } = require("../timeouts");
|
|
const { skipUnlessAddonEnabled } = require("../addon-gating");
|
|
const { skipUnlessServiceEnabled } = require("../service-gating");
|
|
const shared = require("../_shared");
|
|
|
|
// `user_ldap` is the LDAP auth-path plugin (backs the native credential form
|
|
// with the directory). It has no distinct in-app page; the deterministic
|
|
// browser-reachable proof that LDAP federation is live is that the LDAP-only
|
|
// `biber` persona — who has no local Nextcloud account — can authenticate and
|
|
// land on an authenticated shell. Reuse the shared LDAP-first-login retry flow
|
|
// rather than reimplementing LDAP mechanics. This is only meaningful in the
|
|
// native+LDAP variant (no Keycloak handoff); the OIDC flavors are covered by
|
|
// the OIDC addon specs, so skip when OIDC owns the login journey.
|
|
test("addon user_ldap: biber authenticates via LDAP-backed native login", async ({ browser }) => {
|
|
skipUnlessAddonEnabled("user_ldap");
|
|
skipUnlessServiceEnabled("ldap");
|
|
|
|
test.skip(
|
|
shared.env.nextcloudOidcEnabled,
|
|
"user_ldap native-login proof is only meaningful when OIDC is off; the OIDC flavors authenticate biber through Keycloak and are covered by the OIDC addon specs.",
|
|
);
|
|
|
|
const context = await browser.newContext({ ignoreHTTPSErrors: true });
|
|
const page = await context.newPage();
|
|
|
|
try {
|
|
await shared.loginToStandaloneNextcloud(
|
|
page,
|
|
shared.env.biberUsername,
|
|
shared.env.biberPassword,
|
|
);
|
|
|
|
const shellState = await shared.waitForVisibleCandidate(
|
|
page,
|
|
shared.getNextcloudShellCandidates(page),
|
|
resolveTimeout(60_000),
|
|
"Timed out waiting for an authenticated Nextcloud shell after the biber LDAP login flow",
|
|
);
|
|
await expect(shellState.locator).toBeVisible();
|
|
} finally {
|
|
await page.close().catch(() => {});
|
|
await context.close().catch(() => {});
|
|
}
|
|
});
|