mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-28 01:33:35 +00:00
chore(deadcode): prune stale test hooks
This commit is contained in:
@@ -10,7 +10,6 @@ import {
|
||||
composeProviderStreamWrappers,
|
||||
createAnthropicThinkingPrefillPayloadWrapper,
|
||||
resolveAnthropicPayloadPolicy,
|
||||
stripTrailingAnthropicAssistantPrefillWhenThinking,
|
||||
streamWithPayloadPatch,
|
||||
} from "openclaw/plugin-sdk/provider-stream-shared";
|
||||
import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
|
||||
@@ -251,6 +250,5 @@ export function wrapAnthropicProviderStream(
|
||||
/** Test-only hooks for Anthropic stream wrapper behavior. */
|
||||
export const testing = {
|
||||
log,
|
||||
stripTrailingAssistantPrefillWhenThinking: stripTrailingAnthropicAssistantPrefillWhenThinking,
|
||||
};
|
||||
export { testing as __testing };
|
||||
|
||||
@@ -834,17 +834,6 @@ function isProcessLikelyAlive(pid: number): boolean {
|
||||
}
|
||||
}
|
||||
|
||||
async function canStealStaleLock(lockPath: string): Promise<boolean> {
|
||||
const ownerPid = await fs
|
||||
.readFile(lockPath, "utf-8")
|
||||
.then((raw) => parseLockOwnerPid(raw))
|
||||
.catch(() => null);
|
||||
if (ownerPid === null) {
|
||||
return true;
|
||||
}
|
||||
return !isProcessLikelyAlive(ownerPid);
|
||||
}
|
||||
|
||||
async function sleep(ms: number): Promise<void> {
|
||||
await new Promise<void>((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
@@ -2813,7 +2802,6 @@ export async function removeGroundedShortTermCandidates(params: {
|
||||
|
||||
export const testing = {
|
||||
parseLockOwnerPid,
|
||||
canStealStaleLock,
|
||||
isProcessLikelyAlive,
|
||||
readRecallStore: readStore,
|
||||
readPhaseSignalStore,
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
// Qa Matrix plugin module implements scenarios behavior.
|
||||
import {
|
||||
MATRIX_QA_BOT_DM_ROOM_KEY,
|
||||
MATRIX_QA_DRIVER_DM_ROOM_KEY,
|
||||
MATRIX_QA_DRIVER_DM_SHARED_ROOM_KEY,
|
||||
MATRIX_QA_E2EE_ROOM_KEY,
|
||||
MATRIX_QA_MEDIA_ROOM_KEY,
|
||||
MATRIX_QA_PROFILE_NAMES,
|
||||
MATRIX_QA_MEMBERSHIP_ROOM_KEY,
|
||||
MATRIX_QA_SCENARIOS,
|
||||
MATRIX_QA_SECONDARY_ROOM_KEY,
|
||||
MATRIX_QA_STANDARD_SCENARIO_IDS,
|
||||
@@ -20,10 +16,8 @@ import {
|
||||
buildMatrixReplyArtifact,
|
||||
buildMatrixReplyDetails,
|
||||
buildMentionPrompt,
|
||||
readMatrixQaSyncCursor,
|
||||
runMatrixQaCanary,
|
||||
runMatrixQaScenario,
|
||||
writeMatrixQaSyncCursor,
|
||||
type MatrixQaScenarioContext,
|
||||
} from "./scenario-runtime.js";
|
||||
import type { MatrixQaCanaryArtifact, MatrixQaScenarioArtifacts } from "./scenario-types.js";
|
||||
@@ -41,13 +35,9 @@ export type { MatrixQaCanaryArtifact, MatrixQaScenarioArtifacts };
|
||||
export type { MatrixQaScenarioContext };
|
||||
|
||||
export const testing = {
|
||||
MATRIX_QA_BOT_DM_ROOM_KEY,
|
||||
MATRIX_QA_DRIVER_DM_ROOM_KEY,
|
||||
MATRIX_QA_DRIVER_DM_SHARED_ROOM_KEY,
|
||||
MATRIX_QA_E2EE_ROOM_KEY,
|
||||
MATRIX_QA_MEDIA_ROOM_KEY,
|
||||
MATRIX_QA_MEMBERSHIP_ROOM_KEY,
|
||||
MATRIX_QA_PROFILE_NAMES,
|
||||
MATRIX_QA_SECONDARY_ROOM_KEY,
|
||||
MATRIX_QA_STANDARD_SCENARIO_IDS,
|
||||
buildMatrixQaE2eeScenarioRoomKey,
|
||||
@@ -58,8 +48,6 @@ export const testing = {
|
||||
findMatrixQaScenarios,
|
||||
getMatrixQaProfileScenarioIds: matrixQaProfileTesting.getMatrixQaProfileScenarioIds,
|
||||
normalizeMatrixQaProfile: matrixQaProfileTesting.normalizeMatrixQaProfile,
|
||||
readMatrixQaSyncCursor,
|
||||
resolveMatrixQaScenarioRoomId,
|
||||
writeMatrixQaSyncCursor,
|
||||
};
|
||||
export { testing as __testing };
|
||||
|
||||
@@ -10,7 +10,6 @@ import { writeGatewayRestartIntentSync } from "../src/infra/restart.js";
|
||||
import { parseStrictIntegerOption } from "./lib/dev-tooling-safety.ts";
|
||||
import { delay, stopChild, type StopChildResult } from "./lib/gateway-bench-child.ts";
|
||||
import {
|
||||
classifyProbeErrorKind,
|
||||
getFreePort,
|
||||
parseProcessRssKb,
|
||||
readProcessRssMb,
|
||||
@@ -1635,7 +1634,6 @@ async function main() {
|
||||
|
||||
export const testing = {
|
||||
classifyGatewayReadyLog,
|
||||
classifyProbeErrorKind,
|
||||
collectOutputLines,
|
||||
collectTraceLine,
|
||||
countLsofFileDescriptors,
|
||||
|
||||
@@ -8,7 +8,6 @@ import { pathToFileURL } from "node:url";
|
||||
import { parseStrictIntegerOption } from "./lib/dev-tooling-safety.ts";
|
||||
import { delay, stopChild } from "./lib/gateway-bench-child.ts";
|
||||
import {
|
||||
classifyProbeErrorKind,
|
||||
getFreePort,
|
||||
parseProcessRssKb,
|
||||
readProcessRssMb,
|
||||
@@ -984,7 +983,6 @@ async function main() {
|
||||
|
||||
export const testing = {
|
||||
classifyGatewayReadyLog,
|
||||
classifyProbeErrorKind,
|
||||
collectResultFailures,
|
||||
collectStartupTrace,
|
||||
parseOptions,
|
||||
|
||||
@@ -7,8 +7,31 @@ import path from "node:path";
|
||||
import { performance } from "node:perf_hooks";
|
||||
import { beforeAll, describe, expect, it } from "vitest";
|
||||
import { testing } from "../../scripts/bench-gateway-restart.ts";
|
||||
import type { DB as OpenClawStateKyselyDatabase } from "../../src/state/openclaw-state-db.generated.js";
|
||||
import {
|
||||
closeOpenClawStateDatabaseForTest,
|
||||
openOpenClawStateDatabase,
|
||||
} from "../../src/state/openclaw-state-db.js";
|
||||
import {
|
||||
executeSqliteQueryTakeFirstSync,
|
||||
getNodeSqliteKysely,
|
||||
} from "../../src/infra/kysely-sync.js";
|
||||
import { registerStopChildBehaviorTests } from "./bench-gateway-child-test-support.js";
|
||||
|
||||
type GatewayRestartIntentDatabase = Pick<OpenClawStateKyselyDatabase, "gateway_restart_intent">;
|
||||
|
||||
function readRestartIntentRow(env: NodeJS.ProcessEnv) {
|
||||
const { db } = openOpenClawStateDatabase({ env });
|
||||
const stateDb = getNodeSqliteKysely<GatewayRestartIntentDatabase>(db);
|
||||
return executeSqliteQueryTakeFirstSync(
|
||||
db,
|
||||
stateDb
|
||||
.selectFrom("gateway_restart_intent")
|
||||
.select(["intent_key", "kind", "pid", "reason"])
|
||||
.where("intent_key", "=", "gateway-restart"),
|
||||
);
|
||||
}
|
||||
|
||||
describe("gateway restart benchmark script", () => {
|
||||
let helpResult: ReturnType<typeof spawnSync>;
|
||||
|
||||
@@ -673,17 +696,16 @@ node 1234 user 12u IPv4 0t0 TCP localhost:1234
|
||||
const env = { OPENCLAW_STATE_DIR: path.join(root, "state") };
|
||||
|
||||
expect(testing.writeRestartIntent(env, 12345, "gateway-restart-bench")).toBe(true);
|
||||
const raw = fs.readFileSync(path.join(root, "state", "gateway-restart-intent.json"), "utf8");
|
||||
const parsed = JSON.parse(raw) as {
|
||||
kind?: unknown;
|
||||
pid?: unknown;
|
||||
reason?: unknown;
|
||||
};
|
||||
const row = readRestartIntentRow(env);
|
||||
|
||||
expect(parsed.kind).toBe("gateway-restart");
|
||||
expect(parsed.pid).toBe(12345);
|
||||
expect(parsed.reason).toBe("gateway-restart-bench");
|
||||
expect(row).toMatchObject({
|
||||
intent_key: "gateway-restart",
|
||||
kind: "gateway-restart",
|
||||
pid: 12345,
|
||||
reason: "gateway-restart-bench",
|
||||
});
|
||||
} finally {
|
||||
closeOpenClawStateDatabaseForTest();
|
||||
fs.rmSync(root, { force: true, recursive: true });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user