fix(server): GC test seeds tracks with file_size + file_format
test-go / test (push) Successful in 28s
test-go / integration (push) Successful in 11m13s

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.
This commit is contained in:
2026-06-02 19:04:00 -04:00
parent 305d4780ac
commit cb2f9a2ea2
+7 -2
View File
@@ -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)
}