test: honor low-worker full-suite gate

This commit is contained in:
Peter Steinberger
2026-04-10 13:09:17 +01:00
parent 8fe74145c4
commit 66ac5194f7
3 changed files with 96 additions and 61 deletions

View File

@@ -6,8 +6,8 @@ import {
buildFullSuiteVitestRunPlans,
createVitestRunSpecs,
parseTestProjectsArgs,
resolveParallelFullSuiteConcurrency,
resolveChangedTargetArgs,
shouldUseLocalFullSuiteParallelByDefault,
writeVitestIncludeFile,
} from "./test-projects.test-support.mjs";
import {
@@ -116,31 +116,6 @@ function runVitestSpec(spec) {
});
}
function parsePositiveInt(value) {
const parsed = Number.parseInt(value ?? "", 10);
return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
}
function resolveParallelFullSuiteConcurrency(specCount, env) {
const override = parsePositiveInt(env.OPENCLAW_TEST_PROJECTS_PARALLEL);
if (override !== null) {
return Math.min(override, specCount);
}
if (env.OPENCLAW_TEST_PROJECTS_SERIAL === "1") {
return 1;
}
if (env.CI === "true" || env.GITHUB_ACTIONS === "true") {
return 1;
}
if (
env.OPENCLAW_TEST_PROJECTS_LEAF_SHARDS !== "1" &&
!shouldUseLocalFullSuiteParallelByDefault(env)
) {
return 1;
}
return Math.min(10, specCount);
}
function applyDefaultParallelVitestWorkerBudget(specs, env) {
if (env.OPENCLAW_VITEST_MAX_WORKERS || env.OPENCLAW_TEST_WORKERS) {
return specs;