mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 08:23:45 +00:00
feat: persist queue probe metadata
This commit is contained in:
@@ -14,6 +14,7 @@ func TestQueueSQLUsesDurableIdempotencyAndOwnerScopedRecovery(t *testing.T) {
|
||||
QueueTicketInsertSQL: {"player_id", "playlist", "client_build", "protocol_version"},
|
||||
QueueTicketHeartbeatSQL: {"player_id = $2", "revision = $3", "expires_at > $4", "RETURNING"},
|
||||
QueueTicketCancelSQL: {"player_id = $2", "revision = $3", "state NOT IN", "RETURNING"},
|
||||
QueueCandidateProjectionSQL: {"playlist = $1", "predicted_rtt", "expires_at > $2", "LIMIT $3"},
|
||||
} {
|
||||
for _, fragment := range fragments {
|
||||
if !contains(query, fragment) {
|
||||
@@ -23,6 +24,21 @@ func TestQueueSQLUsesDurableIdempotencyAndOwnerScopedRecovery(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestListQueuedCandidatesRejectsUnscopedOrUnboundedReads(t *testing.T) {
|
||||
now := time.Unix(1000, 0)
|
||||
for _, playlist := range []domain.Playlist{"", "invalid"} {
|
||||
if _, err := ListQueuedCandidates(nil, nil, playlist, now, 4); err == nil {
|
||||
t.Fatalf("playlist %q accepted", playlist)
|
||||
}
|
||||
}
|
||||
if _, err := ListQueuedCandidates(nil, nil, domain.Casual, now, 0); err == nil {
|
||||
t.Fatal("zero limit accepted")
|
||||
}
|
||||
if _, err := ListQueuedCandidates(nil, nil, domain.Casual, now, 1001); err == nil {
|
||||
t.Fatal("unbounded limit accepted")
|
||||
}
|
||||
}
|
||||
|
||||
func TestQueueMutationAdaptersRejectInvalidArgumentsWithoutDatabase(t *testing.T) {
|
||||
now := time.Unix(1000, 0)
|
||||
if _, err := HeartbeatQueueTicket(nil, nil, "player-1", "ticket-1", "short", 0, now); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user