惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
人人都是产品经理
人人都是产品经理
月光博客
月光博客
V
V2EX
WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
Last Week in AI
Last Week in AI
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
V
Visual Studio Blog
宝玉的分享
宝玉的分享
雷峰网
雷峰网
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
博客园 - 聂微东
博客园 - 司徒正美
博客园 - 【当耐特】
爱范儿
爱范儿
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(e2e): reject loose helper env limits · openclaw/openc...
vincentkoc · 2026-05-29 · via Recent Commits to openclaw:main

@@ -0,0 +1,101 @@

1+

import { spawn, spawnSync } from "node:child_process";

2+

import { createServer, type Server } from "node:http";

3+

import { describe, expect, it } from "vitest";

4+5+

const browserFixturePath = "scripts/e2e/lib/browser-cdp-snapshot/fixture-server.mjs";

6+

const clickclackFixturePath = "scripts/e2e/lib/release-user-journey/clickclack-fixture.mjs";

7+

const httpProbePath = "scripts/e2e/lib/openwebui/http-probe.mjs";

8+9+

function runScript(scriptPath: string, args: string[] = [], env: Record<string, string> = {}) {

10+

return spawnSync(process.execPath, [scriptPath, ...args], {

11+

encoding: "utf8",

12+

env: { ...process.env, ...env },

13+

});

14+

}

15+16+

function runScriptAsync(

17+

scriptPath: string,

18+

args: string[] = [],

19+

env: Record<string, string> = {},

20+

timeout = 3_000,

21+

) {

22+

return new Promise<{ stderr: string; stdout: string; status: number | null }>((resolve) => {

23+

const child = spawn(process.execPath, [scriptPath, ...args], {

24+

env: { ...process.env, ...env },

25+

stdio: ["ignore", "pipe", "pipe"],

26+

});

27+

let stdout = "";

28+

let stderr = "";

29+

child.stdout.setEncoding("utf8");

30+

child.stderr.setEncoding("utf8");

31+

child.stdout.on("data", (chunk) => {

32+

stdout += chunk;

33+

});

34+

child.stderr.on("data", (chunk) => {

35+

stderr += chunk;

36+

});

37+

const timer = setTimeout(() => child.kill("SIGKILL"), timeout);

38+

child.on("exit", (status) => {

39+

clearTimeout(timer);

40+

resolve({ stderr, stdout, status });

41+

});

42+

});

43+

}

44+45+

async function listen(server: Server): Promise<string> {

46+

await new Promise<void>((resolve, reject) => {

47+

server.once("error", reject);

48+

server.listen(0, "127.0.0.1", () => {

49+

server.off("error", reject);

50+

resolve();

51+

});

52+

});

53+

const address = server.address();

54+

if (!address || typeof address === "string") {

55+

throw new Error("test server did not expose a TCP port");

56+

}

57+

return `http://127.0.0.1:${address.port}`;

58+

}

59+60+

describe("e2e helper numeric env limits", () => {

61+

it("rejects loose Browser CDP fixture ports", async () => {

62+

const result = await runScriptAsync(browserFixturePath, [], { FIXTURE_PORT: "18080http" });

63+64+

expect(result.status).not.toBe(0);

65+

expect(result.stderr).toContain("invalid FIXTURE_PORT: 18080http");

66+

});

67+68+

it("rejects loose release ClickClack fixture ports", () => {

69+

const result = runScript(clickclackFixturePath, [], {

70+

CLICKCLACK_FIXTURE_PORT: "44181tcp",

71+

});

72+73+

expect(result.status).not.toBe(0);

74+

expect(result.stderr).toContain("invalid CLICKCLACK_FIXTURE_PORT: 44181tcp");

75+

});

76+77+

it("rejects loose Open WebUI HTTP probe timeouts", () => {

78+

const result = runScript(httpProbePath, ["http://127.0.0.1:9"], {

79+

OPENCLAW_HTTP_PROBE_TIMEOUT_MS: "8000ms",

80+

});

81+82+

expect(result.status).not.toBe(0);

83+

expect(result.stderr).toContain("invalid OPENCLAW_HTTP_PROBE_TIMEOUT_MS: 8000ms");

84+

});

85+86+

it("keeps Open WebUI HTTP probe status checks working with strict timeouts", async () => {

87+

const server = createServer((_request, response) => {

88+

response.writeHead(204).end();

89+

});

90+

const url = await listen(server);

91+

try {

92+

const result = await runScriptAsync(httpProbePath, [url, "204"], {

93+

OPENCLAW_HTTP_PROBE_TIMEOUT_MS: "500",

94+

});

95+96+

expect(result.status).toBe(0);

97+

} finally {

98+

server.close();

99+

}

100+

});

101+

});