From f0ae8aed7f199842081bbbceaa501aa2aa46fe0a Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 16 Jun 2026 18:05:23 +0100 Subject: [PATCH] Harden interop discovery lane timeouts --- .../test/interop/cultnet-interop.test.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/cultnet-ts/test/interop/cultnet-interop.test.ts b/packages/cultnet-ts/test/interop/cultnet-interop.test.ts index 8b6cae30..118033fa 100644 --- a/packages/cultnet-ts/test/interop/cultnet-interop.test.ts +++ b/packages/cultnet-ts/test/interop/cultnet-interop.test.ts @@ -64,6 +64,8 @@ const rustBinaryPath = resolve( ); const discoveryGroup = "239.77.44.11"; +const serveReadyTimeoutMs = 90_000; +const jsonCommandTimeoutMs = 180_000; let rustInteropPeerBuild: Promise | undefined; let csharpInteropPeerBuild: Promise | undefined; let kotlinInteropPeerBuild: Promise | undefined; @@ -2113,8 +2115,8 @@ async function spawnServeProcess(name: string, command: ServeCommand): Promise((resolve, reject) => { const timeout = setTimeout(() => { - reject(new Error(`${name} serve process did not become ready within 30000ms.\n${stderr.join("")}`)); - }, 30_000); + reject(new Error(`${name} serve process did not become ready within ${serveReadyTimeoutMs}ms.\n${stderr.join("")}`)); + }, serveReadyTimeoutMs); const resolveReady = (value: unknown) => { clearTimeout(timeout); @@ -2178,7 +2180,7 @@ async function runJsonCommand( const { stdout, stderr } = await execFileAsync(command, args, { cwd, env: { ...process.env, ...env }, - timeout: 90_000, + timeout: jsonCommandTimeoutMs, }); const trimmed = stdout.trim(); if (!trimmed) { @@ -3548,6 +3550,16 @@ async function stopProcess(processState: RunningServeProcess): Promise { return; } + if (process.platform === "win32") { + await execFileAsync("taskkill.exe", ["/PID", String(processState.child.pid), "/T", "/F"]) + .catch(() => undefined); + await Promise.race([ + once(processState.child, "exit").then(() => true), + delay(2_000).then(() => false), + ]); + return; + } + const gracefulExit = once(processState.child, "exit").then(() => true); processState.child.kill("SIGTERM"); const exited = await Promise.race([