mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 00:38:28 +00:00
perf(test): trim bash e2e log fixtures and abort wait bounds
This commit is contained in:
@@ -223,7 +223,7 @@ describe("exec tool backgrounding", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("defaults process log to a bounded tail when no window is provided", async () => {
|
it("defaults process log to a bounded tail when no window is provided", async () => {
|
||||||
const lines = Array.from({ length: 260 }, (_value, index) => `line-${index + 1}`);
|
const lines = Array.from({ length: 220 }, (_value, index) => `line-${index + 1}`);
|
||||||
const sessionId = await runBackgroundEchoLines(lines);
|
const sessionId = await runBackgroundEchoLines(lines);
|
||||||
|
|
||||||
const log = await processTool.execute("call2", {
|
const log = await processTool.execute("call2", {
|
||||||
@@ -232,11 +232,11 @@ describe("exec tool backgrounding", () => {
|
|||||||
});
|
});
|
||||||
const textBlock = log.content.find((c) => c.type === "text")?.text ?? "";
|
const textBlock = log.content.find((c) => c.type === "text")?.text ?? "";
|
||||||
const firstLine = textBlock.split("\n")[0]?.trim();
|
const firstLine = textBlock.split("\n")[0]?.trim();
|
||||||
expect(textBlock).toContain("showing last 200 of 260 lines");
|
expect(textBlock).toContain("showing last 200 of 220 lines");
|
||||||
expect(firstLine).toBe("line-61");
|
expect(firstLine).toBe("line-21");
|
||||||
expect(textBlock).toContain("line-61");
|
expect(textBlock).toContain("line-21");
|
||||||
expect(textBlock).toContain("line-260");
|
expect(textBlock).toContain("line-220");
|
||||||
expect((log.details as { totalLines?: number }).totalLines).toBe(260);
|
expect((log.details as { totalLines?: number }).totalLines).toBe(220);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("supports line offsets for log slices", async () => {
|
it("supports line offsets for log slices", async () => {
|
||||||
@@ -258,7 +258,7 @@ describe("exec tool backgrounding", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("keeps offset-only log requests unbounded by default tail mode", async () => {
|
it("keeps offset-only log requests unbounded by default tail mode", async () => {
|
||||||
const lines = Array.from({ length: 260 }, (_value, index) => `line-${index + 1}`);
|
const lines = Array.from({ length: 220 }, (_value, index) => `line-${index + 1}`);
|
||||||
const sessionId = await runBackgroundEchoLines(lines);
|
const sessionId = await runBackgroundEchoLines(lines);
|
||||||
|
|
||||||
const log = await processTool.execute("call2", {
|
const log = await processTool.execute("call2", {
|
||||||
@@ -270,9 +270,9 @@ describe("exec tool backgrounding", () => {
|
|||||||
const textBlock = log.content.find((c) => c.type === "text")?.text ?? "";
|
const textBlock = log.content.find((c) => c.type === "text")?.text ?? "";
|
||||||
const renderedLines = textBlock.split("\n");
|
const renderedLines = textBlock.split("\n");
|
||||||
expect(renderedLines[0]?.trim()).toBe("line-31");
|
expect(renderedLines[0]?.trim()).toBe("line-31");
|
||||||
expect(renderedLines[renderedLines.length - 1]?.trim()).toBe("line-260");
|
expect(renderedLines[renderedLines.length - 1]?.trim()).toBe("line-220");
|
||||||
expect(textBlock).not.toContain("showing last 200");
|
expect(textBlock).not.toContain("showing last 200");
|
||||||
expect((log.details as { totalLines?: number }).totalLines).toBe(260);
|
expect((log.details as { totalLines?: number }).totalLines).toBe(220);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("scopes process sessions by scopeKey", async () => {
|
it("scopes process sessions by scopeKey", async () => {
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ import {
|
|||||||
import { createExecTool } from "./bash-tools.exec.js";
|
import { createExecTool } from "./bash-tools.exec.js";
|
||||||
import { killProcessTree } from "./shell-utils.js";
|
import { killProcessTree } from "./shell-utils.js";
|
||||||
|
|
||||||
const BACKGROUND_HOLD_CMD = 'node -e "setTimeout(() => {}, 500)"';
|
const BACKGROUND_HOLD_CMD = 'node -e "setTimeout(() => {}, 250)"';
|
||||||
const ABORT_SETTLE_MS = process.platform === "win32" ? 200 : 60;
|
const ABORT_SETTLE_MS = process.platform === "win32" ? 200 : 60;
|
||||||
const ABORT_WAIT_TIMEOUT_MS = process.platform === "win32" ? 1_500 : 450;
|
const ABORT_WAIT_TIMEOUT_MS = process.platform === "win32" ? 1_500 : 320;
|
||||||
const POLL_INTERVAL_MS = 15;
|
const POLL_INTERVAL_MS = 15;
|
||||||
const FINISHED_WAIT_TIMEOUT_MS = process.platform === "win32" ? 8_000 : 1_200;
|
const FINISHED_WAIT_TIMEOUT_MS = process.platform === "win32" ? 8_000 : 900;
|
||||||
const BACKGROUND_TIMEOUT_SEC = process.platform === "win32" ? 0.2 : 0.12;
|
const BACKGROUND_TIMEOUT_SEC = process.platform === "win32" ? 0.2 : 0.12;
|
||||||
const TEST_EXEC_DEFAULTS = {
|
const TEST_EXEC_DEFAULTS = {
|
||||||
security: "full" as const,
|
security: "full" as const,
|
||||||
|
|||||||
Reference in New Issue
Block a user