mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 12:31:37 +00:00
Session/Cron: harden maintenance and expand docs
This commit is contained in:
committed by
Shakker
parent
29b19455e3
commit
e536dcde28
40
src/config/zod-schema.cron-retention.test.ts
Normal file
40
src/config/zod-schema.cron-retention.test.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { OpenClawSchema } from "./zod-schema.js";
|
||||
|
||||
describe("OpenClawSchema cron retention and run-log validation", () => {
|
||||
it("accepts valid cron.sessionRetention and runLog values", () => {
|
||||
expect(() =>
|
||||
OpenClawSchema.parse({
|
||||
cron: {
|
||||
sessionRetention: "1h30m",
|
||||
runLog: {
|
||||
maxBytes: "5mb",
|
||||
keepLines: 2500,
|
||||
},
|
||||
},
|
||||
}),
|
||||
).not.toThrow();
|
||||
});
|
||||
|
||||
it("rejects invalid cron.sessionRetention", () => {
|
||||
expect(() =>
|
||||
OpenClawSchema.parse({
|
||||
cron: {
|
||||
sessionRetention: "abc",
|
||||
},
|
||||
}),
|
||||
).toThrow(/sessionRetention|duration/i);
|
||||
});
|
||||
|
||||
it("rejects invalid cron.runLog.maxBytes", () => {
|
||||
expect(() =>
|
||||
OpenClawSchema.parse({
|
||||
cron: {
|
||||
runLog: {
|
||||
maxBytes: "wat",
|
||||
},
|
||||
},
|
||||
}),
|
||||
).toThrow(/runLog|maxBytes|size/i);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user