





















@@ -322,6 +322,52 @@ describe("scripts/lib/openclaw-e2e-instance.sh", () => {
322322}
323323});
324324325+it("bounds HTTP readiness probes when a server accepts connections but never responds", () => {
326+const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-e2e-http-probe-"));
327+try {
328+const portPath = path.join(tempDir, "port.txt");
329+const serverPath = path.join(tempDir, "stalling-server.cjs");
330+fs.writeFileSync(
331+serverPath,
332+[
333+"const fs = require('node:fs');",
334+"const net = require('node:net');",
335+"const server = net.createServer((socket) => socket.on('data', () => {}));",
336+"server.listen(0, '127.0.0.1', () => {",
337+" fs.writeFileSync(process.argv[2], String(server.address().port));",
338+"});",
339+"process.on('SIGTERM', () => server.close(() => process.exit(0)));",
340+"",
341+].join("\n"),
342+);
343+344+const startedAt = Date.now();
345+const result = spawnSync(
346+"/bin/bash",
347+[
348+"-c",
349+[
350+"set -euo pipefail",
351+`${shellQuote(process.execPath)} ${shellQuote(serverPath)} ${shellQuote(portPath)} & server_pid=$!`,
352+'trap \'kill "$server_pid" 2>/dev/null || true; wait "$server_pid" 2>/dev/null || true\' EXIT',
353+`for _ in $(seq 1 50); do [ -s ${shellQuote(portPath)} ] && break; sleep 0.02; done`,
354+`port="$(cat ${shellQuote(portPath)})"`,
355+`source ${shellQuote(helperPath)}`,
356+'openclaw_e2e_probe_http_status "http://127.0.0.1:${port}/health" 200 100',
357+].join("; "),
358+],
359+{ encoding: "utf8", timeout: 3_000 },
360+);
361+const elapsedMs = Date.now() - startedAt;
362+363+expect(result.error).toBeUndefined();
364+expect(result.status).not.toBe(0);
365+expect(elapsedMs).toBeLessThan(2_500);
366+} finally {
367+fs.rmSync(tempDir, { force: true, recursive: true });
368+}
369+});
370+325371it("wraps logged OpenClaw E2E commands with the configured timeout", () => {
326372const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-e2e-instance-run-logged-"));
327373const logLabel = path.basename(tempDir);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。