Skip to content

Commit 1671ea2

Browse files
committed
fix(test): stabilize ssh.process.replaced flake
After the 999->888 takeover, the 888 monitor would eventually fail network reads, call processLost, then searchForProcess would find 888 again and emit ssh.process.recovered (same-PID rediscovery). On slow CI runners that race won the negative assertion at sshProcess.test.ts:469. Return [] from find after the takeover so no rediscovery is possible.
1 parent ea88cd7 commit 1671ea2

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

test/unit/remote/sshProcess.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,10 @@ describe("SshProcessMonitor", () => {
445445
});
446446
vi.mocked(find)
447447
.mockResolvedValueOnce([{ pid: 999, ppid: 1, name: "ssh", cmd: "ssh" }])
448-
.mockResolvedValue([{ pid: 888, ppid: 1, name: "ssh", cmd: "ssh" }]);
448+
.mockResolvedValueOnce([{ pid: 888, ppid: 1, name: "ssh", cmd: "ssh" }])
449+
// No rediscovery after takeover: a same-PID rediscovery would
450+
// emit ssh.process.recovered and break the negative assertion.
451+
.mockResolvedValue([]);
449452

450453
const monitor = createMonitor({
451454
networkInfoPath: "/network",
@@ -456,8 +459,6 @@ describe("SshProcessMonitor", () => {
456459
await waitUntil(
457460
() => sink.eventsNamed("ssh.process.replaced").length > 0,
458461
);
459-
// Halt monitoring before the negative assertion so the 888 loop
460-
// can't race ahead and emit its own lost/recovered cycle.
461462
monitor.dispose();
462463

463464
const replaced = sink.eventsNamed("ssh.process.replaced");

0 commit comments

Comments
 (0)