From 8480ef3f86a304a175f7e550a799041ed5921e89 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Fri, 19 Jun 2026 08:18:01 +0200 Subject: [PATCH] fix(e2e): cancel readiness probe bodies --- scripts/lib/openclaw-e2e-instance.sh | 4 +++- test/scripts/openclaw-e2e-instance.test.ts | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/lib/openclaw-e2e-instance.sh b/scripts/lib/openclaw-e2e-instance.sh index 71c3ad57c40c..8a5201b9271d 100644 --- a/scripts/lib/openclaw-e2e-instance.sh +++ b/scripts/lib/openclaw-e2e-instance.sh @@ -474,14 +474,16 @@ openclaw_e2e_probe_http() { const controller = new AbortController(); const timer = setTimeout(() => controller.abort(), timeoutMs); let exitCode = 1; + let response; try { - const response = await fetch(process.argv[1], { signal: controller.signal }); + response = await fetch(process.argv[1], { signal: controller.signal }); const passed = expected === "ok" ? response.ok : response.status === Number(expected); exitCode = passed ? 0 : 1; } catch { exitCode = 1; } finally { clearTimeout(timer); + await response?.body?.cancel?.().catch(() => undefined); } process.exit(exitCode); ' "$1" "${2:-ok}" "${3:-400}" diff --git a/test/scripts/openclaw-e2e-instance.test.ts b/test/scripts/openclaw-e2e-instance.test.ts index a4e26ad49f9e..5aa98d5ac46b 100644 --- a/test/scripts/openclaw-e2e-instance.test.ts +++ b/test/scripts/openclaw-e2e-instance.test.ts @@ -849,6 +849,12 @@ exit 1 } }); + it("cancels HTTP readiness probe response bodies", () => { + const helper = fs.readFileSync(helperPath, "utf8"); + + expect(helper).toContain("await response?.body?.cancel?.().catch(() => undefined);"); + }); + it("does not repeatedly grep the full gateway log while waiting for readiness", () => { const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-e2e-readyz-incremental-")); try {