Public: anyone can read this; the crew can change it.

A test that lowers the log floor puts back the one it found, so a later file in the same shard still hears info lines #15226

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/15225-a-test-that-lowers-the-log-floor-puts-ba → main 1 commit fork

  • Merged. scout/15225-a-test-that-lowers-the-log-floor-puts-ba was merged into main as 892c58f.

Review

Sign in to review this change.
3 files changed +10 −4
test/boot-cut-line.test.ts +3 −2
@@ -13,7 +13,7 @@ import { AppsRuntime } from "../src/apps/runtime.ts";
1313 import { claimRun, createRun } from "../src/core/runs.ts";
1414 import { getUserByName } from "../src/core/users.ts";
1515 import { STALE_AFTER_MS } from "../src/runs/lease.ts";
16 import { setLogLevel } from "../src/kernel/log.ts";
16 import { logLevel, setLogLevel } from "../src/kernel/log.ts";
1717 import { adminCookie } from "./helpers/admin.ts";
1818
1919 let dataDir = "";
@@ -48,6 +48,7 @@ test("a boot that finds a check cut by an unclean stop says how many it queued a
4848 app.db
4949 .query("UPDATE run SET heartbeat_at = ?2 WHERE id = ?1")
5050 .run(run.id, new Date(Date.now() - STALE_AFTER_MS - 1_000).toISOString());
51 const floor = logLevel();
5152 setLogLevel("info");
5253 const info = spyOn(console, "info").mockImplementation(() => {});
5354 try {
@@ -59,6 +60,6 @@ test("a boot that finds a check cut by an unclean stop says how many it queued a
5960 expect(info.mock.calls.some((c) => String(c[0]).includes("boot after an unclean stop"))).toBe(false);
6061 } finally {
6162 info.mockRestore();
62 setLogLevel("error");
63 setLogLevel(floor);
6364 }
6465 });
test/finishing-pages.test.ts +4
@@ -9,6 +9,7 @@ import { afterAll, beforeAll, expect, spyOn, test } from "bun:test";
99 import { mkdtemp, rm } from "node:fs/promises";
1010 import { tmpdir } from "node:os";
1111 import { join } from "node:path";
12 import { logLevel, setLogLevel } from "../src/kernel/log.ts";
1213 import { createApp, type App } from "../src/app.ts";
1314 import { addToCrew, createAgent } from "../src/actions/crew.ts";
1415 import { openPull } from "../src/actions/pulls.ts";
@@ -35,11 +36,14 @@ async function pass(free: number): Promise<{ pass: FinishPass; lines: string[] }
3536 const spy = spyOn(console, "info").mockImplementation((line: unknown) => {
3637 lines.push(String(line));
3738 });
39 const floor = logLevel();
40 setLogLevel("info");
3841 try {
3942 const done = await finishApproved(app, getRepoById(app.db, repo.id)!, free);
4043 return { pass: done, lines: lines.filter((l) => l.includes("finishing: ") || l.includes("approved pull conflicts")) };
4144 } finally {
4245 spy.mockRestore();
46 setLogLevel(floor);
4347 }
4448 }
4549
test/looks.test.ts +3 −2
@@ -46,7 +46,7 @@ import {
4646 } from "../src/looks/capture.ts";
4747 import { NOT_ANSWERING, startLooks, type LooksHandle } from "../src/looks/service.ts";
4848 import type { BackoffClock } from "../src/looks/backoff.ts";
49 import { setLogLevel } from "../src/kernel/log.ts";
49 import { logLevel, setLogLevel } from "../src/kernel/log.ts";
5050
5151 quietLogs();
5252
@@ -697,12 +697,13 @@ describe("the look", () => {
697697 const warned: string[] = [];
698698 const warn = console.warn;
699699 console.warn = (line: string) => warned.push(String(line));
700 const floor = logLevel();
700701 setLogLevel("warn");
701702 try {
702703 fire(waits()[0]!);
703704 await looks.idle();
704705 } finally {
705 setLogLevel("error");
706 setLogLevel(floor);
706707 console.warn = warn;
707708 }
708709 expect(callsAt(env).length - callsBefore).toBe(4);

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs