fix(e2e): reject invalid bundled runtime limits

This commit is contained in:
Vincent Koc
2026-06-06 17:23:38 +02:00
parent d90a94ad16
commit 97758910fa
3 changed files with 46 additions and 58 deletions
@@ -341,14 +341,11 @@ describe("bundled plugin install/uninstall probe", () => {
});
it("rejects loose runtime output limit env values instead of parsing prefixes", async () => {
const runtimeSmoke = await importRuntimeSmokeWithEnv({
OPENCLAW_BUNDLED_PLUGIN_RUNTIME_OUTPUT_CHARS: "5chars",
});
expect(runtimeSmoke.appendBoundedOutput({ text: "", truncatedChars: 0 }, "abcdef")).toEqual({
text: "abcdef",
truncatedChars: 0,
});
await expect(
importRuntimeSmokeWithEnv({
OPENCLAW_BUNDLED_PLUGIN_RUNTIME_OUTPUT_CHARS: "5chars",
}),
).rejects.toThrow("invalid OPENCLAW_BUNDLED_PLUGIN_RUNTIME_OUTPUT_CHARS: 5chars");
});
it("keeps runtime log tail reads bounded", async () => {
@@ -366,18 +363,11 @@ describe("bundled plugin install/uninstall probe", () => {
});
it("rejects loose runtime log scan byte env values instead of parsing prefixes", async () => {
const runtimeSmoke = await importRuntimeSmokeWithEnv({
OPENCLAW_BUNDLED_PLUGIN_RUNTIME_LOG_SCAN_BYTES: "64bytes",
});
const root = makePackageRoot();
const logPath = path.join(root, "gateway.log");
fs.writeFileSync(logPath, `${"old log line\n".repeat(20)}[gateway] ready\n`, "utf8");
const tail = runtimeSmoke.readFileTail(logPath);
expect(Buffer.byteLength(tail)).toBeGreaterThan(64);
expect(tail).toContain("old log line");
expect(tail).toContain("[gateway] ready");
await expect(
importRuntimeSmokeWithEnv({
OPENCLAW_BUNDLED_PLUGIN_RUNTIME_LOG_SCAN_BYTES: "64bytes",
}),
).rejects.toThrow("invalid OPENCLAW_BUNDLED_PLUGIN_RUNTIME_LOG_SCAN_BYTES: 64bytes");
});
it("remembers runtime ready logs after they fall outside the tail", async () => {
+3 -2
View File
@@ -2239,8 +2239,9 @@ output="$(run_logged_print_heartbeat plugins-run 08 bash -c 'printf "captured co
expect(runner).toContain('tee "$RUN_LOG"');
expect(runner).not.toContain('cat "$RUN_LOG"');
expect(probe).toContain('"openclaw.plugin.json"');
expect(runtimeSmoke).toContain("process.env.OPENCLAW_BUNDLED_PLUGIN_RUNTIME_READY_MS");
expect(runtimeSmoke).toContain("900000");
expect(runtimeSmoke).toContain(
'readPositiveIntEnv("OPENCLAW_BUNDLED_PLUGIN_RUNTIME_READY_MS", 900000)',
);
expect(sweep).toContain("read -r plugin_id plugin_dir requires_config");
expect(sweep).toContain('node "$OPENCLAW_ENTRY" plugins install "$plugin_id"');
expect(sweep).toContain('node "$OPENCLAW_ENTRY" plugins uninstall "$plugin_id" --force');