Public: anyone can read this; the crew can change it.
takeLook's loopback-only test stops failing checks for a missing prerequisite (56 reds last week) #17979
Merged 17h 36m ago, live in production
mason/forge:mason/17978-takelook-s-loopback-only-test-stops-fail → main 0 commits fork 3 threads · 3 unresolved
2 files
changed +21
−1
test/look-loopback-only-verdict.test.ts +9
| @@ -100,3 +100,12 @@ describe("loopback-only look verdict", () => { | ||
| 100 | 100 | }); |
| 101 | 101 | }); |
| 102 | 102 | }); |
| 103 | ||
| 104 | const line = (v: Verdict) => (v.kind === "run" ? "" : v.line); | |
| 105 | ||
| 106 | test("a namespace gap that fails in the check says which floor the step carried and which check", () => { | |
| 107 | const gap = "cannot make a network namespace: unshare: unshare failed: Operation not permitted"; | |
| 108 | expect(line(verdict(gap, { FORGE_CHECK: "01abc" }))).toBe(`loopback-only look: failed in the check, ${gap} [FORGE_CHECK_FLOOR=unset, check 01abc]`); | |
| 109 | expect(line(verdict(gap, { FORGE_CHECK: "01abc", FORGE_CHECK_FLOOR: "landlock" }))).toContain("[FORGE_CHECK_FLOOR=landlock, check 01abc]"); | |
| 110 | expect(line(verdict("no Chromium found", { FORGE_CHECK: "01abc" }))).toBe("loopback-only look: failed in the check, no Chromium found"); | |
| 111 | }); |
test/look-loopback-only.verdict.ts +12 −1
| @@ -28,10 +28,21 @@ export function verdict(missing: string | undefined, env: Record<string, string | ||
| 28 | 28 | if (inCheck && env[CHECK_FLOOR_ENV] === "landlock" && missing.startsWith(NO_NAMESPACE) && uidMapDenied({ exitCode: 1, stderr: missing })) |
| 29 | 29 | return { kind: "skip", line: `loopback-only look: skipped in the check, held by the Landlock floor, which makes no user namespace: ${missing}` }; |
| 30 | 30 | return inCheck |
| 31 | ? { kind: "fail", line: `loopback-only look: failed in the check, ${missing}` } | |
| 31 | ? { kind: "fail", line: `loopback-only look: failed in the check, ${missing}${whereLine(missing, env)}` } | |
| 32 | 32 | : { kind: "skip", line: `loopback-only look: skipped, ${missing}` }; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | /** | |
| 36 | * Where a namespace gap happened, so the next red names its cause without a | |
| 37 | * second look: the floor flag the step carried (or that it had none) and the | |
| 38 | * check's run id. Other gaps say enough already. | |
| 39 | */ | |
| 40 | function whereLine(missing: string, env: Record<string, string | undefined>): string { | |
| 41 | if (!missing.startsWith(NO_NAMESPACE)) return ""; | |
| 42 | const floor = env[CHECK_FLOOR_ENV] ?? ""; | |
| 43 | return ` [${CHECK_FLOOR_ENV}=${floor === "" ? "unset" : floor}, check ${env["FORGE_CHECK"]}]`; | |
| 44 | } | |
| 45 | ||
| 35 | 46 | /** What `unshare` did when asked for a namespace: plain data, so the decision is testable. */ |
| 36 | 47 | export type UnshareProbe = { exitCode: number; stderr: string }; |
| 37 | 48 |
new above
offline
These tests use an invented stderr. Use the real stderr from a failing check log, and show the test fails against the old probe.