mirror of
https://github.com/openclaw/openclaw.git
synced 2026-09-28 14:12:28 +08:00
fix(test): prepare history benchmark before child deadlines (#155780)
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
// Prepare the real benchmark and its self-spawned readers before the child deadline starts.
|
||||
export const benchSessionHistoryEntrypoint = {
|
||||
currentModuleUrl: import.meta.url,
|
||||
sourceWorkerName: "bench-session-history",
|
||||
distWorkerPath: "test-support/bench-session-history.js",
|
||||
} as const;
|
||||
@@ -51,6 +51,7 @@ import { transcriptLibraryTimezoneEntrypoint } from "../../src/transcripts/libra
|
||||
import { tuiPtyRuntimeEntrypoints } from "../../src/tui/tui-pty-runtime-test-support.ts";
|
||||
import { workerBackgroundExecEntrypoints } from "../../src/worker/worker-runtime-background-exec-entrypoints.test-support.ts";
|
||||
import { channelIngressGatewayRestartEntrypoint } from "../../test/fixtures/channel-ingress-gateway-restart-entrypoint.ts";
|
||||
import { benchSessionHistoryEntrypoint } from "../bench-session-history-runtime.test-support.ts";
|
||||
import { runtimeProcessBuildEntrypoints } from "./runtime-process-build-entries.mts";
|
||||
import { createRuntimeProcessBuildEntries } from "./runtime-process-core-build-entries.mts";
|
||||
import { nativeSchtasksIntegrationEnabled } from "./vitest-worker-declarations.mts";
|
||||
@@ -103,6 +104,7 @@ export const vitestWorkerBuildEntries = {
|
||||
"src/commands/doctor/shared/legacy-config-binding-repair.runtime.ts",
|
||||
...createRuntimeProcessBuildEntries([
|
||||
...runtimeProcessBuildEntrypoints,
|
||||
benchSessionHistoryEntrypoint,
|
||||
...Object.values(discordAudioTestEntrypoints),
|
||||
codexCatalogPageWorkerEntrypoint,
|
||||
agentWorkerStoreFixtureEntrypoint,
|
||||
|
||||
@@ -16,6 +16,8 @@ export const runtimeProcessDeclarationEntries = {
|
||||
};
|
||||
export const vitestWorkerDeclarationEntries = {
|
||||
...runtimeProcessDeclarationEntries,
|
||||
"test-support/bench-session-history-runtime":
|
||||
"scripts/bench-session-history-runtime.test-support.ts",
|
||||
"extensions/discord/src/voice/audio-worker-entrypoints.test-support":
|
||||
"extensions/discord/src/voice/audio-worker-entrypoints.test-support.ts",
|
||||
// Codex is package-owned and excluded from the root runtime bundle.
|
||||
|
||||
@@ -1,16 +1,22 @@
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { expect, it } from "vitest";
|
||||
import { benchSessionHistoryEntrypoint } from "../../scripts/bench-session-history-runtime.test-support.js";
|
||||
import {
|
||||
resolveRuntimeWorkerArgv,
|
||||
resolveRuntimeWorkerUrl,
|
||||
} from "../../src/infra/runtime-worker-url.js";
|
||||
import { resolveTestNodeExecPath } from "../../src/test-utils/node-process.js";
|
||||
|
||||
it("drains seeded transcript owners before fresh-process history measurements", () => {
|
||||
const benchmarkUrl = resolveRuntimeWorkerUrl(benchSessionHistoryEntrypoint);
|
||||
expect(benchmarkUrl.pathname).toMatch(/\.js$/u);
|
||||
const execPath = resolveTestNodeExecPath();
|
||||
const result = spawnSync(
|
||||
resolveTestNodeExecPath(),
|
||||
execPath,
|
||||
[
|
||||
"--import",
|
||||
"./scripts/tsx.mjs",
|
||||
"scripts/bench-session-history.ts",
|
||||
...resolveRuntimeWorkerArgv(benchmarkUrl, execPath),
|
||||
"--profile",
|
||||
"long",
|
||||
"small,long",
|
||||
"--operation",
|
||||
"recent",
|
||||
"--samples",
|
||||
@@ -25,6 +31,11 @@ it("drains seeded transcript owners before fresh-process history measurements",
|
||||
expect(report).toEqual(
|
||||
expect.objectContaining({
|
||||
results: [
|
||||
expect.objectContaining({
|
||||
profile: "small",
|
||||
operation: "recent",
|
||||
result: { returned: 20, total: 80 },
|
||||
}),
|
||||
expect.objectContaining({
|
||||
profile: "long",
|
||||
operation: "recent",
|
||||
|
||||
Reference in New Issue
Block a user