From bacc3faaa0af7fe577e2f2575a6a6f9ec370f79a Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 23 Oct 2026 00:20:29 +0200 Subject: [PATCH] Tests: probe respawn tests keep the watchdog out of the way; watchdog test timing Co-Authored-By: Claude Opus 5.5 --- scripts/test-gpu-probe.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/test-gpu-probe.mjs b/scripts/test-gpu-probe.mjs index 328a3df..4de6ac8 100644 --- a/scripts/test-gpu-probe.mjs +++ b/scripts/test-gpu-probe.mjs @@ -116,13 +116,13 @@ test("probe: respawns at most once per interval after the child exits", async () test("probe: a plain exit and a spawn error each respawn", async () => { const exited = fakeSpawn(); - const a = startProbe({ spawn: exited.spawn, scriptPath: "p.ps1", intervalMs: 20, onSample: () => {} }); + const a = startProbe({ spawn: exited.spawn, scriptPath: "p.ps1", intervalMs: 20, onSample: () => {}, staleIntervals: 1000 }); exited.spawned[0].child.emit("exit", 0); await sleep(120); assert.equal(exited.spawned.length, 2); a.stop(); const failed = fakeSpawn(); - const b = startProbe({ spawn: failed.spawn, scriptPath: "p.ps1", intervalMs: 20, onSample: () => {} }); + const b = startProbe({ spawn: failed.spawn, scriptPath: "p.ps1", intervalMs: 20, onSample: () => {}, staleIntervals: 1000 }); failed.spawned[0].child.emit("error", new Error("ENOENT")); await sleep(120); assert.equal(failed.spawned.length, 2); @@ -135,7 +135,7 @@ test("probe watchdog: a child that stays alive but sends nothing is killed and r await sleep(90); assert.equal(spawned[0].child.kills, 0, "under 3 intervals of silence the child is left alone"); assert.equal(spawned.length, 1); - await sleep(200); + await sleep(100); assert.equal(spawned[0].child.kills, 1, "the hung child is killed exactly once"); assert.equal(spawned.length, 2, "and replaced"); spawned[0].child.emit("exit", 1);