test(db): make exclusive-connection-lease uniqueness test self-contained (#11341)

Merged via consolidated batch validation. Test-only fix: exclusive-connection-lease uniqueness test implicitly depended on lease state from an earlier test in the same file (shared DB instance, reset only in test.after) — now self-contained. No production change.
This commit is contained in:
Paco Cartones
2026-08-24 17:12:04 +02:00
committed by GitHub
parent 8301984734
commit f88aa48847

View File

@@ -61,6 +61,19 @@ test("uses the live next-free migration slot without runner compatibility specia
});
test("enforces global active owner and connection uniqueness", () => {
// Establish the OWNER_A/conn-a lease this test reuses, rather than depending
// on a lease left behind by an earlier test in the file. The DB instance is
// shared across tests (reset only in test.after), so relying on prior state
// makes this test order-dependent: run in isolation the re-acquire below
// returns ACQUIRED instead of REUSED.
leases.acquireExclusiveConnectionLease({
leaseOwnerId: OWNER_A,
apiKeyId: "key-a",
provider: "codex",
connectionId: "conn-a",
now: at(0),
});
const ownerA = leases.acquireExclusiveConnectionLease({
leaseOwnerId: OWNER_A,
apiKeyId: "key-a",