From cb2f9a2ea2df3b5ae8938a1dbbc30cb5dcebb099 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Tue, 2 Jun 2026 19:04:00 -0400 Subject: [PATCH] fix(server): GC test seeds tracks with file_size + file_format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Second go-round of the same shape of bug: tracks has file_size + file_format NOT NULL (0002_core_library.up.sql) and my GC test seed omitted both. The previous fix only addressed the artists.sort_name column; the tracks INSERT was missing two more. Use plausible stub values — the GC sweep only joins on track_id, none of these columns affect what the test exercises. --- internal/gc/worker_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/gc/worker_test.go b/internal/gc/worker_test.go index 5e5f737e..9cfd24c9 100644 --- a/internal/gc/worker_test.go +++ b/internal/gc/worker_test.go @@ -80,9 +80,14 @@ func TestGcCloseStalePlayEvents_ClosesOnly24hOldRows(t *testing.T) { `, artistID).Scan(&albumID); err != nil { t.Fatalf("seed album: %v", err) } + // `tracks` has file_size + file_format NOT NULL. Use plausible + // stub values — the GC sweep doesn't read any of these columns, + // it only joins on track_id. if err := pool.QueryRow(ctx, ` - INSERT INTO tracks (album_id, artist_id, title, file_path, duration_ms) - VALUES ($1, $2, 'T', '/x.mp3', 180000) RETURNING id + INSERT INTO tracks (album_id, artist_id, title, file_path, + duration_ms, file_size, file_format) + VALUES ($1, $2, 'T', '/x.mp3', 180000, 4_000_000, 'mp3') + RETURNING id `, albumID, artistID).Scan(&trackID); err != nil { t.Fatalf("seed track: %v", err) }