mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 17:10:49 +00:00
perf(test): split gateway server control-plane shard
This commit is contained in:
@@ -17,6 +17,19 @@ type VitestConfig = {
|
||||
};
|
||||
|
||||
const PLUGIN_PRERELEASE_NPM_SPEC_TEST = "src/plugins/install.npm-spec.test.ts";
|
||||
const GATEWAY_SERVER_BACKED_HTTP_TESTS = new Set([
|
||||
"src/gateway/embeddings-http.test.ts",
|
||||
"src/gateway/models-http.test.ts",
|
||||
"src/gateway/openai-http.test.ts",
|
||||
"src/gateway/openresponses-http.test.ts",
|
||||
"src/gateway/probe.auth.integration.test.ts",
|
||||
]);
|
||||
|
||||
const GATEWAY_SERVER_EXCLUDED_TESTS = new Set([
|
||||
"src/gateway/gateway.test.ts",
|
||||
"src/gateway/server.startup-matrix-migration.integration.test.ts",
|
||||
"src/gateway/sessions-history-http.test.ts",
|
||||
]);
|
||||
|
||||
function listTestFiles(rootDir: string): string[] {
|
||||
if (!existsSync(rootDir)) {
|
||||
@@ -53,6 +66,15 @@ function listMatchedTestFiles(config: VitestConfig): string[] {
|
||||
.toSorted((a, b) => a.localeCompare(b));
|
||||
}
|
||||
|
||||
function isGatewayServerTestFile(file: string): boolean {
|
||||
return (
|
||||
file.startsWith("src/gateway/") &&
|
||||
!file.startsWith("src/gateway/server-methods/") &&
|
||||
!GATEWAY_SERVER_EXCLUDED_TESTS.has(file) &&
|
||||
(file.includes("server") || GATEWAY_SERVER_BACKED_HTTP_TESTS.has(file))
|
||||
);
|
||||
}
|
||||
|
||||
describe("scripts/lib/ci-node-test-plan.mjs", () => {
|
||||
it("combines the small core unit shards to reduce CI runner fanout", () => {
|
||||
const coreUnitShards = createNodeTestShards()
|
||||
@@ -172,7 +194,9 @@ describe("scripts/lib/ci-node-test-plan.mjs", () => {
|
||||
|
||||
it("splits the agentic lane into control-plane, command, agent, gateway, SDK, and plugin shards", () => {
|
||||
const shards = createNodeTestShards();
|
||||
const controlPlaneShard = shards.find((shard) => shard.shardName === "agentic-control-plane");
|
||||
const controlPlaneShards = shards.filter((shard) =>
|
||||
shard.shardName.startsWith("agentic-control-plane-"),
|
||||
);
|
||||
const cliShard = shards.find((shard) => shard.shardName === "agentic-cli");
|
||||
const commandSupportShard = shards.find(
|
||||
(shard) => shard.shardName === "agentic-command-support",
|
||||
@@ -186,13 +210,30 @@ describe("scripts/lib/ci-node-test-plan.mjs", () => {
|
||||
const pluginSdkShard = shards.find((shard) => shard.shardName === "agentic-plugin-sdk");
|
||||
const pluginsShard = shards.find((shard) => shard.shardName === "agentic-plugins");
|
||||
|
||||
expect(controlPlaneShard).toEqual({
|
||||
checkName: "checks-node-agentic-control-plane",
|
||||
shardName: "agentic-control-plane",
|
||||
configs: ["test/vitest/vitest.gateway-server.config.ts"],
|
||||
runner: "blacksmith-4vcpu-ubuntu-2404",
|
||||
requiresDist: false,
|
||||
});
|
||||
expect(controlPlaneShards.map((shard) => shard.shardName)).toEqual([
|
||||
"agentic-control-plane-agent-chat",
|
||||
"agentic-control-plane-auth-node",
|
||||
"agentic-control-plane-http-models",
|
||||
"agentic-control-plane-runtime",
|
||||
]);
|
||||
expect(controlPlaneShards).toEqual(
|
||||
controlPlaneShards.map((shard) => ({
|
||||
checkName: `checks-node-${shard.shardName}`,
|
||||
configs: ["test/vitest/vitest.gateway-server.config.ts"],
|
||||
includePatterns: shard.includePatterns,
|
||||
requiresDist: false,
|
||||
runner: "blacksmith-4vcpu-ubuntu-2404",
|
||||
shardName: shard.shardName,
|
||||
})),
|
||||
);
|
||||
const controlPlaneShardFiles = controlPlaneShards
|
||||
.flatMap((shard) => shard.includePatterns ?? [])
|
||||
.toSorted((a, b) => a.localeCompare(b));
|
||||
const expectedControlPlaneFiles = listTestFiles("src/gateway")
|
||||
.filter(isGatewayServerTestFile)
|
||||
.toSorted((a, b) => a.localeCompare(b));
|
||||
expect(controlPlaneShardFiles).toEqual(expectedControlPlaneFiles);
|
||||
expect(new Set(controlPlaneShardFiles).size).toBe(controlPlaneShardFiles.length);
|
||||
expect(cliShard).toEqual({
|
||||
checkName: "checks-node-agentic-cli",
|
||||
shardName: "agentic-cli",
|
||||
|
||||
Reference in New Issue
Block a user