mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
fix(e2e): tighten kitchen sink plugin log allowlist
This commit is contained in:
@@ -109,7 +109,11 @@ function scanLogs() {
|
||||
/\blevel["']?\s*:\s*["']error["']/iu,
|
||||
/\[(?:error|ERROR)\]/u,
|
||||
];
|
||||
const allow = [/0 errors?/iu, /expected no diagnostics errors?/iu, /diagnostics errors?:\s*$/iu];
|
||||
const allow = [
|
||||
/^\s*0 errors?\s*$/iu,
|
||||
/^\s*expected no diagnostics errors?\s*$/iu,
|
||||
/^\s*diagnostics errors?:\s*$/iu,
|
||||
];
|
||||
const findings = [];
|
||||
let omittedFindings = false;
|
||||
for (const file of files) {
|
||||
|
||||
@@ -276,6 +276,28 @@ describe("kitchen-sink plugin assertions", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("does not allow dirty error lines just because they mention zero errors", () => {
|
||||
const parent = mkdtempSync(path.join(tmpdir(), "openclaw-kitchen-sink-scan-"));
|
||||
const home = path.join(parent, "home");
|
||||
const scratchRoot = path.join(parent, "scratch");
|
||||
try {
|
||||
mkdirSync(home, { recursive: true });
|
||||
mkdirSync(scratchRoot, { recursive: true });
|
||||
writeFileSync(
|
||||
path.join(scratchRoot, "dirty.log"),
|
||||
"[ERROR] 0 errors reported but fatal state remained\n",
|
||||
);
|
||||
|
||||
const result = runScanLogs({ home, scratchRoot });
|
||||
|
||||
expect(result.status).not.toBe(0);
|
||||
expect(`${result.stdout}\n${result.stderr}`).toContain("unexpected error-like log lines");
|
||||
expect(`${result.stdout}\n${result.stderr}`).toContain("fatal state remained");
|
||||
} finally {
|
||||
rmSync(parent, { force: true, recursive: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("bounds repeated kitchen-sink log scan findings", () => {
|
||||
const parent = mkdtempSync(path.join(tmpdir(), "openclaw-kitchen-sink-scan-"));
|
||||
const home = path.join(parent, "home");
|
||||
|
||||
Reference in New Issue
Block a user