Test and document shared tournament deadlines
Some checks failed
Deploy MineGeo to Dokploy / deploy (push) Failing after 2m20s

This commit is contained in:
2026-10-19 10:16:23 +05:00
parent da1a50a6ad
commit 425b0e0805
3 changed files with 102 additions and 2 deletions

View File

@@ -478,6 +478,47 @@ try {
(await act(bigShared, users[0])).difficultySettings.seconds,
600,
);
await act(bigShared, users[1], "join");
await q(
"update public.tournaments set starts_at=clock_timestamp()-interval '1 second' where id=$1",
[bigShared],
);
await act(bigShared, users[0], "ready", { round: 0, tournamentRound: 0 });
let bigState = await act(bigShared, users[1], "ready", {
round: 0,
tournamentRound: 0,
});
const bigDeadline = bigState.roundDeadline;
assert(bigDeadline);
assert.equal(bigState.currentRoom.rounds[0].deadline, bigDeadline);
assert(Date.parse(bigDeadline) - bigState.serverNow > 2990 * 1000);
// The ordinary engine's 600-second mini timer must never cut a shared budget short.
await q(
"update public.multiplayer_rounds set deadline=clock_timestamp()-interval '1 second' where room_id=$1 and round_number=0",
[bigState.roomId],
);
bigState = await act(bigShared, users[0]);
assert.equal(bigState.currentRoom.status, "playing");
assert.equal(bigState.roundDeadline, bigDeadline);
assert.equal(bigState.currentRoom.rounds[0].deadline, bigDeadline);
for (const user of users.slice(0, 2))
await act(bigShared, user, "guess", {
round: 0,
tournamentRound: 0,
x: 10,
z: 10,
});
await q(
"update public.multiplayer_rooms set transition_at=clock_timestamp()-interval '1 second' where id=$1",
[bigState.roomId],
);
await act(bigShared, users[0], "ready", { round: 1, tournamentRound: 0 });
bigState = await act(bigShared, users[1], "ready", {
round: 1,
tournamentRound: 0,
});
assert.equal(bigState.roundDeadline, bigDeadline);
assert.equal(bigState.currentRoom.rounds[1].deadline, bigDeadline);
const moderated = await create({ announceDiscord: false });
await act(moderated, users[1], "join");
await q("update public.datasets set state='draft' where id=$1", [map]);