Skip to content

Commit d24cfcf

Browse files
committed
test(plugins): retry bundled smoke health probes
1 parent 2b1c01f commit d24cfcf

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

‎scripts/e2e/lib/bundled-plugin-install-uninstall/runtime-smoke.mjs‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,21 @@ async function httpOk(port, pathName) {
241241
}
242242

243243
async function assertHttpOk(port, pathName) {
244-
const res = await fetch(`http://127.0.0.1:${port}${pathName}`);
245-
if (!res.ok) {
246-
throw new Error(`${pathName} returned HTTP ${res.status}`);
244+
const started = Date.now();
245+
let lastError;
246+
while (Date.now() - started < RPC_READY_TIMEOUT_MS) {
247+
try {
248+
const res = await fetch(`http://127.0.0.1:${port}${pathName}`);
249+
if (res.ok) {
250+
return;
251+
}
252+
lastError = new Error(`${pathName} returned HTTP ${res.status}`);
253+
} catch (error) {
254+
lastError = error;
255+
}
256+
await delay(500);
247257
}
258+
throw lastError ?? new Error(`${pathName} did not return HTTP 200`);
248259
}
249260

250261
async function assertReadyzProbe(options) {

0 commit comments

Comments
 (0)