ci: rebalance test workers

This commit is contained in:
Peter Steinberger
2026-04-22 22:26:02 +01:00
parent 65ae1e54de
commit 77dbc1cda6
20 changed files with 460 additions and 111 deletions

View File

@@ -16,7 +16,7 @@ function listContractTests(rootDir = "src/channels/plugins/contracts"): string[]
describe("scripts/lib/channel-contract-test-plan.mjs", () => {
it("splits channel contracts into focused shards", () => {
const suffixes = ["a", "b", "c", "d"];
const suffixes = ["a", "b", "c"];
expect(
createChannelContractTestShards().map((shard) => ({
@@ -51,7 +51,7 @@ describe("scripts/lib/channel-contract-test-plan.mjs", () => {
const surfaceRegistryFiles = shard.includePatterns.filter((pattern) =>
pattern.includes("/surfaces-only.registry-backed-shard-"),
);
expect(surfaceRegistryFiles.length).toBeLessThanOrEqual(2);
expect(surfaceRegistryFiles.length).toBeLessThanOrEqual(3);
}
});
});

View File

@@ -73,6 +73,7 @@ describe("scripts/lib/ci-node-test-plan.mjs", () => {
"test/vitest/vitest.secrets.config.ts",
"test/vitest/vitest.logging.config.ts",
"test/vitest/vitest.process.config.ts",
"test/vitest/vitest.runtime-config.config.ts",
],
requiresDist: false,
shardName: "core-runtime-infra",
@@ -92,7 +93,6 @@ describe("scripts/lib/ci-node-test-plan.mjs", () => {
configs: [
"test/vitest/vitest.acp.config.ts",
"test/vitest/vitest.cron.config.ts",
"test/vitest/vitest.runtime-config.config.ts",
"test/vitest/vitest.shared-core.config.ts",
"test/vitest/vitest.tasks.config.ts",
"test/vitest/vitest.utils.config.ts",

View File

@@ -0,0 +1,49 @@
import { describe, expect, it } from "vitest";
import { summarizeRunTimings } from "../../scripts/ci-run-timings.mjs";
describe("scripts/ci-run-timings.mjs", () => {
it("separates queue time from job duration", () => {
const summary = summarizeRunTimings(
{
conclusion: "success",
createdAt: "2026-04-22T10:00:00Z",
jobs: [
{
completedAt: "2026-04-22T10:01:20Z",
conclusion: "success",
name: "slow",
startedAt: "2026-04-22T10:00:20Z",
status: "completed",
},
{
completedAt: "2026-04-22T10:01:00Z",
conclusion: "success",
name: "queued",
startedAt: "2026-04-22T10:00:50Z",
status: "completed",
},
{
completedAt: "2026-04-22T10:00:01Z",
conclusion: "skipped",
name: "matrix.check_name",
startedAt: "2026-04-22T10:00:01Z",
status: "completed",
},
],
status: "completed",
updatedAt: "2026-04-22T10:01:30Z",
},
2,
);
expect(summary.wallSeconds).toBe(90);
expect(summary.byDuration.map((job) => [job.name, job.durationSeconds])).toEqual([
["slow", 60],
["queued", 10],
]);
expect(summary.byQueue.map((job) => [job.name, job.queueSeconds])).toEqual([
["queued", 50],
["slow", 20],
]);
});
});

View File

@@ -173,12 +173,27 @@ describe("scripts/test-extension.mjs", () => {
expect(plan.hasTests).toBe(true);
});
it("keeps non-provider extensions on the shared extensions vitest config", () => {
const plan = resolveExtensionTestPlan({ targetArg: "firecrawl", cwd: process.cwd() });
it("resolves broad dedicated extension groups onto their narrow vitest configs", () => {
expect(resolveExtensionTestPlan({ targetArg: "browser", cwd: process.cwd() }).config).toBe(
"test/vitest/vitest.extension-browser.config.ts",
);
expect(resolveExtensionTestPlan({ targetArg: "qa-lab", cwd: process.cwd() }).config).toBe(
"test/vitest/vitest.extension-qa.config.ts",
);
expect(resolveExtensionTestPlan({ targetArg: "vydra", cwd: process.cwd() }).config).toBe(
"test/vitest/vitest.extension-media.config.ts",
);
expect(resolveExtensionTestPlan({ targetArg: "firecrawl", cwd: process.cwd() }).config).toBe(
"test/vitest/vitest.extension-misc.config.ts",
);
});
expect(plan.extensionId).toBe("firecrawl");
it("keeps unmatched non-provider extensions on the shared extensions vitest config", () => {
const plan = resolveExtensionTestPlan({ targetArg: "codex", cwd: process.cwd() });
expect(plan.extensionId).toBe("codex");
expect(plan.config).toBe("test/vitest/vitest.extensions.config.ts");
expect(plan.roots).toContain(bundledPluginRoot("firecrawl"));
expect(plan.roots).toContain(bundledPluginRoot("codex"));
expect(plan.hasTests).toBe(true);
});
@@ -260,12 +275,16 @@ describe("scripts/test-extension.mjs", () => {
"bluebubbles",
"acpx",
"diffs",
"browser",
"qa-lab",
"vydra",
],
});
expect(batch.extensionIds).toEqual([
"acpx",
"bluebubbles",
"browser",
"diffs",
"feishu",
"firecrawl",
@@ -276,9 +295,11 @@ describe("scripts/test-extension.mjs", () => {
"memory-core",
"msteams",
"openai",
"qa-lab",
"slack",
"telegram",
"voice-call",
"vydra",
"whatsapp",
"zalo",
"zalouser",
@@ -298,6 +319,13 @@ describe("scripts/test-extension.mjs", () => {
roots: [bundledPluginRoot("bluebubbles")],
testFileCount: expect.any(Number),
},
{
config: "test/vitest/vitest.extension-browser.config.ts",
estimatedCost: expect.any(Number),
extensionIds: ["browser"],
roots: [bundledPluginRoot("browser")],
testFileCount: expect.any(Number),
},
{
config: "test/vitest/vitest.extension-diffs.config.ts",
estimatedCost: expect.any(Number),
@@ -340,6 +368,13 @@ describe("scripts/test-extension.mjs", () => {
roots: [bundledPluginRoot("mattermost")],
testFileCount: expect.any(Number),
},
{
config: "test/vitest/vitest.extension-media.config.ts",
estimatedCost: expect.any(Number),
extensionIds: ["vydra"],
roots: [bundledPluginRoot("vydra")],
testFileCount: expect.any(Number),
},
{
config: "test/vitest/vitest.extension-memory.config.ts",
estimatedCost: expect.any(Number),
@@ -347,6 +382,13 @@ describe("scripts/test-extension.mjs", () => {
roots: [bundledPluginRoot("memory-core")],
testFileCount: expect.any(Number),
},
{
config: "test/vitest/vitest.extension-misc.config.ts",
estimatedCost: expect.any(Number),
extensionIds: ["firecrawl"],
roots: [bundledPluginRoot("firecrawl")],
testFileCount: expect.any(Number),
},
{
config: "test/vitest/vitest.extension-msteams.config.ts",
estimatedCost: expect.any(Number),
@@ -361,6 +403,13 @@ describe("scripts/test-extension.mjs", () => {
roots: [bundledPluginRoot("openai")],
testFileCount: expect.any(Number),
},
{
config: "test/vitest/vitest.extension-qa.config.ts",
estimatedCost: expect.any(Number),
extensionIds: ["qa-lab"],
roots: [bundledPluginRoot("qa-lab")],
testFileCount: expect.any(Number),
},
{
config: "test/vitest/vitest.extension-slack.config.ts",
estimatedCost: expect.any(Number),
@@ -396,13 +445,6 @@ describe("scripts/test-extension.mjs", () => {
roots: [bundledPluginRoot("zalo"), bundledPluginRoot("zalouser")],
testFileCount: expect.any(Number),
},
{
config: "test/vitest/vitest.extensions.config.ts",
estimatedCost: expect.any(Number),
extensionIds: ["firecrawl"],
roots: [bundledPluginRoot("firecrawl")],
testFileCount: expect.any(Number),
},
]);
});