test: invented artists, albums and MusicBrainz ids in place of real ones
release / web (push) Failing after 1m16s
release / go (push) Successful in 1m48s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m0s
release / android (push) Successful in 4m34s
release / Build signed APK (push) Successful in 5m9s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
release / web (push) Failing after 1m16s
release / go (push) Successful in 1m48s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m0s
release / android (push) Successful in 4m34s
release / Build signed APK (push) Successful in 5m9s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
Test data and example comments named real artists, records and songs, and carried real MusicBrainz ids. One mapping swaps them for invented ones throughout (Fields of Ontario, Plastic Apes, Marlo Davies, ...), keeping what each case tests: sort order, index letter, escaping, title keys, artist-prefix stripping. A test username is no longer the operator's name. The cover-art and Last.fm connection checks still query real releases; they reach live services and need something that exists there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,7 @@ import (
|
||||
syncpkg "git.fabledsword.com/bvandeusen/minstrel/internal/sync"
|
||||
)
|
||||
|
||||
// resolveFixture is the Humanz shape: one album, one song twice, both copies on
|
||||
// resolveFixture is the Mammalz shape: one album, one song twice, both copies on
|
||||
// disk under an artist/album folder, in one pending exact-tier group.
|
||||
type resolveFixture struct {
|
||||
pool *pgxpool.Pool
|
||||
@@ -29,13 +29,13 @@ func newResolveFixture(t *testing.T) resolveFixture {
|
||||
pool := newPool(t)
|
||||
ctx := context.Background()
|
||||
q := dbq.New(pool)
|
||||
dir := filepath.Join(t.TempDir(), "Gorillaz", "Humanz (2017)")
|
||||
dir := filepath.Join(t.TempDir(), "Plastic Apes", "Mammalz (2017)")
|
||||
if err := os.MkdirAll(dir, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
f := resolveFixture{pool: pool}
|
||||
f.cleanPath = filepath.Join(dir, "Gorillaz - Humanz - 03 - Saturnz Barz.mp3")
|
||||
f.ripPath = filepath.Join(dir, "Gorillaz - Humanz - 03 - Saturnz Barz (Official Video).mp3")
|
||||
f.cleanPath = filepath.Join(dir, "Plastic Apes - Mammalz - 03 - Neptunez Barz.mp3")
|
||||
f.ripPath = filepath.Join(dir, "Plastic Apes - Mammalz - 03 - Neptunez Barz (Official Video).mp3")
|
||||
for _, p := range []string{f.cleanPath, f.ripPath} {
|
||||
if err := os.WriteFile(p, []byte("audio"), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -45,7 +45,7 @@ func newResolveFixture(t *testing.T) resolveFixture {
|
||||
var artist dbq.Artist
|
||||
f.clean, album, artist = seedTrack(t, pool, f.cleanPath)
|
||||
rip, err := q.UpsertTrack(ctx, dbq.UpsertTrackParams{
|
||||
Title: "Saturnz Barz (Official Video)", AlbumID: album.ID, ArtistID: artist.ID,
|
||||
Title: "Neptunez Barz (Official Video)", AlbumID: album.ID, ArtistID: artist.ID,
|
||||
DurationMs: 1000, FilePath: f.ripPath, FileSize: 100, FileFormat: "mp3",
|
||||
})
|
||||
if err != nil {
|
||||
@@ -58,7 +58,7 @@ func newResolveFixture(t *testing.T) resolveFixture {
|
||||
t.Fatalf("exec %q: %v", sql, err)
|
||||
}
|
||||
}
|
||||
exec(`UPDATE tracks SET title = 'Saturnz Barz' WHERE id = $1`, f.clean.ID)
|
||||
exec(`UPDATE tracks SET title = 'Neptunez Barz' WHERE id = $1`, f.clean.ID)
|
||||
if err := pool.QueryRow(ctx,
|
||||
`INSERT INTO duplicate_groups (member_key, tier) VALUES ('resolve-fixture', 'exact') RETURNING id`,
|
||||
).Scan(&f.groupID); err != nil {
|
||||
@@ -150,9 +150,9 @@ func newCrossReleaseRipFixture(t *testing.T) crossReleaseRipFixture {
|
||||
q := dbq.New(pool)
|
||||
root := t.TempDir()
|
||||
f := crossReleaseRipFixture{pool: pool}
|
||||
f.cleanPath = filepath.Join(root, "Gorillaz", "Demon Days (2005)", "06 - Feel Good Inc.mp3")
|
||||
f.ripPath = filepath.Join(root, "Gorillaz", "Feel Good Inc (2005)", "01 - Feel Good Inc. (Official Video).mp3")
|
||||
artist, err := q.UpsertArtist(ctx, dbq.UpsertArtistParams{Name: "Gorillaz", SortName: "Gorillaz"})
|
||||
f.cleanPath = filepath.Join(root, "Plastic Apes", "Ghost Nights (2005)", "06 - Feel Fine Ltd.mp3")
|
||||
f.ripPath = filepath.Join(root, "Plastic Apes", "Feel Fine Ltd (2005)", "01 - Feel Fine Ltd. (Official Video).mp3")
|
||||
artist, err := q.UpsertArtist(ctx, dbq.UpsertArtistParams{Name: "Plastic Apes", SortName: "Plastic Apes"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -177,8 +177,8 @@ func newCrossReleaseRipFixture(t *testing.T) crossReleaseRipFixture {
|
||||
}
|
||||
return tr
|
||||
}
|
||||
f.clean = track("Demon Days", "Feel Good Inc.", f.cleanPath)
|
||||
f.rip = track("Feel Good Inc.", "Feel Good Inc. (Official Video)", f.ripPath)
|
||||
f.clean = track("Ghost Nights", "Feel Fine Ltd.", f.cleanPath)
|
||||
f.rip = track("Feel Fine Ltd.", "Feel Fine Ltd. (Official Video)", f.ripPath)
|
||||
if err := pool.QueryRow(ctx,
|
||||
`INSERT INTO duplicate_groups (member_key, tier) VALUES ('cross-rip', 'acoustic') RETURNING id`,
|
||||
).Scan(&f.groupID); err != nil {
|
||||
@@ -217,8 +217,8 @@ func TestResolveDuplicates_MergesARipAcrossReleases_Integration(t *testing.T) {
|
||||
func TestResolveDuplicates_KeepsCleanCopiesOnTwoReleases_Integration(t *testing.T) {
|
||||
for name, prepare := range map[string]func(f crossReleaseRipFixture) (string, []any){
|
||||
"renamed": func(f crossReleaseRipFixture) (string, []any) {
|
||||
return `UPDATE tracks SET title = 'Feel Good Inc.', file_path = $2 WHERE id = $1`,
|
||||
[]any{f.rip.ID, filepath.Join(filepath.Dir(f.ripPath), "01 - Feel Good Inc.mp3")}
|
||||
return `UPDATE tracks SET title = 'Feel Fine Ltd.', file_path = $2 WHERE id = $1`,
|
||||
[]any{f.rip.ID, filepath.Join(filepath.Dir(f.ripPath), "01 - Feel Fine Ltd.mp3")}
|
||||
},
|
||||
"kept as fine": func(f crossReleaseRipFixture) (string, []any) {
|
||||
return `UPDATE tracks SET source_verdict = 'fine' WHERE id = $1`, []any{f.rip.ID}
|
||||
@@ -245,7 +245,7 @@ func TestResolveDuplicates_KeepsCleanCopiesOnTwoReleases_Integration(t *testing.
|
||||
}
|
||||
|
||||
// Identical audio under two titles on two albums, neither a rip: a later
|
||||
// release retitled the recording ("F.O.D." and "F.O.D. (live)"). Each copy
|
||||
// release retitled the recording ("F.O.E." and "F.O.E. (live)"). Each copy
|
||||
// belongs to its release, so nothing is removed and they count as one song.
|
||||
func TestResolveDuplicates_LinksOneRecordingUnderTwoTitles_Integration(t *testing.T) {
|
||||
f := newCrossReleaseRipFixture(t)
|
||||
@@ -282,7 +282,7 @@ func newOneAlbumFixture(t *testing.T, tier, titleA, titleB string) oneAlbumFixtu
|
||||
pool := newPool(t)
|
||||
ctx := context.Background()
|
||||
q := dbq.New(pool)
|
||||
dir := filepath.Join(t.TempDir(), "Savant", "Void")
|
||||
dir := filepath.Join(t.TempDir(), "Savanta", "Void")
|
||||
if err := os.MkdirAll(dir, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -331,7 +331,7 @@ func auditCount(t *testing.T, pool *pgxpool.Pool, action string, groupID pgtype.
|
||||
// Two versions of a song on one album that sound alike are not duplicates:
|
||||
// the group is dismissed and both files stay.
|
||||
func TestResolveDuplicates_DismissesTwoVersionsOfASong_Integration(t *testing.T) {
|
||||
f := newOneAlbumFixture(t, "acoustic", "Lovesick", "Lovesick (Instrumental)")
|
||||
f := newOneAlbumFixture(t, "acoustic", "Homesick", "Homesick (Instrumental)")
|
||||
res, err := ResolveDuplicates(context.Background(), f.pool, nil, "", true)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -418,7 +418,7 @@ func TestResolveDuplicates_RemovesACopyFromAnotherSongsSlot_Integration(t *testi
|
||||
}
|
||||
|
||||
// A slot emptied of another song's file folds into a copy of its own song the
|
||||
// album already holds (Savant's VOID DLC "Weeper" beside Void's). A copy under
|
||||
// album already holds (Savanta's VOID DLC "Sleeper" beside Void's). A copy under
|
||||
// the title that is not as long as the song is another song: the slot waits for
|
||||
// a good copy, and folds into that.
|
||||
func TestResolveDuplicates_EmptiedSlotFoldsOnlyIntoItsOwnSong_Integration(t *testing.T) {
|
||||
@@ -465,7 +465,7 @@ func TestResolveDuplicates_EmptiedSlotFoldsOnlyIntoItsOwnSong_Integration(t *tes
|
||||
}
|
||||
|
||||
// One recording filling two slots whose songs are both clearly something else
|
||||
// (Shnabubula's whole album in one file): both copies go, nothing is kept.
|
||||
// (Shnorkelbub's whole album in one file): both copies go, nothing is kept.
|
||||
func TestResolveDuplicates_RemovesEveryCopyWhenNoSlotIsTheirs_Integration(t *testing.T) {
|
||||
f := newOneAlbumFixture(t, "acoustic", "Void", "Reach")
|
||||
seedTrackList(t, f.pool, f.album, map[string]int{"Void": 282000, "Reach": 421000})
|
||||
@@ -735,7 +735,7 @@ func TestResolveDuplicates_HoldsBackRips_Integration(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := f.pool.Exec(ctx, `UPDATE tracks SET file_path = $2 WHERE id = $1`,
|
||||
f.rip.ID, filepath.Join(filepath.Dir(f.ripPath), "01 - Feel Good Inc.mp3")); err != nil {
|
||||
f.rip.ID, filepath.Join(filepath.Dir(f.ripPath), "01 - Feel Fine Ltd.mp3")); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if res := resolve(); res.Released != 1 {
|
||||
|
||||
Reference in New Issue
Block a user