mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-21 05:32:53 +00:00
test: make planner lanes explicit
This commit is contained in:
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@@ -366,7 +366,7 @@ jobs:
|
||||
SHARD_COUNT: ${{ matrix.shard_count || '' }}
|
||||
SHARD_INDEX: ${{ matrix.shard_index || '' }}
|
||||
run: |
|
||||
# `pnpm test` runs `scripts/test-parallel.mjs`, which spawns multiple Node processes.
|
||||
# `pnpm test:planner` runs `scripts/test-parallel.mjs`, which spawns multiple Node processes.
|
||||
# Default heap limits have been too low on Linux CI (V8 OOM near 4GB).
|
||||
echo "OPENCLAW_TEST_WORKERS=2" >> "$GITHUB_ENV"
|
||||
echo "OPENCLAW_TEST_MAX_OLD_SPACE_SIZE_MB=6144" >> "$GITHUB_ENV"
|
||||
@@ -402,7 +402,7 @@ jobs:
|
||||
set -euo pipefail
|
||||
case "$TASK" in
|
||||
test)
|
||||
pnpm test
|
||||
pnpm test:planner
|
||||
;;
|
||||
channels)
|
||||
pnpm test:channels
|
||||
@@ -843,7 +843,7 @@ jobs:
|
||||
set -euo pipefail
|
||||
case "$TASK" in
|
||||
test)
|
||||
pnpm test
|
||||
pnpm test:planner
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported Windows checks task: $TASK" >&2
|
||||
@@ -901,7 +901,7 @@ jobs:
|
||||
set -euo pipefail
|
||||
case "$TASK" in
|
||||
test)
|
||||
pnpm test
|
||||
pnpm test:planner
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported macOS node task: $TASK" >&2
|
||||
|
||||
@@ -5,7 +5,7 @@ run_prepare_push_retry_gates() {
|
||||
run_quiet_logged "pnpm build (lease-retry)" ".local/lease-retry-build.log" pnpm build
|
||||
run_quiet_logged "pnpm check (lease-retry)" ".local/lease-retry-check.log" pnpm check
|
||||
if [ "$docs_only" != "true" ]; then
|
||||
run_quiet_logged "pnpm test (lease-retry)" ".local/lease-retry-test.log" pnpm test
|
||||
run_quiet_logged "pnpm test:planner (lease-retry)" ".local/lease-retry-test.log" pnpm test:planner
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -105,11 +105,11 @@ prepare_gates() {
|
||||
gates_mode="full"
|
||||
local prepare_unit_fast_batch_target_ms
|
||||
prepare_unit_fast_batch_target_ms="${OPENCLAW_PREPARE_TEST_UNIT_FAST_BATCH_TARGET_MS:-5000}"
|
||||
echo "Running pnpm test with OPENCLAW_TEST_UNIT_FAST_BATCH_TARGET_MS=$prepare_unit_fast_batch_target_ms for shorter-lived unit-fast workers."
|
||||
echo "Running pnpm test:planner with OPENCLAW_TEST_UNIT_FAST_BATCH_TARGET_MS=$prepare_unit_fast_batch_target_ms for shorter-lived unit-fast workers."
|
||||
run_quiet_logged \
|
||||
"pnpm test" \
|
||||
"pnpm test:planner" \
|
||||
".local/gates-test.log" \
|
||||
env OPENCLAW_TEST_UNIT_FAST_BATCH_TARGET_MS="$prepare_unit_fast_batch_target_ms" pnpm test
|
||||
env OPENCLAW_TEST_UNIT_FAST_BATCH_TARGET_MS="$prepare_unit_fast_batch_target_ms" pnpm test:planner
|
||||
previous_full_gates_head="$current_head"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -59,10 +59,10 @@ run_linux_ci_mirror() {
|
||||
run_step pnpm vitest run --config vitest.extensions.config.ts --maxWorkers=1
|
||||
run_step env CI=true pnpm exec vitest run --config vitest.unit.config.ts --maxWorkers=1
|
||||
|
||||
log_step "OPENCLAW_TEST_WORKERS=${OPENCLAW_TEST_WORKERS:-1} OPENCLAW_TEST_MAX_OLD_SPACE_SIZE_MB=${OPENCLAW_TEST_MAX_OLD_SPACE_SIZE_MB:-6144} pnpm test"
|
||||
log_step "OPENCLAW_TEST_WORKERS=${OPENCLAW_TEST_WORKERS:-1} OPENCLAW_TEST_MAX_OLD_SPACE_SIZE_MB=${OPENCLAW_TEST_MAX_OLD_SPACE_SIZE_MB:-6144} pnpm test:planner"
|
||||
OPENCLAW_TEST_WORKERS="${OPENCLAW_TEST_WORKERS:-1}" \
|
||||
OPENCLAW_TEST_MAX_OLD_SPACE_SIZE_MB="${OPENCLAW_TEST_MAX_OLD_SPACE_SIZE_MB:-6144}" \
|
||||
pnpm test
|
||||
pnpm test:planner
|
||||
}
|
||||
|
||||
run_macos_ci_mirror() {
|
||||
|
||||
@@ -1511,7 +1511,7 @@ export function buildCIExecutionManifest(scopeInput = {}, options = {}) {
|
||||
checkNamePrefix: "checks-node-test",
|
||||
runtime: "node",
|
||||
task: "test",
|
||||
command: "pnpm test",
|
||||
command: "pnpm test:planner",
|
||||
shardCount: unitShardCount,
|
||||
}),
|
||||
...createShardMatrixEntries({
|
||||
@@ -1546,7 +1546,7 @@ export function buildCIExecutionManifest(scopeInput = {}, options = {}) {
|
||||
checkNamePrefix: "checks-windows-node-test",
|
||||
runtime: "node",
|
||||
task: "test",
|
||||
command: "pnpm test",
|
||||
command: "pnpm test:planner",
|
||||
shardCount: windowsShardCount,
|
||||
})
|
||||
: [];
|
||||
@@ -1555,7 +1555,7 @@ export function buildCIExecutionManifest(scopeInput = {}, options = {}) {
|
||||
checkNamePrefix: "macos-node",
|
||||
runtime: "node",
|
||||
task: "test",
|
||||
command: "pnpm test",
|
||||
command: "pnpm test:planner",
|
||||
shardCount: macosNodeShardCount,
|
||||
})
|
||||
: [];
|
||||
|
||||
29
scripts/test-projects-lib.mjs
Normal file
29
scripts/test-projects-lib.mjs
Normal file
@@ -0,0 +1,29 @@
|
||||
export function parseTestProjectsArgs(args) {
|
||||
const forwardedArgs = [];
|
||||
let watchMode = false;
|
||||
|
||||
for (const arg of args) {
|
||||
if (arg === "--") {
|
||||
continue;
|
||||
}
|
||||
if (arg === "--watch") {
|
||||
watchMode = true;
|
||||
continue;
|
||||
}
|
||||
forwardedArgs.push(arg);
|
||||
}
|
||||
|
||||
return { forwardedArgs, watchMode };
|
||||
}
|
||||
|
||||
export function buildVitestArgs(args) {
|
||||
const { forwardedArgs, watchMode } = parseTestProjectsArgs(args);
|
||||
return [
|
||||
"exec",
|
||||
"vitest",
|
||||
...(watchMode ? [] : ["run"]),
|
||||
"--config",
|
||||
"vitest.projects.config.ts",
|
||||
...forwardedArgs,
|
||||
];
|
||||
}
|
||||
23
scripts/test-projects.mjs
Normal file
23
scripts/test-projects.mjs
Normal file
@@ -0,0 +1,23 @@
|
||||
import { spawn } from "node:child_process";
|
||||
import { buildVitestArgs } from "./test-projects-lib.mjs";
|
||||
|
||||
const command = process.platform === "win32" ? "pnpm.cmd" : "pnpm";
|
||||
const vitestArgs = buildVitestArgs(process.argv.slice(2));
|
||||
|
||||
const child = spawn(command, vitestArgs, {
|
||||
stdio: "inherit",
|
||||
env: process.env,
|
||||
});
|
||||
|
||||
child.on("exit", (code, signal) => {
|
||||
if (signal) {
|
||||
process.kill(process.pid, signal);
|
||||
return;
|
||||
}
|
||||
process.exit(code ?? 1);
|
||||
});
|
||||
|
||||
child.on("error", (error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
32
test/scripts/test-projects-lib.test.ts
Normal file
32
test/scripts/test-projects-lib.test.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { buildVitestArgs, parseTestProjectsArgs } from "../../scripts/test-projects-lib.mjs";
|
||||
|
||||
describe("test-projects args", () => {
|
||||
it("drops a pnpm passthrough separator while preserving targeted filters", () => {
|
||||
expect(parseTestProjectsArgs(["--", "src/foo.test.ts", "-t", "target"])).toEqual({
|
||||
forwardedArgs: ["src/foo.test.ts", "-t", "target"],
|
||||
watchMode: false,
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps watch mode explicit without leaking the sentinel to Vitest", () => {
|
||||
expect(buildVitestArgs(["--watch", "--", "src/foo.test.ts"])).toEqual([
|
||||
"exec",
|
||||
"vitest",
|
||||
"--config",
|
||||
"vitest.projects.config.ts",
|
||||
"src/foo.test.ts",
|
||||
]);
|
||||
});
|
||||
|
||||
it("uses run mode by default", () => {
|
||||
expect(buildVitestArgs(["src/foo.test.ts"])).toEqual([
|
||||
"exec",
|
||||
"vitest",
|
||||
"run",
|
||||
"--config",
|
||||
"vitest.projects.config.ts",
|
||||
"src/foo.test.ts",
|
||||
]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user