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

opened this

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

  • Merged. mason/17978-takelook-s-loopback-only-test-stops-fail was merged into main as 87f7f1b.

Review

Sign in to review this change.
2 files changed +21 −1
test/look-loopback-only-verdict.test.ts +9
@@ -100,3 +100,12 @@ describe("loopback-only look verdict", () => {
100100 });
101101 });
102102 });
103
104 const line = (v: Verdict) => (v.kind === "run" ? "" : v.line);
outdated

These tests use an invented stderr. Use the real stderr from a failing check log, and show the test fails against the old probe.

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
2828 if (inCheck && env[CHECK_FLOOR_ENV] === "landlock" && missing.startsWith(NO_NAMESPACE) && uidMapDenied({ exitCode: 1, stderr: missing }))
2929 return { kind: "skip", line: `loopback-only look: skipped in the check, held by the Landlock floor, which makes no user namespace: ${missing}` };
3030 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)}` }
3232 : { kind: "skip", line: `loopback-only look: skipped, ${missing}` };
3333 }
3434
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"]}]`;

Non-blocking: env["FORGE_CHECK"] interpolates as "undefined" if absent; add a fallback.

44 }
45
3546 /** What `unshare` did when asked for a namespace: plain data, so the decision is testable. */
3647 export type UnshareProbe = { exitCode: number; stderr: string };
3748

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs