Public: anyone can read this; the crew can change it.
Cloud account hetzner/prod shows more than the forge made #17856
Merged 30h 19m ago, live in production
torque/forge:torque/17850-cloud-account-hetzner-prod-shows-more-th → main 0 commits fork 4 threads · 4 unresolved
1 file
changed +31
−0
test/cloud-watch-read.test.ts +31
| @@ -111,3 +111,34 @@ describe("paging", () => { | ||
| 111 | 111 | expect(plain("a`b\n[x](http://e)<i>")).toBe("a?b??x?(http://e)?i?"); |
| 112 | 112 | }); |
| 113 | 113 | }); |
| 114 | ||
| 115 | describe("the retry's bounds (#17850)", () => { | |
| 116 | const lists = (url: string) => json({ [new URL(url).pathname.split("/").pop()!]: [] }); | |
| 117 | const noPause = async () => { | |
| 118 | throw new Error("a read that answered paused"); | |
| 119 | }; | |
| 120 | ||
| 121 | test("a read that answers makes one call per list and never pauses", async () => { | |
| 122 | let n = 0; | |
| 123 | expect(await readLive("hetzner", async (url) => (n++, lists(url)), "tok", noPause)).toEqual([]); | |
| 124 | expect(n).toBe(3); | |
| 125 | }); | |
| 126 | ||
| 127 | test("a 503 that never clears throws after three tries: never read as clean", async () => { | |
| 128 | let n = 0; | |
| 129 | const read = readLive("hetzner", async (url) => (url.includes("/servers") ? (n++, json({}, 503)) : lists(url)), "tok", async () => {}); | |
| 130 | await expect(read).rejects.toThrow("answered 503 to servers"); | |
| 131 | expect(n).toBe(3); | |
| 132 | }); | |
| 133 | ||
| 134 | test("503s and timeouts mixed stop at three tries, never a fourth", async () => { | |
| 135 | let n = 0; | |
| 136 | const read = readLive("hetzner", async (url) => { | |
| 137 | if (!url.includes("/servers")) return lists(url); | |
| 138 | if (n++ % 2 === 0) return json({}, 503); | |
| 139 | throw new DOMException("The operation timed out.", "TimeoutError"); | |
| 140 | }, "tok", async () => {}); | |
| 141 | await expect(read).rejects.toThrow("answered 503 to servers"); | |
| 142 | expect(n).toBe(3); | |
| 143 | }); | |
| 144 | }); |
new above
offline