Public: anyone can read this; the crew can change it.
Flaky test: no first page's client JavaScript or CSS passes its ceiling, and each page measures the same twice #17749
Merged 14h 25m ago, live in production
scout/forge:scout/17748-flaky-test-no-first-page-s-client-javasc → main 0 commits fork 1 thread · 1 unresolved
1 file
changed +22
−7
test/client-size.test.ts +22 −7
| @@ -101,18 +101,33 @@ async function render(b: (typeof PAGE_BUDGETS)[number]): Promise<string> { | ||
| 101 | 101 | return html; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | /** | |
| 105 | * Assets are content-addressed and shared: the same few files are linked from every page, so each | |
| 106 | * is fetched once. Fetching them per page was ~85 of ~120 requests, and under the full suite's load | |
| 107 | * the walk could pass its timeout (#17748): it passed alone in seconds. | |
| 108 | */ | |
| 109 | const assets = new Map<string, Promise<string>>(); | |
| 110 | function asset(path: string): Promise<string> { | |
| 111 | let body = assets.get(path); | |
| 112 | if (body === undefined) { | |
| 113 | body = (async () => { | |
| 114 | const res = await fetch(`${servers.url}${path}`, { headers: { "accept-encoding": "identity" }, redirect: "follow" }); | |
| 115 | const text = await res.text(); | |
| 116 | if (res.status !== 200) throw new Error(refused(path, res, text)); | |
| 117 | return text; | |
| 118 | })(); | |
| 119 | assets.set(path, body); | |
| 120 | } | |
| 121 | return body; | |
| 122 | } | |
| 123 | ||
| 104 | 124 | async function measure(): Promise<{ sizes: Ceilings; drift: string[] }> { |
| 105 | 125 | const sizes: Ceilings = {}; |
| 106 | 126 | const drift: string[] = []; |
| 107 | 127 | for (const b of PAGE_BUDGETS) { |
| 108 | 128 | const html = await render(b); |
| 109 | 129 | drift.push(...inlineDrift(`${b.pattern} (${b.page})`, html, await render(b))); |
| 110 | sizes[b.pattern] = await clientSize(html, async (path) => { | |
| 111 | const asset = await fetch(`${servers.url}${path}`, { headers: { "accept-encoding": "identity" }, redirect: "follow" }); | |
| 112 | const body = await asset.text(); | |
| 113 | if (asset.status !== 200) throw new Error(refused(path, asset, body)); | |
| 114 | return body; | |
| 115 | }); | |
| 130 | sizes[b.pattern] = await clientSize(html, asset); | |
| 116 | 131 | } |
| 117 | 132 | return { sizes, drift }; |
| 118 | 133 | } |
| @@ -128,7 +143,7 @@ test("no first page's client JavaScript or CSS passes its ceiling, and each page | ||
| 128 | 143 | const findings = PAGE_BUDGETS.flatMap((b) => sizeFindings(`${b.pattern} (${b.page})`, sizes[b.pattern]!, ceilings[b.pattern])); |
| 129 | 144 | console.log(`client bytes, gzip:\n${PAGE_BUDGETS.map((b) => `${b.pattern}\tjs ${sizes[b.pattern]!.js}\tcss ${sizes[b.pattern]!.css}`).join("\n")}`); |
| 130 | 145 | expect(findings).toEqual([]); |
| 131 | }, 60_000); | |
| 146 | }, 180_000); | |
| 132 | 147 | |
| 133 | 148 | test("the ceiling file names exactly the budgeted pages", () => { |
| 134 | 149 | const ceilings = readCeilings(); |
new above
offline
180 s is only room. If the flake returns with a timeout inside the fetch walk, find what is slow under load instead of raising this a third time.