From f88aa4884794bc448d97ac49bf3291bc4b192765 Mon Sep 17 00:00:00 2001 From: Paco Cartones <253313177+pacocartones@users.noreply.github.com> Date: Mon, 24 Aug 2026 17:12:04 +0200 Subject: [PATCH] test(db): make exclusive-connection-lease uniqueness test self-contained (#11341) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- tests/unit/exclusive-connection-leases.test.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/unit/exclusive-connection-leases.test.ts b/tests/unit/exclusive-connection-leases.test.ts index a289ce99a2..fcfceb71c7 100644 --- a/tests/unit/exclusive-connection-leases.test.ts +++ b/tests/unit/exclusive-connection-leases.test.ts @@ -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",