From dbf640255884e6c4f0ef8b89832b769d0531f76e Mon Sep 17 00:00:00 2001 From: Ren Koya Date: Mon, 10 Aug 2026 09:01:33 +0900 Subject: [PATCH] test: seed the revocation fixture in one Durable Object invocation The revocation-cleanup test has to leave more rows behind than one alarm pass clears, so it enables sixty schedules -- but it did so as sixty separate runInDurableObject round-trips, which is where nearly all of its runtime went. On an idle machine it took 2.9-4.3s of the 5s default test timeout, and it exceeded it outright when the monorepo suite runs in parallel. Enable them inside a single invocation instead. Same enable() path, so each schedule still gets its capabilities row and the cleanup assertions are unchanged; the test now runs in about 1s. --- .../__tests__/schedule-driver.test.ts | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/packages/gatekeeper-scheduler/__tests__/schedule-driver.test.ts b/packages/gatekeeper-scheduler/__tests__/schedule-driver.test.ts index 3c99a8f46..32259b732 100644 --- a/packages/gatekeeper-scheduler/__tests__/schedule-driver.test.ts +++ b/packages/gatekeeper-scheduler/__tests__/schedule-driver.test.ts @@ -1182,20 +1182,25 @@ describe("ScheduleDriver", () => { it("permanently fences mutations and cleans revoked storage in bounded alarm passes", async () => { const driver = testEnv.SCHEDULE_DRIVER.getByName("revocation"); const activationTime = Date.now(); - for (let index = 0; index < 60; index++) { - await enableSchedule( - driver, - { - workspaceId: "workspace-a", - scheduleId: `schedule-${index}`, - spec: { kind: "interval", everyMs: 60_000, anchorMs: activationTime }, - title: `Task ${index}`, - description: "Test revocation cleanup.", - gadgetId, - }, - activationTime, - ); - } + // Seeded through the real enable() path, so each schedule gets its capabilities row too, but + // in a single Durable Object invocation: this fixture has to exceed the cleanup batch size, + // and sixty separate round-trips spent most of the default test timeout on their own. + await runInDurableObject(driver, async (instance) => { + for (let index = 0; index < 60; index++) { + await instance.enable( + { + workspaceId: "workspace-a", + scheduleId: `schedule-${index}`, + spec: { kind: "interval", everyMs: 60_000, anchorMs: activationTime }, + title: `Task ${index}`, + description: "Test revocation cleanup.", + gadgetId, + }, + testInitiator(instance), + activationTime, + ); + } + }); await driver.revoke(); await expect(driver.disable("workspace-a", "schedule-0")).resolves.toBeUndefined();