fix(perf): preserve gateway health benchmark auth

This commit is contained in:
Peter Steinberger
2026-05-28 20:29:04 +01:00
parent ec8ff27803
commit f99259d25c
2 changed files with 25 additions and 4 deletions

View File

@@ -532,12 +532,19 @@ function collectExitSummary(samples: Sample[]): string {
}
function buildConfigFixture(commandCase: CommandCase): Record<string, unknown> | null {
if (commandCase.id !== "configGetGatewayPort") {
if (commandCase.id !== "configGetGatewayPort" && commandCase.id !== "gatewayHealthJson") {
return null;
}
const envPort = Number.parseInt(process.env.OPENCLAW_GATEWAY_PORT ?? "", 10);
const port = Number.isFinite(envPort) && envPort > 0 ? envPort : 32123;
return { gateway: { port } };
return {
gateway: {
auth: { mode: "none" },
bind: "loopback",
mode: "local",
port,
},
};
}
function buildRssHook(tmpDir: string): string {

View File

@@ -171,7 +171,14 @@ describe("bench-cli-startup", () => {
args: ["config", "get", "gateway.port"],
presets: ["real"],
}),
).toEqual({ gateway: { port: 32123 } });
).toEqual({
gateway: {
auth: { mode: "none" },
bind: "loopback",
mode: "local",
port: 32123,
},
});
expect(
testing.buildConfigFixture({
id: "gatewayHealthJson",
@@ -179,6 +186,13 @@ describe("bench-cli-startup", () => {
args: ["gateway", "health", "--json"],
presets: ["real"],
}),
).toBeNull();
).toEqual({
gateway: {
auth: { mode: "none" },
bind: "loopback",
mode: "local",
port: 32123,
},
});
});
});