test: remove cli retry test waits

This commit is contained in:
Peter Steinberger
2026-05-06 06:50:03 +01:00
parent fa2a32d0c5
commit 5da9f5e57c
2 changed files with 26 additions and 3 deletions

View File

@@ -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

View File

@@ -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<string, string>) {
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({