mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 18:53:42 +00:00
feat: add ranked season maintenance role
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestMaintenanceSQLEnumeratesOnlyUnrolledRankedPlayers(t *testing.T) {
|
||||
for _, fragment := range []string{"s.playlist = 'ranked'", "ends_at <= $1", "rr.player_id IS NULL", "ORDER BY s.ends_at", "LIMIT $2"} {
|
||||
if !contains(DueSeasonRolloversSQL, fragment) {
|
||||
t.Fatalf("due query missing %q", fragment)
|
||||
}
|
||||
}
|
||||
for _, fragment := range []string{"rolled_over_at IS NULL", "NOT EXISTS", "ranked_season_rollovers"} {
|
||||
if !contains(MarkSeasonRolledOverSQL, fragment) {
|
||||
t.Fatalf("mark query missing %q", fragment)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRolloverDueSeasonsRejectsUnboundedMaintenance(t *testing.T) {
|
||||
if _, err := RolloverDueSeasons(nil, nil, time.Unix(1000, 0), 0); err == nil {
|
||||
t.Fatal("zero batch accepted")
|
||||
}
|
||||
if _, err := RolloverDueSeasons(nil, nil, time.Unix(1000, 0), 1001); err == nil {
|
||||
t.Fatal("oversized batch accepted")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user