tests(wrapper): relax wrapper subprocess timeouts to avoid flakiness under parallel suite load\n\nIncrease waitForExit default and per-test budgets and add comment explaining why. Only test code changed.
This commit is contained in:
@@ -6,7 +6,11 @@ import { tmpdir } from "node:os";
|
|||||||
import { dirname, join } from "node:path";
|
import { dirname, join } from "node:path";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
|
|
||||||
function waitForExit(child: ReturnType<typeof spawn>, timeoutMs = 1500): Promise<number> {
|
// Tests spawn a wrapper subprocess and rely on the wrapper to exit quickly.
|
||||||
|
// When the full test suite runs with concurrency the host can be CPU-constrained
|
||||||
|
// and subprocess startup/teardown can be delayed. Keep this timeout relaxed
|
||||||
|
// to avoid flakiness while preserving the test's intent.
|
||||||
|
function waitForExit(child: ReturnType<typeof spawn>, timeoutMs = 8000): Promise<number> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const timeout = setTimeout(() => {
|
const timeout = setTimeout(() => {
|
||||||
child.kill("SIGKILL");
|
child.kill("SIGKILL");
|
||||||
@@ -237,7 +241,7 @@ test("wrapper does not exit early on non-terminal toolUse assistant messages", a
|
|||||||
stdio: ["ignore", "pipe", "pipe"],
|
stdio: ["ignore", "pipe", "pipe"],
|
||||||
});
|
});
|
||||||
|
|
||||||
const exitCode = await waitForExit(child, 2500);
|
const exitCode = await waitForExit(child, 8000);
|
||||||
assert.equal(exitCode, 0);
|
assert.equal(exitCode, 0);
|
||||||
|
|
||||||
const result = JSON.parse(await readFile(resultPath, "utf8"));
|
const result = JSON.parse(await readFile(resultPath, "utf8"));
|
||||||
@@ -301,7 +305,7 @@ test("wrapper skips blank assistant transcript lines before later tool activity"
|
|||||||
stdio: ["ignore", "pipe", "pipe"],
|
stdio: ["ignore", "pipe", "pipe"],
|
||||||
});
|
});
|
||||||
|
|
||||||
const exitCode = await waitForExit(child, 2500);
|
const exitCode = await waitForExit(child, 8000);
|
||||||
assert.equal(exitCode, 0);
|
assert.equal(exitCode, 0);
|
||||||
|
|
||||||
const transcript = await readFile(transcriptPath, "utf8");
|
const transcript = await readFile(transcriptPath, "utf8");
|
||||||
|
|||||||
Reference in New Issue
Block a user