mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-06 23:55:12 +00:00
ci: split slow CI shards
This commit is contained in:
@@ -78,7 +78,7 @@ function isGatewayServerTestFile(file: string): boolean {
|
||||
}
|
||||
|
||||
describe("scripts/lib/ci-node-test-plan.mjs", () => {
|
||||
it("combines the small core unit shards to reduce CI runner fanout", () => {
|
||||
it("splits the slow core unit shards while keeping paired source/security coverage", () => {
|
||||
const coreUnitShards = createNodeTestShards()
|
||||
.filter((shard) => shard.shardName.startsWith("core-unit-"))
|
||||
.map((shard) => ({
|
||||
@@ -89,12 +89,9 @@ describe("scripts/lib/ci-node-test-plan.mjs", () => {
|
||||
|
||||
expect(coreUnitShards).toEqual([
|
||||
{
|
||||
configs: [
|
||||
"test/vitest/vitest.unit-fast.config.ts",
|
||||
"test/vitest/vitest.unit-support.config.ts",
|
||||
],
|
||||
configs: ["test/vitest/vitest.unit-fast.config.ts"],
|
||||
requiresDist: false,
|
||||
shardName: "core-unit-fast-support",
|
||||
shardName: "core-unit-fast",
|
||||
},
|
||||
{
|
||||
configs: [
|
||||
@@ -109,6 +106,11 @@ describe("scripts/lib/ci-node-test-plan.mjs", () => {
|
||||
requiresDist: false,
|
||||
shardName: "core-unit-ui",
|
||||
},
|
||||
{
|
||||
configs: ["test/vitest/vitest.unit-support.config.ts"],
|
||||
requiresDist: false,
|
||||
shardName: "core-unit-support",
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -159,13 +161,20 @@ describe("scripts/lib/ci-node-test-plan.mjs", () => {
|
||||
"test/vitest/vitest.infra.config.ts",
|
||||
"test/vitest/vitest.hooks.config.ts",
|
||||
"test/vitest/vitest.secrets.config.ts",
|
||||
],
|
||||
requiresDist: false,
|
||||
runner: "blacksmith-4vcpu-ubuntu-2404",
|
||||
shardName: "core-runtime-infra-state",
|
||||
},
|
||||
{
|
||||
configs: [
|
||||
"test/vitest/vitest.logging.config.ts",
|
||||
"test/vitest/vitest.process.config.ts",
|
||||
"test/vitest/vitest.runtime-config.config.ts",
|
||||
],
|
||||
requiresDist: false,
|
||||
runner: "blacksmith-4vcpu-ubuntu-2404",
|
||||
shardName: "core-runtime-infra",
|
||||
shardName: "core-runtime-infra-process",
|
||||
},
|
||||
{
|
||||
configs: [
|
||||
@@ -216,7 +225,9 @@ describe("scripts/lib/ci-node-test-plan.mjs", () => {
|
||||
"agentic-control-plane-agent-chat",
|
||||
"agentic-control-plane-auth-node",
|
||||
"agentic-control-plane-http-models",
|
||||
"agentic-control-plane-http-plugin-ws",
|
||||
"agentic-control-plane-runtime",
|
||||
"agentic-control-plane-startup-runtime",
|
||||
]);
|
||||
expect(controlPlaneShards).toEqual(
|
||||
controlPlaneShards.map((shard) => ({
|
||||
|
||||
@@ -2,8 +2,10 @@ import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
BOUNDARY_CHECKS,
|
||||
formatCommand,
|
||||
parseShardSpec,
|
||||
resolveConcurrency,
|
||||
runChecks,
|
||||
selectChecksForShard,
|
||||
} from "../../scripts/run-additional-boundary-checks.mjs";
|
||||
|
||||
function createOutputBuffer() {
|
||||
@@ -40,6 +42,21 @@ describe("run-additional-boundary-checks", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("parses and applies CI shard specs", () => {
|
||||
expect(parseShardSpec("2/4")).toEqual({ count: 4, index: 1, label: "2/4" });
|
||||
expect(selectChecksForShard(BOUNDARY_CHECKS, "1/4")).toEqual(
|
||||
BOUNDARY_CHECKS.filter((_check, index) => index % 4 === 0),
|
||||
);
|
||||
const shardedLabels = [1, 2, 3, 4].flatMap((index) =>
|
||||
selectChecksForShard(BOUNDARY_CHECKS, `${index}/4`).map((check) => check.label),
|
||||
);
|
||||
expect(shardedLabels.toSorted()).toEqual(
|
||||
BOUNDARY_CHECKS.map((check) => check.label).toSorted(),
|
||||
);
|
||||
expect(new Set(shardedLabels).size).toBe(BOUNDARY_CHECKS.length);
|
||||
expect(() => parseShardSpec("5/4")).toThrow("Invalid shard spec");
|
||||
});
|
||||
|
||||
it("buffers grouped output and reports aggregate failures", async () => {
|
||||
const buffer = createOutputBuffer();
|
||||
const failures = await runChecks(
|
||||
@@ -62,9 +79,10 @@ describe("run-additional-boundary-checks", () => {
|
||||
expect(failures).toBe(1);
|
||||
expect(text).toContain("::group::passes");
|
||||
expect(text).toContain("ok-out");
|
||||
expect(text).toContain("[ok] passes");
|
||||
expect(text).toContain("[ok] passes in ");
|
||||
expect(text).toContain("::group::fails");
|
||||
expect(text).toContain("bad-out");
|
||||
expect(text).toContain("::error title=fails failed::fails failed (exit 7)");
|
||||
expect(text).toContain("Additional boundary check timings:");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user