From 627b0073f2f70371223cb1940d54228e52400224 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 6 May 2026 07:02:23 +0100 Subject: [PATCH] test: remove gateway restart delay wait --- src/cli/gateway-cli/run-loop.test.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cli/gateway-cli/run-loop.test.ts b/src/cli/gateway-cli/run-loop.test.ts index a364f1547b4..de20676a449 100644 --- a/src/cli/gateway-cli/run-loop.test.ts +++ b/src/cli/gateway-cli/run-loop.test.ts @@ -627,9 +627,13 @@ describe("runGatewayLoop", () => { await withIsolatedSignals(async ({ captureSignal }) => { const { runtime, exited } = await createSignaledLoopHarness(); const sigusr1 = captureSignal("SIGUSR1"); - const startedAt = Date.now(); + vi.useFakeTimers(); sigusr1(); + await vi.advanceTimersByTimeAsync(1499); + expect(runtime.exit).not.toHaveBeenCalled(); + await vi.advanceTimersByTimeAsync(1); + await expect(exited).resolves.toBe(0); expect(runtime.exit).toHaveBeenCalledWith(0); expect(writeGatewayRestartHandoffSync).toHaveBeenCalledWith({ @@ -638,9 +642,9 @@ describe("runGatewayLoop", () => { processInstanceId: expect.any(String), supervisorMode: "launchd", }); - expect(Date.now() - startedAt).toBeGreaterThanOrEqual(1400); }); } finally { + vi.useRealTimers(); delete process.env.LAUNCH_JOB_LABEL; if (originalPlatformDescriptor) { Object.defineProperty(process, "platform", originalPlatformDescriptor);