mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 21:07:01 -06:00
fix(test): reject malformed local check limits
This commit is contained in:
@@ -397,6 +397,25 @@ describe("local-heavy-check-runtime", () => {
|
||||
expect(fs.existsSync(worktreeLockDir)).toBe(false);
|
||||
});
|
||||
|
||||
it("rejects malformed heavy-check lock timing env values", () => {
|
||||
const cwd = createTempDir("openclaw-local-heavy-check-malformed-env-");
|
||||
|
||||
expect(() =>
|
||||
acquireLocalHeavyCheckLockSync({
|
||||
cwd,
|
||||
env: makeEnv({ OPENCLAW_HEAVY_CHECK_LOCK_TIMEOUT_MS: "10ms" }),
|
||||
toolName: "oxlint",
|
||||
}),
|
||||
).toThrow("OPENCLAW_HEAVY_CHECK_LOCK_TIMEOUT_MS must be a positive integer; got: 10ms");
|
||||
expect(() =>
|
||||
acquireLocalHeavyCheckLockSync({
|
||||
cwd,
|
||||
env: makeEnv({ OPENCLAW_HEAVY_CHECK_LOCK_POLL_MS: "0" }),
|
||||
toolName: "oxlint",
|
||||
}),
|
||||
).toThrow("OPENCLAW_HEAVY_CHECK_LOCK_POLL_MS must be a positive integer; got: 0");
|
||||
});
|
||||
|
||||
it("cleans up stale legacy test locks when acquiring the shared heavy-check lock", () => {
|
||||
const cwd = createTempDir("openclaw-local-heavy-check-legacy-");
|
||||
const commonDir = path.join(cwd, ".git");
|
||||
|
||||
@@ -138,4 +138,20 @@ describe("vitest local full-suite profile", () => {
|
||||
vitestMaxWorkers: 1,
|
||||
});
|
||||
});
|
||||
|
||||
it("rejects malformed explicit worker limits", () => {
|
||||
const hostInfo = {
|
||||
cpuCount: 10,
|
||||
loadAverage1m: 0,
|
||||
totalMemoryBytes: 24 * 1024 ** 3,
|
||||
freeMemoryBytes: 12 * 1024 ** 3,
|
||||
};
|
||||
|
||||
expect(() =>
|
||||
resolveLocalVitestScheduling({ OPENCLAW_VITEST_MAX_WORKERS: "8x" }, hostInfo, "threads"),
|
||||
).toThrow("OPENCLAW_VITEST_MAX_WORKERS must be a positive integer; got: 8x");
|
||||
expect(() =>
|
||||
resolveLocalVitestScheduling({ OPENCLAW_TEST_WORKERS: "1e0" }, hostInfo, "threads"),
|
||||
).toThrow("OPENCLAW_TEST_WORKERS must be a positive integer; got: 1e0");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user