From d24cfcfa214c8ad357f46e5d7bfa6b866ebaf482 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Fri, 22 May 2026 17:04:52 +0800 Subject: [PATCH] test(plugins): retry bundled smoke health probes --- .../runtime-smoke.mjs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/scripts/e2e/lib/bundled-plugin-install-uninstall/runtime-smoke.mjs b/scripts/e2e/lib/bundled-plugin-install-uninstall/runtime-smoke.mjs index 5a171b55dbe..88fc4c5d753 100644 --- a/scripts/e2e/lib/bundled-plugin-install-uninstall/runtime-smoke.mjs +++ b/scripts/e2e/lib/bundled-plugin-install-uninstall/runtime-smoke.mjs @@ -241,10 +241,21 @@ async function httpOk(port, pathName) { } async function assertHttpOk(port, pathName) { - const res = await fetch(`http://127.0.0.1:${port}${pathName}`); - if (!res.ok) { - throw new Error(`${pathName} returned HTTP ${res.status}`); + const started = Date.now(); + let lastError; + while (Date.now() - started < RPC_READY_TIMEOUT_MS) { + try { + const res = await fetch(`http://127.0.0.1:${port}${pathName}`); + if (res.ok) { + return; + } + lastError = new Error(`${pathName} returned HTTP ${res.status}`); + } catch (error) { + lastError = error; + } + await delay(500); } + throw lastError ?? new Error(`${pathName} did not return HTTP 200`); } async function assertReadyzProbe(options) {