






















@@ -228,18 +228,48 @@ async function waitForReady(params) {
228228} catch (error) {
229229lastError = error instanceof Error ? error.message : String(error);
230230}
231+if (logShowsGatewayReady(params.logPath) && (await httpOk(params.port, "/healthz"))) {
232+return;
233+}
231234await delay(250);
232235}
233236throw new Error(`gateway did not become ready: ${lastError}\n${tailFile(params.logPath)}`);
234237}
235238239+function logShowsGatewayReady(logPath) {
240+const log = fs.existsSync(logPath) ? fs.readFileSync(logPath, "utf8") : "";
241+return log.includes("[gateway] ready");
242+}
243+244+async function httpOk(port, pathName) {
245+try {
246+const res = await fetch(`http://127.0.0.1:${port}${pathName}`);
247+return res.ok;
248+} catch {
249+return false;
250+}
251+}
252+236253async function assertHttpOk(port, pathName) {
237254const res = await fetch(`http://127.0.0.1:${port}${pathName}`);
238255if (!res.ok) {
239256throw new Error(`${pathName} returned HTTP ${res.status}`);
240257}
241258}
242259260+async function assertReadyzProbe(options) {
261+const res = await fetch(`http://127.0.0.1:${options.port}/readyz`);
262+if (res.ok) {
263+return;
264+}
265+if (!options.allowDegradedReadyz) {
266+throw new Error(`/readyz returned HTTP ${res.status}`);
267+}
268+console.log(
269+`Runtime readyz smoke degraded for ${options.pluginId}: /readyz returned HTTP ${res.status}`,
270+);
271+}
272+243273async function rpcCall(method, params, options) {
244274const args = [
245275options.entrypoint,
@@ -351,7 +381,13 @@ async function smokePlugin(pluginId, pluginDir, requiresConfig, pluginIndex) {
351381});
352382try {
353383await waitForReady({ child, port, logPath });
354-await assertBaseGatewayProbes({ entrypoint, port, env: process.env });
384+await assertBaseGatewayProbes({
385+ entrypoint,
386+ port,
387+env: process.env,
388+ pluginId,
389+allowDegradedReadyz: plan.channels.length > 0,
390+});
355391await runManifestProbes(plan, { entrypoint, port, env: process.env, pluginId });
356392await runWatchdog({ child, logPath, port, entrypoint, env: process.env, pluginId });
357393console.log(`Runtime smoke passed for ${pluginId}`);
@@ -365,7 +401,7 @@ async function smokePlugin(pluginId, pluginDir, requiresConfig, pluginIndex) {
365401366402async function assertBaseGatewayProbes(options) {
367403await assertHttpOk(options.port, "/healthz");
368-await assertHttpOk(options.port, "/readyz");
404+await assertReadyzProbe(options);
369405await rpcCall("health", {}, options);
370406}
371407此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。