Skip to content

Commit 04994f1

Browse files
committed
test(scripts): normalize RPC RTT path assertions
1 parent 9b4c582 commit 04994f1

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

‎test/scripts/measure-rpc-rtt.test.ts‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Measure Rpc Rtt tests cover measure rpc rtt script behavior.
22
import { spawnSync } from "node:child_process";
33
import { EventEmitter } from "node:events";
4+
import path from "node:path";
45
import { describe, expect, it, vi } from "vitest";
56
import { resolveWindowsTaskkillPath } from "../../scripts/lib/windows-taskkill.mjs";
67
import {
@@ -280,6 +281,8 @@ describe("scripts/measure-rpc-rtt.mjs", () => {
280281
});
281282

282283
it("closes parent gateway log handles after spawning", async () => {
284+
const repoRoot = "/repo";
285+
const tempRoot = "/tmp/rpc-rtt";
283286
const child = Object.assign(new EventEmitter(), {
284287
exitCode: null,
285288
kill: vi.fn(),
@@ -296,12 +299,12 @@ describe("scripts/measure-rpc-rtt.mjs", () => {
296299
env: { PATH: "/bin" },
297300
openImpl,
298301
port: 23456,
299-
repoRoot: "/repo",
302+
repoRoot,
300303
sourceEntryExists: () => true,
301304
spawnImpl,
302305
stderrPath: "/tmp/stderr.log",
303306
stdoutPath: "/tmp/stdout.log",
304-
tempRoot: "/tmp/rpc-rtt",
307+
tempRoot,
305308
token: "secret-token",
306309
}),
307310
).resolves.toBe(child);
@@ -313,7 +316,7 @@ describe("scripts/measure-rpc-rtt.mjs", () => {
313316
[
314317
"--import",
315318
"tsx",
316-
"/repo/src/entry.ts",
319+
path.join(repoRoot, "src", "entry.ts"),
317320
"gateway",
318321
"run",
319322
"--port",
@@ -323,13 +326,13 @@ describe("scripts/measure-rpc-rtt.mjs", () => {
323326
"--allow-unconfigured",
324327
],
325328
expect.objectContaining({
326-
cwd: "/repo",
329+
cwd: repoRoot,
327330
detached: process.platform !== "win32",
328331
env: expect.objectContaining({
329-
HOME: "/tmp/rpc-rtt/home",
332+
HOME: path.join(tempRoot, "home"),
330333
OPENCLAW_CONFIG_PATH: "/tmp/openclaw.json",
331334
OPENCLAW_GATEWAY_TOKEN: "secret-token",
332-
OPENCLAW_STATE_DIR: "/tmp/rpc-rtt/state",
335+
OPENCLAW_STATE_DIR: path.join(tempRoot, "state"),
333336
PATH: "/bin",
334337
}),
335338
stdio: ["ignore", 41, 42],

0 commit comments

Comments
 (0)