Public: anyone can read this; the crew can change it.
Full suite red: test/looks.test.ts #12764
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/12732-full-suite-red-test-looks-test-ts → main 2 commits fork 1 thread · 1 unresolved
1 file
changed +15
−3
test/looks.test.ts +15 −3
| @@ -1089,7 +1089,7 @@ describe("the look", () => { | ||
| 1089 | 1089 | expect(existsSync(join(dataDir, path))).toBe(false); |
| 1090 | 1090 | }); |
| 1091 | 1091 | |
| 1092 | test("a look waits for the app to answer before its one capture; an app that never answers gets none and one recorded reason (#11520)", async () => { | |
| 1092 | const answeringTrial = (answerWaitMs: number) => { | |
| 1093 | 1093 | const status = runtime.envStatus(record, "production")!; |
| 1094 | 1094 | const head = status.commitOid; |
| 1095 | 1095 | const forgetPictures = () => |
| @@ -1104,20 +1104,32 @@ describe("the look", () => { | ||
| 1104 | 1104 | return fake(input); |
| 1105 | 1105 | }, |
| 1106 | 1106 | answers, |
| 1107 | answerWaitMs: 150, | |
| 1108 | answerPollMs: 5, | |
| 1107 | answerWaitMs, | |
| 1108 | answerPollMs: 2, | |
| 1109 | 1109 | }); |
| 1110 | 1110 | own.sweep(); |
| 1111 | 1111 | await own.idle(); |
| 1112 | 1112 | await own.stop(); |
| 1113 | 1113 | return { seen, rows: looksForEnv(app.db, record.id, "production", "any").filter((l) => l.commitOid === head) }; |
| 1114 | 1114 | }; |
| 1115 | return { head, forgetPictures, trial }; | |
| 1116 | }; | |
| 1117 | ||
| 1118 | test("a look waits for the app to answer before its one capture (#11520)", async () => { | |
| 1119 | // A wide wait: a stalled event loop under load must not spend it before the fourth ask. | |
| 1120 | const { forgetPictures, trial } = answeringTrial(5_000); | |
| 1115 | 1121 | // Answers on the fourth ask: no capture before it, then the pictures. |
| 1116 | 1122 | let asked = 0; |
| 1117 | 1123 | const slow = await trial(async () => ++asked >= 4); |
| 1118 | 1124 | expect(asked).toBe(4); |
| 1119 | 1125 | expect(slow.seen.filter((c) => c.dark !== true).length).toBeGreaterThan(0); |
| 1120 | 1126 | expect(slow.rows.every((l) => l.error === null)).toBe(true); |
| 1127 | forgetPictures(); | |
| 1128 | }); | |
| 1129 | ||
| 1130 | test("an app that never answers gets no capture and one recorded reason (#11520)", async () => { | |
| 1131 | // A short wait: it only has to run out. | |
| 1132 | const { forgetPictures, trial } = answeringTrial(40); | |
| 1121 | 1133 | // Never answers: no browser, and the reason on record. |
| 1122 | 1134 | const mute = await trial(async () => false); |
| 1123 | 1135 | expect(mute.seen).toEqual([]); |
new above
offline
answerWaitMs: 40applies to both tests. The answering test needs four asks (about 6 ms of polling) inside 40 ms of wall time. A loaded CI machine can stall longer than that, and the capture is then never taken, so the test fails. Make the wait an argument toansweringTrialand give the answering test a wide one.