Public: anyone can read this; the crew can change it.
Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:1ou7ejcd4q is past its budget: trevato/forge: "apps, runs and the crew on the web > the app strip says how long the first preview took, once one has s… #15712
Check · Review · Land · Live done — Landed and live in production.
torque/forge:torque/15710-sentinel-shared-01m23vygyffx5hg2f5vm8r74 → main 0 commits fork
2 files
changed +16
−15
scripts/test-honesty-allow.json +1 −1
| @@ -487,7 +487,7 @@ | ||
| 487 | 487 | "test/vitals-held-agent.test.ts": {"wait":1}, |
| 488 | 488 | "test/vitals.test.ts": {"wait":3}, |
| 489 | 489 | "test/watches.test.ts": {"wait":3}, |
| 490 | "test/web-apps.test.ts": {"wait":3}, | |
| 490 | "test/web-apps.test.ts": {"wait":2}, | |
| 491 | 491 | "test/web-origins.test.ts": {"timeout":1}, |
| 492 | 492 | "test/web-ui.test.ts": {"wait":2}, |
| 493 | 493 | "test/week-doors.test.ts": {"wait":1}, |
test/web-apps.test.ts +15 −14
| @@ -36,12 +36,11 @@ import { spanWords } from "../src/apps/golden_path.ts"; | ||
| 36 | 36 | import { getAppByRepo } from "../src/core/apps.ts"; |
| 37 | 37 | import { createIssue, getIssue } from "../src/core/issues.ts"; |
| 38 | 38 | import { getRepo, type Repo } from "../src/core/repos.ts"; |
| 39 | import { isTerminal, listRuns, type Run } from "../src/core/runs.ts"; | |
| 39 | import { listRuns, type Run } from "../src/core/runs.ts"; | |
| 40 | 40 | import { getUserByName, type User } from "../src/core/users.ts"; |
| 41 | 41 | import { serve, type Servers } from "../src/http/server.ts"; |
| 42 | 42 | import { quietLogs } from "./helpers/globals.ts"; |
| 43 | 43 | import { adminCookie } from "./helpers/admin.ts"; |
| 44 | import { waitFor } from "./helpers/poll.ts"; | |
| 45 | 44 | |
| 46 | 45 | quietLogs(); |
| 47 | 46 | |
| @@ -369,12 +368,11 @@ describe("apps, runs and the crew on the web", () => { | ||
| 369 | 368 | test("the App page mounts the live stream on a quiet app, so a push after it was drawn still shows up", async () => { |
| 370 | 369 | // Quiet: every run on hello has already finished, nothing is deploying. |
| 371 | 370 | await runsOf(hello, () => true); |
| 372 | const deadline = Date.now() + 10_000; | |
| 373 | while (Date.now() < deadline) { | |
| 374 | const runs = listRuns(app.db, hello.id, { limit: 50 }); | |
| 375 | if (runs.every((run) => isTerminal(run.state))) break; | |
| 376 | await Bun.sleep(50); | |
| 377 | } | |
| 371 | // Do not wait for the real runtime to settle (seconds, and more on a loaded | |
| 372 | // machine): make the quiet the test is about true in the record. | |
| 373 | app.db | |
| 374 | .query("UPDATE run SET state = 'ok' WHERE repo_id = ?1 AND state IN ('queued','running')") | |
| 375 | .run(hello.id); | |
| 378 | 376 | const html = await bodyOf(alice, "/alice/hello"); |
| 379 | 377 | expect(html).toContain('id="live"'); |
| 380 | 378 | expect(html).toContain('data-repo="/alice/hello"'); |
| @@ -1014,13 +1012,16 @@ describe("apps, runs and the crew on the web", () => { | ||
| 1014 | 1012 | }); |
| 1015 | 1013 | |
| 1016 | 1014 | // A real preview may still be deploying and stamp `serving_at` after we clear |
| 1017 | // it: let every run settle first, then clear the stamps. | |
| 1015 | // it, and on a loaded machine it may not settle in any bounded time. So do | |
| 1016 | // not wait on the runtime: move every real pull's deploy out of the `pull-%` | |
| 1017 | // environments the pages read, so nothing it does later can be counted. | |
| 1018 | 1018 | const noPreviewServed = async (): Promise<void> => { |
| 1019 | const open = () => | |
| 1020 | app.db.query("SELECT 1 FROM run WHERE state IN ('queued','running') LIMIT 1").get(); | |
| 1021 | await waitFor(() => open() === null, { every: 25, within: 5_000 }); | |
| 1022 | if (open() !== null) throw new Error(`never came: still waiting while open() !== null`); | |
| 1023 | app.db.query("UPDATE run SET serving_at = NULL WHERE env LIKE 'pull-%'").run(); | |
| 1019 | app.db | |
| 1020 | .query( | |
| 1021 | `UPDATE run SET env = 'moved-' || env, serving_at = NULL | |
| 1022 | WHERE env LIKE 'pull-%' AND kind = 'deploy'`, | |
| 1023 | ) | |
| 1024 | .run(); | |
| 1024 | 1025 | }; |
| 1025 | 1026 | |
| 1026 | 1027 | test("the app strip says how long the first preview took, once one has served", async () => { |
new above
offline