mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 13:01:00 +00:00
test(integration): keep racing feed rotations until a pair collides
Four fixed rounds could all finish one rotation before the other started on a fast runner, so the guard that the race really ran failed with eight 201s. Rounds now continue until a 409 shows up, with the mint bucket emptied between them, and the guard still fails if no pair ever collides.
This commit is contained in:
1 parent
0eadcdc326
commit
bd24d0aa98
1 file changed
+5
-2
@@ -216,9 +216,12 @@ describe("turning the subscription on", () => {
|
||||
const owner = await makeUser("owner");
|
||||
await mint(owner.id);
|
||||
// Both read the same live feed and revoke it; the second successor then
|
||||
// meets the one-live-feed index. Four rounds stay inside the mint bucket.
|
||||
// meets the one-live-feed index. A fast runner can still finish one
|
||||
// rotation before the other starts, so rounds go on until a pair has
|
||||
// really collided, with the mint bucket emptied between them.
|
||||
const statuses: number[] = [];
|
||||
for (let round = 0; round < 4; round++) {
|
||||
for (let round = 0; round < 25 && !statuses.includes(409); round++) {
|
||||
await db().rateLimit.deleteMany();
|
||||
const pair = await Promise.all([rotate(), rotate()]);
|
||||
for (const res of pair) {
|
||||
statuses.push(res.status);
|
||||
|
||||
Reference in new issue
Block a user