























@@ -284,6 +284,28 @@ export function activateSmokePlugin(config, pluginId, channels = []) {
284284};
285285}
286286287+function channelActivationEnvName(channel) {
288+return `${channel
289+ .replace(/[^a-z0-9]+/giu, "_")
290+ .replace(/^_+|_+$/gu, "")
291+ .toUpperCase()}_RUNTIME_SMOKE`;
292+}
293+294+export function withManifestChannelActivationEnv(env, channels = []) {
295+const nextEnv = { ...env };
296+for (const channel of channels) {
297+if (!isNonEmptyString(channel)) {
298+continue;
299+}
300+const key = channelActivationEnvName(channel);
301+if (key === "_RUNTIME_SMOKE") {
302+continue;
303+}
304+nextEnv[key] ??= "1";
305+}
306+return nextEnv;
307+}
308+287309function buildPluginPlan(manifest) {
288310const contracts =
289311manifest.contracts && typeof manifest.contracts === "object" ? manifest.contracts : {};
@@ -809,6 +831,7 @@ async function smokePlugin(pluginId, pluginDir, requiresConfig, pluginIndex, plu
809831activateSmokePlugin(readConfig(), pluginId, plan.channels),
810832port,
811833);
834+const env = withManifestChannelActivationEnv(process.env, plan.channels);
812835if (plan.speechProviders[0]) {
813836const provider = plan.speechProviders[0];
814837config.messages = {
@@ -832,20 +855,20 @@ async function smokePlugin(pluginId, pluginDir, requiresConfig, pluginIndex, plu
832855 entrypoint,
833856 port,
834857 logPath,
835-env: process.env,
858+ env,
836859skipChannels: plan.channels.length === 0,
837860});
838861try {
839862await waitForReady({ child, port, logPath });
840863await assertBaseGatewayProbes({
841864 entrypoint,
842865 port,
843-env: process.env,
866+ env,
844867 pluginId,
845868allowDegradedReadyz: plan.channels.length > 0,
846869});
847-await runManifestProbes(plan, { entrypoint, port, env: process.env, pluginId });
848-await runWatchdog({ child, logPath, port, entrypoint, env: process.env, pluginId });
870+await runManifestProbes(plan, { entrypoint, port, env, pluginId });
871+await runWatchdog({ child, logPath, port, entrypoint, env, pluginId });
849872console.log(`Runtime smoke passed for ${pluginId}`);
850873} catch (error) {
851874console.error(tailFile(logPath));
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。