From 66d114bfe35c0aff98f72c63cd0ce2996f8793ee Mon Sep 17 00:00:00 2001 From: Josh Creek <8179928+jcreek@users.noreply.github.com> Date: Tue, 1 Sep 2026 12:44:48 +0100 Subject: [PATCH] test(server): seed a seasons row for the ranked rollover integration test ranked_season_rollovers.season_id has a foreign key into seasons, but the integration test never inserted a seasons row for 'season-1' -- ApplyRankedSeasonRollover failed on the FK constraint before the rollover logic itself ran at all. Insert a matching seasons row, mirroring how a real 12-week season would already exist when maintenance's rollover sweep runs. Verified against a real PostgreSQL instance. --- server/store/postgres_integration_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/store/postgres_integration_test.go b/server/store/postgres_integration_test.go index 961ba55e..9090b0cb 100644 --- a/server/store/postgres_integration_test.go +++ b/server/store/postgres_integration_test.go @@ -446,6 +446,9 @@ func TestPostgreSQLRankedSeasonRolloverIsExactlyOnce(t *testing.T) { if _, err := db.ExecContext(ctx, `INSERT INTO ratings (player_id, rating, deviation, volatility, ranked_games) VALUES ('season-player', 1900, 100, 0.12, 25)`); err != nil { t.Fatal(err) } + if _, err := db.ExecContext(ctx, `INSERT INTO seasons (season_id, playlist, starts_at, ends_at) VALUES ('season-1', 'ranked', $1, $2)`, now.Add(-12*7*24*time.Hour), now); err != nil { + t.Fatal(err) + } profile := domain.RankedProfile{Rating: domain.Rating{Value: 1900, RD: 100, Volatility: 0.12}, RankedGames: 25} updated, applied, err := ApplyRankedSeasonRollover(ctx, db, "season-player", "season-1", profile, now) if err != nil || !applied {