Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/hosts/update-worker.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,15 @@ test("a pending stop reconciles an exit during the asynchronous start-identity r
});

test("a pending stop whose process identity changes retains recovery-required state and its claim", { skip: windows ? "delayed SIGTERM shutdown is POSIX behaviour" : false, timeout: 90_000 }, async () => {
const f = await fixture("unreconciled-stop", { shutdownDelay: 11_000 });
// The daemon must still be alive when reconciliation reads its identity: the stop wait is 10 s, so an 11 s
// shutdown left a ~1 s margin, and a loaded runner (a slow identity read, a stalled worker) observed the
// daemon as already gone — reconcilePendingStop then returned success, the worker rolled back and a
// replacement started beside the uncertain original (health.json appeared, :1127 failed on Ubuntu and macOS).
// 60 s keeps the daemon alive through reconciliation with a wide margin; the test still ends at ~11 s
// because the identity mismatch fails reconciliation on its first read, and the after-hook SIGKILLs the
// lingering daemon. The neighbouring delayed-stop / stop-identity-exit-race tests keep 11 s on purpose:
// they need the daemon to exit for their own reconciliation path.
const f = await fixture("unreconciled-stop", { shutdownDelay: 60_000 });
const lock = join(stateRoot, "lock.json");
writeFileSync(lock, JSON.stringify({ id: "unreconciled-stop", pid: process.pid, at: Date.now() }), { mode: 0o600 });
const copy = updates.copyHostWorkerSources(fileURLToPath(new URL("./update-worker.ts", import.meta.url)), f.attempt);
Expand Down
Loading