mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-28 13:03:35 +00:00
test(scripts): normalize RPC RTT path assertions
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// Measure Rpc Rtt tests cover measure rpc rtt script behavior.
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { EventEmitter } from "node:events";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { resolveWindowsTaskkillPath } from "../../scripts/lib/windows-taskkill.mjs";
|
||||
import {
|
||||
@@ -280,6 +281,8 @@ describe("scripts/measure-rpc-rtt.mjs", () => {
|
||||
});
|
||||
|
||||
it("closes parent gateway log handles after spawning", async () => {
|
||||
const repoRoot = "/repo";
|
||||
const tempRoot = "/tmp/rpc-rtt";
|
||||
const child = Object.assign(new EventEmitter(), {
|
||||
exitCode: null,
|
||||
kill: vi.fn(),
|
||||
@@ -296,12 +299,12 @@ describe("scripts/measure-rpc-rtt.mjs", () => {
|
||||
env: { PATH: "/bin" },
|
||||
openImpl,
|
||||
port: 23456,
|
||||
repoRoot: "/repo",
|
||||
repoRoot,
|
||||
sourceEntryExists: () => true,
|
||||
spawnImpl,
|
||||
stderrPath: "/tmp/stderr.log",
|
||||
stdoutPath: "/tmp/stdout.log",
|
||||
tempRoot: "/tmp/rpc-rtt",
|
||||
tempRoot,
|
||||
token: "secret-token",
|
||||
}),
|
||||
).resolves.toBe(child);
|
||||
@@ -313,7 +316,7 @@ describe("scripts/measure-rpc-rtt.mjs", () => {
|
||||
[
|
||||
"--import",
|
||||
"tsx",
|
||||
"/repo/src/entry.ts",
|
||||
path.join(repoRoot, "src", "entry.ts"),
|
||||
"gateway",
|
||||
"run",
|
||||
"--port",
|
||||
@@ -323,13 +326,13 @@ describe("scripts/measure-rpc-rtt.mjs", () => {
|
||||
"--allow-unconfigured",
|
||||
],
|
||||
expect.objectContaining({
|
||||
cwd: "/repo",
|
||||
cwd: repoRoot,
|
||||
detached: process.platform !== "win32",
|
||||
env: expect.objectContaining({
|
||||
HOME: "/tmp/rpc-rtt/home",
|
||||
HOME: path.join(tempRoot, "home"),
|
||||
OPENCLAW_CONFIG_PATH: "/tmp/openclaw.json",
|
||||
OPENCLAW_GATEWAY_TOKEN: "secret-token",
|
||||
OPENCLAW_STATE_DIR: "/tmp/rpc-rtt/state",
|
||||
OPENCLAW_STATE_DIR: path.join(tempRoot, "state"),
|
||||
PATH: "/bin",
|
||||
}),
|
||||
stdio: ["ignore", 41, 42],
|
||||
|
||||
Reference in New Issue
Block a user