fix(e2e): enable smoke-tested plugin channels

This commit is contained in:
Peter Steinberger
2026-06-01 08:38:50 +01:00
parent 3322212f14
commit bc470713bb
2 changed files with 34 additions and 2 deletions

View File

@@ -237,12 +237,22 @@ function ensureGatewayConfig(config, port) {
};
}
function activateSmokePlugin(config, pluginId) {
export function activateSmokePlugin(config, pluginId, channels = []) {
const allow = Array.isArray(config.plugins?.allow)
? Array.from(new Set([...config.plugins.allow, pluginId].filter(isNonEmptyString)))
: undefined;
const channelConfig = { ...(config.channels ?? {}) };
for (const channel of channels) {
channelConfig[channel] = {
...(typeof channelConfig[channel] === "object" && channelConfig[channel] !== null
? channelConfig[channel]
: {}),
enabled: true,
};
}
return {
...config,
...(channels.length > 0 ? { channels: channelConfig } : {}),
plugins: {
...config.plugins,
enabled: true,
@@ -645,7 +655,10 @@ async function smokePlugin(pluginId, pluginDir, requiresConfig, pluginIndex, plu
const plan = buildPluginPlan(manifest);
const port =
readPositiveInt(process.env.OPENCLAW_BUNDLED_PLUGIN_RUNTIME_PORT_BASE, 19000) + pluginIndex * 3;
const config = ensureGatewayConfig(activateSmokePlugin(readConfig(), pluginId), port);
const config = ensureGatewayConfig(
activateSmokePlugin(readConfig(), pluginId, plan.channels),
port,
);
if (plan.speechProviders[0]) {
const provider = plan.speechProviders[0];
config.messages = {

View File

@@ -205,6 +205,25 @@ describe("bundled plugin install/uninstall probe", () => {
);
});
it("activates channel config for channel plugin runtime smoke", async () => {
const runtimeSmoke = await import(pathToFileURL(runtimeSmokePath).href);
expect(
runtimeSmoke.activateSmokePlugin(
{ plugins: { allow: ["browser"] }, channels: { telegram: { dmPolicy: "open" } } },
"telegram",
["telegram"],
),
).toMatchObject({
channels: { telegram: { dmPolicy: "open", enabled: true } },
plugins: {
allow: ["browser", "telegram"],
enabled: true,
entries: { telegram: { enabled: true } },
},
});
});
it("rejects loose runtime output limit env values instead of parsing prefixes", async () => {
const runtimeSmoke = await importRuntimeSmokeWithEnv({
OPENCLAW_BUNDLED_PLUGIN_RUNTIME_OUTPUT_CHARS: "5chars",