mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-07 18:42:25 +00:00
fix(e2e): enable smoke-tested plugin channels
This commit is contained in:
@@ -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 = {
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user