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

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:
2026-11-25 13:21:34 -05:00
co-authored by Claude Opus 5.5
parent 4244d81dfd
commit 4e1807cbba
80 changed files with 570 additions and 570 deletions
+1 -1
View File
@@ -178,7 +178,7 @@ func sleep(ctx context.Context, d time.Duration) error {
const luceneSpecial = `+-&|!(){}[]^"~*?:\/`
// Escape makes text typed by a person safe to put in a search query, so
// "AC/DC" or "Sunn O)))" searches for what was typed rather than failing to
// "AM/FM" or "Moon O)))" searches for what was typed rather than failing to
// parse.
func Escape(s string) string {
var b strings.Builder
+22 -22
View File
@@ -19,10 +19,10 @@ func testClient(srv *httptest.Server) *Client {
func TestEscape_KeepsWhatWasTyped(t *testing.T) {
for in, want := range map[string]string{
"Radiohead": "Radiohead",
"AC/DC": `AC\/DC`,
"Sunn O)))": `Sunn O\)\)\)`,
`"Weird" Al`: `\"Weird\" Al`,
"Signal Tower": "Signal Tower",
"AM/FM": `AM\/FM`,
"Moon O)))": `Moon O\)\)\)`,
`"Odd" Al`: `\"Odd\" Al`,
} {
if got := Escape(in); got != want {
t.Errorf("Escape(%q) = %q, want %q", in, got, want)
@@ -36,24 +36,24 @@ func TestSearchReleaseGroups_AsksTitleAndArtistAndReadsCredits(t *testing.T) {
query.Store(r.URL.Query().Get("query"))
agent.Store(r.Header.Get("User-Agent"))
_, _ = w.Write([]byte(`{"release-groups": [{
"id": "rg1", "title": "OK Computer", "primary-type": "Album", "secondary-types": [],
"id": "rg1", "title": "OK Calculator", "primary-type": "Album", "secondary-types": [],
"first-release-date": "1997-05-21",
"artist-credit": [{"name": "Radiohead", "joinphrase": "", "artist": {"id": "a1", "name": "Radiohead"}}]
"artist-credit": [{"name": "Signal Tower", "joinphrase": "", "artist": {"id": "a1", "name": "Signal Tower"}}]
}]}`))
}))
defer srv.Close()
got, err := testClient(srv).SearchReleaseGroups(context.Background(), "ok computer", 10)
got, err := testClient(srv).SearchReleaseGroups(context.Background(), "ok calculator", 10)
if err != nil {
t.Fatal(err)
}
if q := query.Load(); q != "releasegroup:(ok computer) OR artist:(ok computer)" {
if q := query.Load(); q != "releasegroup:(ok calculator) OR artist:(ok calculator)" {
t.Errorf("query = %q", q)
}
if agent.Load() != UserAgent {
t.Errorf("User-Agent = %q", agent.Load())
}
if len(got) != 1 || got[0].MBID != "rg1" || got[0].Year() != "1997" || got[0].ArtistCredit != "Radiohead" || got[0].ArtistMBIDs[0] != "a1" {
if len(got) != 1 || got[0].MBID != "rg1" || got[0].Year() != "1997" || got[0].ArtistCredit != "Signal Tower" || got[0].ArtistMBIDs[0] != "a1" {
t.Errorf("got %+v", got)
}
}
@@ -62,16 +62,16 @@ func TestSearchReleaseGroupsBy_AsksForBothTitleAndArtist(t *testing.T) {
var query atomic.Value
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
query.Store(r.URL.Query().Get("query"))
_, _ = w.Write([]byte(`{"release-groups": [{"id": "rg1", "title": "Highway to Hell",
"artist-credit": [{"name": "AC/DC", "artist": {"id": "a1"}}]}]}`))
_, _ = w.Write([]byte(`{"release-groups": [{"id": "rg1", "title": "Highway to Nowhere",
"artist-credit": [{"name": "AM/FM", "artist": {"id": "a1"}}]}]}`))
}))
defer srv.Close()
got, err := testClient(srv).SearchReleaseGroupsBy(context.Background(), " AC/DC ", "Highway to Hell", 10)
got, err := testClient(srv).SearchReleaseGroupsBy(context.Background(), " AM/FM ", "Highway to Nowhere", 10)
if err != nil {
t.Fatal(err)
}
if q := query.Load(); q != `releasegroup:(Highway to Hell) AND artist:(AC\/DC)` {
if q := query.Load(); q != `releasegroup:(Highway to Nowhere) AND artist:(AM\/FM)` {
t.Errorf("query = %q", q)
}
if len(got) != 1 || got[0].MBID != "rg1" || got[0].ArtistMBIDs[0] != "a1" {
@@ -82,17 +82,17 @@ func TestSearchReleaseGroupsBy_AsksForBothTitleAndArtist(t *testing.T) {
func TestSearchRecordings_FilesASongUnderItsAlbum(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
_, _ = w.Write([]byte(`{"recordings": [{
"id": "rec1", "title": "Karma Police", "length": 264000,
"artist-credit": [{"name": "Radiohead", "artist": {"id": "a1"}}],
"id": "rec1", "title": "Karma Patrol", "length": 264000,
"artist-credit": [{"name": "Signal Tower", "artist": {"id": "a1"}}],
"releases": [
{"id": "r1", "status": "Official", "release-group": {"id": "rg-live", "title": "Live", "primary-type": "Album", "secondary-types": ["Live"]}},
{"id": "r2", "status": "Official", "release-group": {"id": "rg1", "title": "OK Computer", "primary-type": "Album"}}
{"id": "r2", "status": "Official", "release-group": {"id": "rg1", "title": "OK Calculator", "primary-type": "Album"}}
]
}]}`))
}))
defer srv.Close()
got, err := testClient(srv).SearchRecordings(context.Background(), "karma police", 5)
got, err := testClient(srv).SearchRecordings(context.Background(), "karma patrol", 5)
if err != nil {
t.Fatal(err)
}
@@ -136,11 +136,11 @@ func TestReleaseGroupReleases_ReadsMediaAndTracks(t *testing.T) {
t.Errorf("inc = %q", r.URL.Query().Get("inc"))
}
_, _ = w.Write([]byte(`{"release-count": 1, "releases": [{
"id": "r1", "title": "OK Computer", "status": "Official", "date": "1997-06-16", "country": "GB",
"id": "r1", "title": "OK Calculator", "status": "Official", "date": "1997-06-16", "country": "GB",
"media": [
{"position": 1, "format": "CD", "tracks": [
{"position": 1, "number": "1", "title": "Airbag", "length": 284000, "recording": {"id": "rec-a"}},
{"position": 2, "number": "2", "title": "Paranoid Android", "length": null, "recording": {"id": "rec-b", "length": 383000}}
{"position": 1, "number": "1", "title": "Lifebelt", "length": 284000, "recording": {"id": "rec-a"}},
{"position": 2, "number": "2", "title": "Anxious Robot", "length": null, "recording": {"id": "rec-b", "length": 383000}}
]},
{"position": 2, "format": "CD", "tracks": []}
]
@@ -171,11 +171,11 @@ func TestGet_ThrottleIsRetriedThenUnreachable(t *testing.T) {
w.WriteHeader(http.StatusServiceUnavailable)
return
}
_, _ = w.Write([]byte(`{"artists": [{"id": "a1", "name": "Radiohead"}]}`))
_, _ = w.Write([]byte(`{"artists": [{"id": "a1", "name": "Signal Tower"}]}`))
}))
defer srv.Close()
got, err := testClient(srv).SearchArtists(context.Background(), "radiohead", 5)
got, err := testClient(srv).SearchArtists(context.Background(), "signal tower", 5)
if err != nil || len(got) != 1 || calls.Load() != 2 {
t.Fatalf("a throttled first answer should be retried: %v, %+v, %d calls", err, got, calls.Load())
}
+2 -2
View File
@@ -235,8 +235,8 @@ func (c *Client) SearchArtists(ctx context.Context, text string, limit int) ([]A
return out, nil
}
// SearchReleaseGroups finds albums by title or by artist, so "radiohead ok
// computer" and "ok computer" both find OK Computer.
// SearchReleaseGroups finds albums by title or by artist, so "signal tower ok
// computer" and "ok calculator" both find OK Calculator.
func (c *Client) SearchReleaseGroups(ctx context.Context, text string, limit int) ([]ReleaseGroup, error) {
var resp struct {
ReleaseGroups []wireReleaseGroup `json:"release-groups"`