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
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/15225-a-test-that-lowers-the-log-floor-puts-ba → main 1 commit fork
3 files
changed +10
−4
test/boot-cut-line.test.ts +3 −2
| @@ -13,7 +13,7 @@ import { AppsRuntime } from "../src/apps/runtime.ts"; | ||
| 13 | 13 | import { claimRun, createRun } from "../src/core/runs.ts"; |
| 14 | 14 | import { getUserByName } from "../src/core/users.ts"; |
| 15 | 15 | 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"; | |
| 17 | 17 | import { adminCookie } from "./helpers/admin.ts"; |
| 18 | 18 | |
| 19 | 19 | let dataDir = ""; |
| @@ -48,6 +48,7 @@ test("a boot that finds a check cut by an unclean stop says how many it queued a | ||
| 48 | 48 | app.db |
| 49 | 49 | .query("UPDATE run SET heartbeat_at = ?2 WHERE id = ?1") |
| 50 | 50 | .run(run.id, new Date(Date.now() - STALE_AFTER_MS - 1_000).toISOString()); |
| 51 | const floor = logLevel(); | |
| 51 | 52 | setLogLevel("info"); |
| 52 | 53 | const info = spyOn(console, "info").mockImplementation(() => {}); |
| 53 | 54 | try { |
| @@ -59,6 +60,6 @@ test("a boot that finds a check cut by an unclean stop says how many it queued a | ||
| 59 | 60 | expect(info.mock.calls.some((c) => String(c[0]).includes("boot after an unclean stop"))).toBe(false); |
| 60 | 61 | } finally { |
| 61 | 62 | info.mockRestore(); |
| 62 | setLogLevel("error"); | |
| 63 | setLogLevel(floor); | |
| 63 | 64 | } |
| 64 | 65 | }); |
test/finishing-pages.test.ts +4
| @@ -9,6 +9,7 @@ import { afterAll, beforeAll, expect, spyOn, test } from "bun:test"; | ||
| 9 | 9 | import { mkdtemp, rm } from "node:fs/promises"; |
| 10 | 10 | import { tmpdir } from "node:os"; |
| 11 | 11 | import { join } from "node:path"; |
| 12 | import { logLevel, setLogLevel } from "../src/kernel/log.ts"; | |
| 12 | 13 | import { createApp, type App } from "../src/app.ts"; |
| 13 | 14 | import { addToCrew, createAgent } from "../src/actions/crew.ts"; |
| 14 | 15 | import { openPull } from "../src/actions/pulls.ts"; |
| @@ -35,11 +36,14 @@ async function pass(free: number): Promise<{ pass: FinishPass; lines: string[] } | ||
| 35 | 36 | const spy = spyOn(console, "info").mockImplementation((line: unknown) => { |
| 36 | 37 | lines.push(String(line)); |
| 37 | 38 | }); |
| 39 | const floor = logLevel(); | |
| 40 | setLogLevel("info"); | |
| 38 | 41 | try { |
| 39 | 42 | const done = await finishApproved(app, getRepoById(app.db, repo.id)!, free); |
| 40 | 43 | return { pass: done, lines: lines.filter((l) => l.includes("finishing: ") || l.includes("approved pull conflicts")) }; |
| 41 | 44 | } finally { |
| 42 | 45 | spy.mockRestore(); |
| 46 | setLogLevel(floor); | |
| 43 | 47 | } |
| 44 | 48 | } |
| 45 | 49 |
test/looks.test.ts +3 −2
| @@ -46,7 +46,7 @@ import { | ||
| 46 | 46 | } from "../src/looks/capture.ts"; |
| 47 | 47 | import { NOT_ANSWERING, startLooks, type LooksHandle } from "../src/looks/service.ts"; |
| 48 | 48 | 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"; | |
| 50 | 50 | |
| 51 | 51 | quietLogs(); |
| 52 | 52 | |
| @@ -697,12 +697,13 @@ describe("the look", () => { | ||
| 697 | 697 | const warned: string[] = []; |
| 698 | 698 | const warn = console.warn; |
| 699 | 699 | console.warn = (line: string) => warned.push(String(line)); |
| 700 | const floor = logLevel(); | |
| 700 | 701 | setLogLevel("warn"); |
| 701 | 702 | try { |
| 702 | 703 | fire(waits()[0]!); |
| 703 | 704 | await looks.idle(); |
| 704 | 705 | } finally { |
| 705 | setLogLevel("error"); | |
| 706 | setLogLevel(floor); | |
| 706 | 707 | console.warn = warn; |
| 707 | 708 | } |
| 708 | 709 | expect(callsAt(env).length - callsBefore).toBe(4); |
new above
offline