mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
test(bench): trim shared helper duplicates (#121745)
This commit is contained in:
committed by
GitHub
parent
7e03fe3ba0
commit
a2dc90765c
@@ -6,12 +6,7 @@ import path from "node:path";
|
||||
import { performance } from "node:perf_hooks";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { delay, stopChild } from "./lib/gateway-bench-child.ts";
|
||||
import {
|
||||
getFreePort,
|
||||
parseProcessRssKb,
|
||||
readProcessRssMb,
|
||||
readProcessTreeCpuMs,
|
||||
} from "./lib/gateway-bench-probes.ts";
|
||||
import { getFreePort, readProcessRssMb, readProcessTreeCpuMs } from "./lib/gateway-bench-probes.ts";
|
||||
import {
|
||||
BASE_GATEWAY_BENCH_CONFIG,
|
||||
buildGatewayBenchChildArgs,
|
||||
@@ -832,10 +827,6 @@ export const testing = {
|
||||
collectResultFailures,
|
||||
collectStartupTrace,
|
||||
parseOptions,
|
||||
parseNonNegativeInt,
|
||||
parsePositiveInt,
|
||||
parseProcessRssKb,
|
||||
resolveEntry,
|
||||
sanitizedEnv,
|
||||
stopChild,
|
||||
summarizeCase,
|
||||
|
||||
@@ -55,8 +55,6 @@ describe("gateway startup benchmark script", () => {
|
||||
|
||||
it("rejects ambiguous benchmark CLI values before spawning Node", () => {
|
||||
expect(() => testing.parseOptions(["--wat"])).toThrow("Unknown argument: --wat");
|
||||
expect(testing.parsePositiveInt("5", 1, "--runs")).toBe(5);
|
||||
expect(testing.parseNonNegativeInt("0", 1, "--warmup")).toBe(0);
|
||||
expect(
|
||||
testing.parseOptions([
|
||||
"--case",
|
||||
@@ -76,9 +74,6 @@ describe("gateway startup benchmark script", () => {
|
||||
output: "startup.json",
|
||||
runs: 2,
|
||||
});
|
||||
expect(() => testing.parsePositiveInt("2abc", 1, "--runs")).toThrow(
|
||||
/--runs must be an integer/u,
|
||||
);
|
||||
expect(() => testing.parseOptions(["--output", "--case", "default"])).toThrow(
|
||||
"--output requires a value",
|
||||
);
|
||||
@@ -92,7 +87,6 @@ describe("gateway startup benchmark script", () => {
|
||||
expect(() =>
|
||||
testing.parseOptions(["--output", "first.json", "--output", "second.json"]),
|
||||
).toThrow("--output was provided more than once");
|
||||
expect(() => testing.resolveEntry("--inspect")).toThrow(/must be a file path/u);
|
||||
});
|
||||
|
||||
it("rejects unknown benchmark CLI args before running cases", () => {
|
||||
@@ -154,14 +148,6 @@ describe("gateway startup benchmark script", () => {
|
||||
expect(env.OPENCLAW_GATEWAY_STARTUP_TRACE).toBe("1");
|
||||
});
|
||||
|
||||
it("rejects malformed ps RSS samples", () => {
|
||||
expect(testing.parseProcessRssKb("2048\n")).toBe(2048);
|
||||
expect(testing.parseProcessRssKb("2048kb\n")).toBeNull();
|
||||
expect(testing.parseProcessRssKb("2048 4096\n")).toBeNull();
|
||||
expect(testing.parseProcessRssKb("0\n")).toBeNull();
|
||||
expect(testing.parseProcessRssKb("")).toBeNull();
|
||||
});
|
||||
|
||||
it("classifies HTTP listen and gateway ready logs separately", () => {
|
||||
expect(
|
||||
testing.classifyGatewayReadyLog("[gateway] http server listening (0 plugins, 0.8s)"),
|
||||
|
||||
Reference in New Issue
Block a user