mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-13 02:52:01 +00:00
test(multiplayer): refresh proposal cooldown evidence
This commit is contained in:
@@ -531,14 +531,11 @@ func TestPostgreSQLProposalClaimAndResponseAreAtomic(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestPostgreSQLProposalDeclineRequeuesEveryParticipant is a real, severe
|
// TestPostgreSQLProposalDeclineRequeuesEveryParticipant protects the durable
|
||||||
// bug this session found by reading the code, not by a failing test: no
|
// decline boundary: every ticket returns to QUEUED, while the decliner's
|
||||||
// path anywhere transitioned a PROPOSED ticket back to QUEUED after a
|
// separate penalty prevents an immediate replacement queue ticket. Without
|
||||||
// decline. A stranded ticket is invisible to the matcher (which only reads
|
// the requeue, tickets are invisible to the matcher and remain trapped in
|
||||||
// state='QUEUED'), still counts as the player's one active ticket (blocking
|
// PROPOSED despite the proposal having closed.
|
||||||
// a fresh queue_create), and is renewable forever by an ordinary heartbeat
|
|
||||||
// -- a player proposed a match with someone who declines had no way back
|
|
||||||
// into matchmaking without realising they had to manually cancel first.
|
|
||||||
func TestPostgreSQLProposalDeclineRequeuesEveryParticipant(t *testing.T) {
|
func TestPostgreSQLProposalDeclineRequeuesEveryParticipant(t *testing.T) {
|
||||||
db := openIntegrationPostgres(t)
|
db := openIntegrationPostgres(t)
|
||||||
applyIntegrationMigrations(t, db)
|
applyIntegrationMigrations(t, db)
|
||||||
@@ -582,7 +579,7 @@ func TestPostgreSQLProposalDeclineRequeuesEveryParticipant(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if stateA != "QUEUED" {
|
if stateA != "QUEUED" {
|
||||||
t.Fatalf("decliner's own ticket state = %s, want QUEUED (no cooldown mechanism exists yet to justify leaving it stuck)", stateA)
|
t.Fatalf("decliner's own ticket state = %s, want QUEUED while cooldown is recorded separately", stateA)
|
||||||
}
|
}
|
||||||
if stateB != "QUEUED" {
|
if stateB != "QUEUED" {
|
||||||
t.Fatalf("uninvolved participant's ticket state = %s, want QUEUED -- they must not be stranded by someone else's decline", stateB)
|
t.Fatalf("uninvolved participant's ticket state = %s, want QUEUED -- they must not be stranded by someone else's decline", stateB)
|
||||||
@@ -606,15 +603,11 @@ func TestPostgreSQLProposalDeclineRequeuesEveryParticipant(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestPostgreSQLProposalTimeoutRequeuesEveryParticipant is the timeout
|
// TestPostgreSQLProposalTimeoutRequeuesEveryParticipant protects the timeout
|
||||||
// sibling of the decline test above: a proposal that simply times out (no
|
// sibling of the decline path: expiry must requeue every ticket and record a
|
||||||
// explicit decline, nobody ever responds) hits the exact same
|
// timeout cooldown for each participant who failed to respond. It uses
|
||||||
// ProposalExpireSQL/ProposalParticipantExpireSQL path with the exact same
|
// GetProposal, the recovery/read path, to exercise a client returning after
|
||||||
// gap -- neither ever touched queue_tickets, so this is the same severe
|
// it missed the expiry event.
|
||||||
// stranding bug reached a different way. Uses GetProposal (the recovery/read
|
|
||||||
// path) rather than RespondToProposal, since a real client that just missed
|
|
||||||
// the expiry event and comes back later to check on it is exactly the
|
|
||||||
// scenario this path exists for.
|
|
||||||
func TestPostgreSQLProposalTimeoutRequeuesEveryParticipant(t *testing.T) {
|
func TestPostgreSQLProposalTimeoutRequeuesEveryParticipant(t *testing.T) {
|
||||||
db := openIntegrationPostgres(t)
|
db := openIntegrationPostgres(t)
|
||||||
applyIntegrationMigrations(t, db)
|
applyIntegrationMigrations(t, db)
|
||||||
|
|||||||
Reference in New Issue
Block a user