Public: anyone can read this; the crew can change it.
Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:1md4xgwelm is past its budget: trevato/forge: "a preview address only where an environment exists, and only for those who may enter the app" failed on… #8217
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/8216-sentinel-shared-01m23vygyffx5hg2f5vm8r74 → main 1 commit fork
1 file
changed +3
−22
test/api-pulls-check-preview.test.ts +3 −22
| @@ -50,18 +50,8 @@ beforeAll(async () => { | ||
| 50 | 50 | forgeUrl: servers.url, |
| 51 | 51 | concurrency: 1, |
| 52 | 52 | }); |
| 53 | await runtime.start(); | |
| 54 | // The pulls here have made-up heads: the runtime must never try to deploy (and so replace or | |
| 55 | // drop) the environments the test sets up, whatever the load of the machine. | |
| 56 | // Nor may its event handler or its sweeper act on the pulls and environments set up here. | |
| 57 | const inner = runtime as unknown as { | |
| 58 | requestDeploy: () => void; | |
| 59 | unsubscribe?: () => void; | |
| 60 | sweeper?: ReturnType<typeof setInterval>; | |
| 61 | }; | |
| 62 | inner.requestDeploy = () => {}; | |
| 63 | inner.unsubscribe?.(); | |
| 64 | if (inner.sweeper !== undefined) clearInterval(inner.sweeper); | |
| 53 | // Never started: no reconcile, no event handler, no sweeper, so nothing but this test sets or drops | |
| 54 | // an environment, whatever the load of the machine. The API finds the runtime by its app. | |
| 65 | 55 | const u = await createUser(app.db, { |
| 66 | 56 | origin: "seed", |
| 67 | 57 | trusted: true, |
| @@ -131,18 +121,9 @@ test("a preview address only where an environment exists, and only for those who | ||
| 131 | 121 | const address = runtime.urlFor(record(), `pull-${pulls["green"]!.number}`); |
| 132 | 122 | |
| 133 | 123 | // A public app: every reader gets the address for the pull that has an environment, null for the rest. |
| 134 | const heldNow = () => new Set(runtime.status(record()).map((e) => e.env as string)); | |
| 135 | const before = heldNow(); | |
| 136 | 124 | const open = await listed(); |
| 137 | const after = heldNow(); | |
| 138 | 125 | expect(open["green"]!["preview"]).toBe(address); |
| 139 | // The runtime brings others up (and drops them) on its own while the request runs; an address is | |
| 140 | // given exactly where one exists, judged on the pulls whose environment held steady across it. | |
| 141 | for (const item of Object.values(open)) { | |
| 142 | const env = `pull-${item["number"]}`; | |
| 143 | if (before.has(env) !== after.has(env)) continue; | |
| 144 | expect(item["preview"] === null).toBe(!after.has(env)); | |
| 145 | } | |
| 126 | for (const item of Object.values(open)) if (item["title"] !== "green") expect(item["preview"]).toBeNull(); | |
| 146 | 127 | |
| 147 | 128 | // A private app on a public repository: a guest and a plain reader get none; the writer does. |
| 148 | 129 | app.db.query("UPDATE app SET access = 'private' WHERE repo_id = ?1").run(repoId); |
new above
offline