


























@@ -181,6 +181,27 @@ describe("scripts/lib/openclaw-e2e-instance.sh", () => {
181181expect(duration.stderr).toContain("invalid OPENCLAW_E2E_SAMPLE_SECONDS: 30s");
182182});
183183184+it("reads non-negative integer env values without accepting shell-style sizes", () => {
185+const fallback = runSourcedHelper(
186+'printf "%s" "$(openclaw_e2e_read_nonnegative_int_env OPENCLAW_E2E_SAMPLE_BYTES 262144)"',
187+);
188+const zero = runSourcedHelper(
189+'printf "%s" "$(openclaw_e2e_read_nonnegative_int_env OPENCLAW_E2E_SAMPLE_BYTES 262144)"',
190+{ OPENCLAW_E2E_SAMPLE_BYTES: "0" },
191+);
192+const size = runSourcedHelper(
193+"openclaw_e2e_read_nonnegative_int_env OPENCLAW_E2E_SAMPLE_BYTES 262144",
194+{ OPENCLAW_E2E_SAMPLE_BYTES: "64kb" },
195+);
196+197+expectShellSuccess(fallback);
198+expect(fallback.stdout).toBe("262144");
199+expectShellSuccess(zero);
200+expect(zero.stdout).toBe("0");
201+expect(size.status).toBe(2);
202+expect(size.stderr).toContain("invalid OPENCLAW_E2E_SAMPLE_BYTES: 64kb");
203+});
204+184205it("requires /readyz after the gateway ready log", () => {
185206const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-e2e-readyz-required-"));
186207try {
@@ -525,6 +546,27 @@ describe("scripts/lib/openclaw-e2e-instance.sh", () => {
525546}
526547});
527548549+it.each([
550+["bytes", "OPENCLAW_E2E_LOG_TAIL_BYTES", "64kb"],
551+["lines", "OPENCLAW_E2E_LOG_TAIL_LINES", "25 lines"],
552+])("rejects invalid E2E log tail %s before invoking tail", (_label, envName, value) => {
553+const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-e2e-instance-log-tail-"));
554+try {
555+const logPath = path.join(tempDir, "install.log");
556+fs.writeFileSync(logPath, "old log\nrecent log\n", "utf8");
557+558+const result = runSourcedHelper(`openclaw_e2e_print_log ${shellQuote(logPath)}`, {
559+[envName]: value,
560+});
561+562+expect(result.status).toBe(2);
563+expect(result.stderr).toContain(`invalid ${envName}: ${value}`);
564+expect(result.stdout).not.toContain("old log");
565+} finally {
566+fs.rmSync(tempDir, { force: true, recursive: true });
567+}
568+});
569+528570it("bounds commands with the Node watchdog when timeout is unavailable", () => {
529571const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-e2e-instance-node-watchdog-"));
530572try {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。