test: bound CLI validation subprocess concurrency
Run the 22 malformed process scenarios in pairs instead of starting 22 compiled CLI runtimes simultaneously. Retain every CLI/MCP error assertion and the no-launch check, and document nested subprocess limits.
This commit is contained in:
@@ -970,6 +970,10 @@ still owns its resources. Adapter, non-MCP boundary, acceptance, and
|
|||||||
process-global projects retain per-file isolation. See `vitest.config.ts` for
|
process-global projects retain per-file isolation. See `vitest.config.ts` for
|
||||||
current settings.
|
current settings.
|
||||||
|
|
||||||
|
Vitest worker limits do not bound subprocesses launched within a test. Bound
|
||||||
|
those batches separately so repeated CLI validation cannot oversubscribe the
|
||||||
|
runner. Preserve simultaneous launches where concurrency is itself under test.
|
||||||
|
|
||||||
Build/documentation writers hold checkout-local output locks. Tests do not
|
Build/documentation writers hold checkout-local output locks. Tests do not
|
||||||
hold a broad command lock; `check:pr` finishes tests before document validation.
|
hold a broad command lock; `check:pr` finishes tests before document validation.
|
||||||
|
|
||||||
|
|||||||
@@ -161,26 +161,27 @@ captureTest(
|
|||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
// Each CLI case is an independent process; running them concurrently keeps
|
// Each CLI case initializes its own runtime. Bound subprocess fanout too,
|
||||||
// the suite well inside its deadline on slower CI runners.
|
// so one test cannot oversubscribe the host beyond the Vitest workers.
|
||||||
await Promise.all(
|
for (let start = 0; start < invalid.length; start += 2)
|
||||||
invalid.map(async (options, index) => {
|
await Promise.all(
|
||||||
const request = { ...scenario, ...options };
|
invalid.slice(start, start + 2).map(async (options, offset) => {
|
||||||
expect(
|
const request = { ...scenario, ...options };
|
||||||
(await call("capture_process_scenario", request)).isError,
|
expect(
|
||||||
JSON.stringify(options),
|
(await call("capture_process_scenario", request)).isError,
|
||||||
).toBe(true);
|
JSON.stringify(options),
|
||||||
const path = join(root, `scenario-${String(index)}.json`);
|
).toBe(true);
|
||||||
await writeFile(path, JSON.stringify(request));
|
const path = join(root, `scenario-${String(start + offset)}.json`);
|
||||||
await expect(
|
await writeFile(path, JSON.stringify(request));
|
||||||
execute(process.execPath, [cli, "capture-process", path, "--json"]),
|
await expect(
|
||||||
JSON.stringify(options),
|
execute(process.execPath, [cli, "capture-process", path, "--json"]),
|
||||||
).rejects.toMatchObject({
|
JSON.stringify(options),
|
||||||
code: 1,
|
).rejects.toMatchObject({
|
||||||
stdout: expect.stringContaining("invalid_request"),
|
code: 1,
|
||||||
});
|
stdout: expect.stringContaining("invalid_request"),
|
||||||
}),
|
});
|
||||||
);
|
}),
|
||||||
|
);
|
||||||
await expect(access(marker)).rejects.toMatchObject({ code: "ENOENT" });
|
await expect(access(marker)).rejects.toMatchObject({ code: "ENOENT" });
|
||||||
const missing = join(root, "missing-executable");
|
const missing = join(root, "missing-executable");
|
||||||
const failed = await call("capture_process_scenario", {
|
const failed = await call("capture_process_scenario", {
|
||||||
|
|||||||
Reference in New Issue
Block a user