Skip to content

Commit 9bf8dea

Browse files
committed
test(exec): wait for the active-run handle in the signal fixture
runExec registers the handle in saveState's continuation, after the rename lands. The fixture's poller could see run.json as running in between, read a null handle, and fail the SIGTERM case on CI.
1 parent 83c6eef commit 9bf8dea

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎fixtures/crash-run/simulate-exec-signal.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,14 @@ await withMockedModuleDuring(
6565
} as unknown as Config;
6666
void runExec(config);
6767
await waitForRunningRunJson();
68-
const handle = getActiveRun();
68+
// runExec registers the handle in saveState's continuation, which can run
69+
// after this poller has already seen the renamed run.json on disk.
70+
const deadline = Date.now() + 5_000;
71+
let handle = getActiveRun();
72+
while (handle === null && Date.now() < deadline) {
73+
await new Promise((resolve) => setTimeout(resolve, 20));
74+
handle = getActiveRun();
75+
}
6976
if (handle === null) {
7077
throw new Error("runExec did not register an active-run handle");
7178
}

0 commit comments

Comments
 (0)