diff --git a/src/cli/logs-cli.test.ts b/src/cli/logs-cli.test.ts index ff20ffb9918..8120df864e6 100644 --- a/src/cli/logs-cli.test.ts +++ b/src/cli/logs-cli.test.ts @@ -304,7 +304,7 @@ describe("logs cli", () => { const stdoutWrites = captureStdoutWrites(); const exitSpy = vi.spyOn(process, "exit").mockImplementation(() => undefined as never); - await runLogsCli(["logs", "--follow"]); + await runLogsCli(["logs", "--follow", "--interval", "1"]); expect(stderrWrites.join("")).toContain("Local Gateway RPC unavailable"); expect(stderrWrites.join("")).not.toContain("gateway disconnected"); @@ -365,7 +365,14 @@ describe("logs cli", () => { const stdoutWrites = captureStdoutWrites(); const exitSpy = vi.spyOn(process, "exit").mockImplementation(() => undefined as never); - await runLogsCli(["logs", "--follow", "--url", "ws://remote.example.com:18789"]); + await runLogsCli([ + "logs", + "--follow", + "--interval", + "1", + "--url", + "ws://remote.example.com:18789", + ]); expect(readConfiguredLogTail).not.toHaveBeenCalled(); expect(stderrWrites.join("")).toContain("gateway disconnected"); @@ -399,7 +406,15 @@ describe("logs cli", () => { const stdoutWrites = captureStdoutWrites(); const exitSpy = vi.spyOn(process, "exit").mockImplementation(() => undefined as never); - await runLogsCli(["logs", "--follow", "--json", "--url", "ws://remote.example.com:18789"]); + await runLogsCli([ + "logs", + "--follow", + "--interval", + "1", + "--json", + "--url", + "ws://remote.example.com:18789", + ]); const stderr = stderrWrites.join(""); const noticeRecords = stderr diff --git a/src/cli/update-cli/restart-helper.test.ts b/src/cli/update-cli/restart-helper.test.ts index 79b3e7d1153..d86ff0feaa3 100644 --- a/src/cli/update-cli/restart-helper.test.ts +++ b/src/cli/update-cli/restart-helper.test.ts @@ -53,6 +53,10 @@ exit 0 await fs.writeFile(launchctlPath, content, { mode: 0o755 }); } + async function writeFakeSleep(fakeBinDir: string) { + await fs.writeFile(path.join(fakeBinDir, "sleep"), "#!/bin/sh\nexit 0\n", { mode: 0o755 }); + } + async function executeScript(scriptPath: string, env: Record) { return await new Promise<{ code: number | null; stdout: string; stderr: string }>((resolve) => { execFile( @@ -148,6 +152,7 @@ exit 0 const fakeBinDir = path.join(tmpDir, "bin"); const callsPath = path.join(tmpDir, "systemctl-calls.log"); await fs.mkdir(fakeBinDir, { recursive: true }); + await writeFakeSleep(fakeBinDir); await fs.writeFile( path.join(fakeBinDir, "systemctl"), `#!/bin/sh @@ -245,6 +250,7 @@ exit 1 const fakeBinDir = path.join(tmpDir, "bin"); const stateDir = path.join(tmpDir, "state"); await fs.mkdir(fakeBinDir, { recursive: true }); + await writeFakeSleep(fakeBinDir); await writeFakeLaunchctl( fakeBinDir, `#!/bin/sh @@ -284,6 +290,7 @@ exit 0 const stateFile = path.join(tmpDir, "state-file"); const markerPath = path.join(tmpDir, "launchctl-ran"); await fs.mkdir(fakeBinDir, { recursive: true }); + await writeFakeSleep(fakeBinDir); await fs.writeFile(stateFile, "not a directory"); await writeFakeLaunchctl( fakeBinDir, @@ -315,6 +322,7 @@ exit 0 const fakeBinDir = path.join(tmpDir, "bin"); const stateDir = path.join(tmpDir, "state"); await fs.mkdir(fakeBinDir, { recursive: true }); + await writeFakeSleep(fakeBinDir); await writeFakeLaunchctl(fakeBinDir); const { scriptPath } = await prepareAndReadScript({