fix(ci): reduce slow channel test skew

This commit is contained in:
Vincent Koc
2026-03-31 19:48:17 +09:00
parent da7f016db6
commit cf3ae2612b
14 changed files with 230 additions and 31 deletions

View File

@@ -152,6 +152,39 @@ describe("test planner", () => {
artifacts.cleanupTempArtifacts();
});
it("auto-isolates timed-heavy channel suites in CI", () => {
const env = {
CI: "true",
GITHUB_ACTIONS: "true",
RUNNER_OS: "Linux",
OPENCLAW_TEST_HOST_CPU_COUNT: "4",
OPENCLAW_TEST_HOST_MEMORY_GIB: "16",
};
const artifacts = createExecutionArtifacts(env);
const plan = buildExecutionPlan(
{
profile: null,
mode: "ci",
surfaces: ["channels"],
passthroughArgs: [],
},
{
env,
platform: "linux",
writeTempJsonArtifact: artifacts.writeTempJsonArtifact,
},
);
const hotspotUnit = plan.selectedUnits.find(
(unit) => unit.id === "channels-bot-native-commands.plugin-auth-isolated",
);
expect(hotspotUnit).toBeTruthy();
expect(hotspotUnit?.isolate).toBe(true);
expect(hotspotUnit?.reasons).toContain("channels-timed-heavy");
artifacts.cleanupTempArtifacts();
});
it("scales down mid-tier local concurrency under saturated load", () => {
const artifacts = createExecutionArtifacts({
RUNNER_OS: "Linux",
@@ -437,6 +470,25 @@ describe("test planner", () => {
expect(explanation.reasons).toContain("extensions-timed-heavy");
});
it("explains timed-heavy channel suites as isolated", () => {
const explanation = explainExecutionTarget(
{
mode: "ci",
fileFilters: ["extensions/telegram/src/bot-native-commands.plugin-auth.test.ts"],
},
{
env: {
CI: "true",
GITHUB_ACTIONS: "true",
},
},
);
expect(explanation.surface).toBe("channels");
expect(explanation.isolate).toBe(true);
expect(explanation.reasons).toContain("channels-timed-heavy");
});
it("does not leak default-plan shard assignments into targeted units with the same id", () => {
const artifacts = createExecutionArtifacts({});
const plan = buildExecutionPlan(
@@ -573,13 +625,13 @@ describe("test planner", () => {
expect(manifest.jobs.buildArtifacts.enabled).toBe(true);
expect(manifest.shardCounts.unit).toBe(4);
expect(manifest.shardCounts.channels).toBe(3);
expect(manifest.shardCounts.channels).toBe(4);
expect(manifest.shardCounts.extensionFast).toBeGreaterThanOrEqual(4);
expect(manifest.shardCounts.extensionFast).toBeLessThanOrEqual(5);
expect(manifest.shardCounts.windows).toBe(6);
expect(manifest.shardCounts.macosNode).toBe(9);
expect(manifest.shardCounts.bun).toBe(6);
expect(manifest.jobs.checks.matrix.include).toHaveLength(7);
expect(manifest.jobs.checks.matrix.include).toHaveLength(8);
expect(manifest.jobs.checksWindows.matrix.include).toHaveLength(6);
expect(manifest.jobs.bunChecks.matrix.include).toHaveLength(6);
expect(manifest.jobs.macosNode.matrix.include).toHaveLength(9);