|
|
@@ -6,6 +6,8 @@ |
| 6 | 6 |
|
| 7 | 7 |
import { beforeEach, describe, expect, test } from "bun:test"; |
| 8 | 8 |
import type { Database } from "bun:sqlite"; |
| 9 |
import { Glob } from "bun"; |
| 10 |
import { readFileSync } from "node:fs"; |
| 9 | 11 |
import { tmpdir } from "node:os"; |
| 10 | 12 |
import { migrations } from "../src/core/schema.ts"; |
| 11 | 13 |
import { openDb } from "../src/kernel/db.ts"; |
|
|
@@ -13,6 +15,7 @@ import { claimRun, createRun, finishRun, type Run } from "../src/core/runs.ts"; |
| 13 | 15 |
import { |
| 14 | 16 |
SHARED_PULLS, |
| 15 | 17 |
SHARED_WINDOW_MS, |
| 18 |
TREE_GATES, |
| 16 | 19 |
flakeHref, |
| 17 | 20 |
flakeKey, |
| 18 | 21 |
sharedCause, |
|
|
@@ -62,6 +65,21 @@ describe("a red many pulls share", () => { |
| 62 | 65 |
expect(sharedTests(db)).toEqual([]); |
| 63 | 66 |
}); |
| 64 | 67 |
|
| 68 |
test("a gate on the tree is each pull's own red, however many trip it (#2868)", () => { |
| 69 |
const gate = "design check: nothing added outside the system (#2678) > the tree is no worse than its baseline"; |
| 70 |
for (const i of ["i1", "i2", "i3"]) red(i, [gate]); |
| 71 |
expect(shared(red("i4", [gate]))).toBe(false); |
| 72 |
expect(shared(red("i5", [gate, "X"]))).toBe(false); |
| 73 |
expect(sharedTests(db)).toEqual([]); |
| 74 |
}); |
| 75 |
|
| 76 |
test("every tree gate names a suite that exists", () => { |
| 77 |
const suites = new Set<string>(); |
| 78 |
for (const f of new Glob("test/*.test.ts").scanSync(".")) |
| 79 |
for (const m of readFileSync(f, "utf8").matchAll(/describe\("((?:[^"\\]|\\.)*)"/g)) suites.add(`${m[1]} > `); |
| 80 |
for (const g of TREE_GATES) expect(suites.has(g)).toBe(true); |
| 81 |
}); |
| 82 |
|
| 65 | 83 |
test("one pull red three times is its own red, not the lane's", () => { |
| 66 | 84 |
red("i1", ["X"]); |
| 67 | 85 |
red("i1", ["X"]); |