Skip to content

Commit 3d1faef

Browse files
committed
🤖 Add test timeout for timeout test
The integration test for timeout handling was exceeding Jest's default 5 second timeout due to workspace creation overhead. Set explicit 15s timeout to account for SSH container setup in CI.
1 parent f51f3d9 commit 3d1faef

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

tests/runtime/runtime.test.ts

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -142,25 +142,29 @@ describeIntegration("Runtime integration tests", () => {
142142

143143
expect(result.stdout.trim()).toContain(workspace.path);
144144
});
145-
test.concurrent("handles timeout correctly", async () => {
146-
const runtime = createRuntime();
147-
await using workspace = await TestWorkspace.create(runtime, type);
145+
test.concurrent(
146+
"handles timeout correctly",
147+
async () => {
148+
const runtime = createRuntime();
149+
await using workspace = await TestWorkspace.create(runtime, type);
148150

149-
// Command that sleeps longer than timeout
150-
const startTime = performance.now();
151-
const result = await execBuffered(runtime, "sleep 10", {
152-
cwd: workspace.path,
153-
timeout: 1, // 1 second timeout
154-
});
155-
const duration = performance.now() - startTime;
156-
157-
// Exit code should be EXIT_CODE_TIMEOUT (-998)
158-
expect(result.exitCode).toBe(-998);
159-
// Should complete in around 1 second, not 10 seconds
160-
// Allow some margin for overhead (especially on SSH)
161-
expect(duration).toBeLessThan(3000); // 3 seconds max
162-
expect(duration).toBeGreaterThan(500); // At least 0.5 seconds
163-
});
151+
// Command that sleeps longer than timeout
152+
const startTime = performance.now();
153+
const result = await execBuffered(runtime, "sleep 10", {
154+
cwd: workspace.path,
155+
timeout: 1, // 1 second timeout
156+
});
157+
const duration = performance.now() - startTime;
158+
159+
// Exit code should be EXIT_CODE_TIMEOUT (-998)
160+
expect(result.exitCode).toBe(-998);
161+
// Should complete in around 1 second, not 10 seconds
162+
// Allow some margin for overhead (especially on SSH)
163+
expect(duration).toBeLessThan(3000); // 3 seconds max
164+
expect(duration).toBeGreaterThan(500); // At least 0.5 seconds
165+
},
166+
15000
167+
); // 15 second timeout for test (includes workspace creation overhead)
164168
});
165169

166170
describe("readFile() - File reading", () => {

0 commit comments

Comments
 (0)