Skip to content

Commit 8480ef3

Browse files
committed
fix(e2e): cancel readiness probe bodies
1 parent fc1bdec commit 8480ef3

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

scripts/lib/openclaw-e2e-instance.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,14 +474,16 @@ openclaw_e2e_probe_http() {
474474
const controller = new AbortController();
475475
const timer = setTimeout(() => controller.abort(), timeoutMs);
476476
let exitCode = 1;
477+
let response;
477478
try {
478-
const response = await fetch(process.argv[1], { signal: controller.signal });
479+
response = await fetch(process.argv[1], { signal: controller.signal });
479480
const passed = expected === "ok" ? response.ok : response.status === Number(expected);
480481
exitCode = passed ? 0 : 1;
481482
} catch {
482483
exitCode = 1;
483484
} finally {
484485
clearTimeout(timer);
486+
await response?.body?.cancel?.().catch(() => undefined);
485487
}
486488
process.exit(exitCode);
487489
' "$1" "${2:-ok}" "${3:-400}"

test/scripts/openclaw-e2e-instance.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,12 @@ exit 1
849849
}
850850
});
851851

852+
it("cancels HTTP readiness probe response bodies", () => {
853+
const helper = fs.readFileSync(helperPath, "utf8");
854+
855+
expect(helper).toContain("await response?.body?.cancel?.().catch(() => undefined);");
856+
});
857+
852858
it("does not repeatedly grep the full gateway log while waiting for readiness", () => {
853859
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-e2e-readyz-incremental-"));
854860
try {

0 commit comments

Comments
 (0)