test(subsonic): add comprehensive e2e test suite for Subsonic API (#5003)
* test(e2e): add comprehensive tests for Subsonic API endpoints
Signed-off-by: Deluan <deluan@navidrome.org>
* fix(e2e): improve database handling and snapshot restoration in tests
Signed-off-by: Deluan <deluan@navidrome.org>
* test(e2e): add tests for album sharing and user isolation scenarios
Signed-off-by: Deluan <deluan@navidrome.org>
* test(e2e): add tests for multi-library support and user access control
Signed-off-by: Deluan <deluan@navidrome.org>
* test(e2e): tests are fast, no need to skip on -short
Signed-off-by: Deluan <deluan@navidrome.org>
* address gemini comments
Signed-off-by: Deluan <deluan@navidrome.org>
* fix(tests): prevent MockDataStore from caching repos with stale context
When RealDS is set, MockDataStore previously cached repository instances
on first access, binding them to the initial caller's context. This meant
repos created with an admin context would skip library filtering for all
subsequent non-admin calls, silently masking access control bugs. Changed
MockDataStore to delegate to RealDS on every call without caching, so each
caller gets a fresh repo with the correct context. Removed the pre-warm
calls in e2e setupTestDB that were working around the old caching behavior.
* test(e2e): route subsonic tests through full HTTP middleware stack
Replace direct router method calls with full HTTP round-trips via
router.ServeHTTP(w, r) across all 15 e2e test files. Tests now exercise
the complete chi middleware chain including postFormToQueryParams,
checkRequiredParameters, authenticate, UpdateLastAccessMiddleware,
getPlayer, and sendResponse/sendError serialization.
New helpers (doReq, doReqWithUser, doRawReq, buildReq, parseJSONResponse)
use plaintext password auth and JSON response format. Old helpers that
injected context directly (newReq, newReqWithUser, newRawReq) are removed.
Sharing tests now set conf.Server.EnableSharing before router creation to
ensure sharing routes are registered.
---------
Signed-off-by: Deluan <deluan@navidrome.org>
2026-02-09 04:24:37 -09:00
|
|
|
package e2e
|
|
|
|
|
|
|
|
|
|
import (
|
2026-02-21 20:32:14 -09:00
|
|
|
"github.com/google/uuid"
|
2026-02-23 04:51:54 -09:00
|
|
|
"github.com/navidrome/navidrome/conf"
|
|
|
|
|
"github.com/navidrome/navidrome/conf/configtest"
|
test(subsonic): add comprehensive e2e test suite for Subsonic API (#5003)
* test(e2e): add comprehensive tests for Subsonic API endpoints
Signed-off-by: Deluan <deluan@navidrome.org>
* fix(e2e): improve database handling and snapshot restoration in tests
Signed-off-by: Deluan <deluan@navidrome.org>
* test(e2e): add tests for album sharing and user isolation scenarios
Signed-off-by: Deluan <deluan@navidrome.org>
* test(e2e): add tests for multi-library support and user access control
Signed-off-by: Deluan <deluan@navidrome.org>
* test(e2e): tests are fast, no need to skip on -short
Signed-off-by: Deluan <deluan@navidrome.org>
* address gemini comments
Signed-off-by: Deluan <deluan@navidrome.org>
* fix(tests): prevent MockDataStore from caching repos with stale context
When RealDS is set, MockDataStore previously cached repository instances
on first access, binding them to the initial caller's context. This meant
repos created with an admin context would skip library filtering for all
subsequent non-admin calls, silently masking access control bugs. Changed
MockDataStore to delegate to RealDS on every call without caching, so each
caller gets a fresh repo with the correct context. Removed the pre-warm
calls in e2e setupTestDB that were working around the old caching behavior.
* test(e2e): route subsonic tests through full HTTP middleware stack
Replace direct router method calls with full HTTP round-trips via
router.ServeHTTP(w, r) across all 15 e2e test files. Tests now exercise
the complete chi middleware chain including postFormToQueryParams,
checkRequiredParameters, authenticate, UpdateLastAccessMiddleware,
getPlayer, and sendResponse/sendError serialization.
New helpers (doReq, doReqWithUser, doRawReq, buildReq, parseJSONResponse)
use plaintext password auth and JSON response format. Old helpers that
injected context directly (newReq, newReqWithUser, newRawReq) are removed.
Sharing tests now set conf.Server.EnableSharing before router creation to
ensure sharing routes are registered.
---------
Signed-off-by: Deluan <deluan@navidrome.org>
2026-02-09 04:24:37 -09:00
|
|
|
"github.com/navidrome/navidrome/server/subsonic/responses"
|
|
|
|
|
. "github.com/onsi/ginkgo/v2"
|
|
|
|
|
. "github.com/onsi/gomega"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var _ = Describe("Search Endpoints", func() {
|
|
|
|
|
BeforeEach(func() {
|
|
|
|
|
setupTestDB()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
Describe("Search2", func() {
|
|
|
|
|
It("finds artists by name", func() {
|
|
|
|
|
resp := doReq("search2", "query", "Beatles")
|
|
|
|
|
|
|
|
|
|
Expect(resp.Status).To(Equal(responses.StatusOK))
|
|
|
|
|
Expect(resp.SearchResult2).ToNot(BeNil())
|
|
|
|
|
Expect(resp.SearchResult2.Artist).ToNot(BeEmpty())
|
|
|
|
|
|
|
|
|
|
found := false
|
|
|
|
|
for _, a := range resp.SearchResult2.Artist {
|
|
|
|
|
if a.Name == "The Beatles" {
|
|
|
|
|
found = true
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Expect(found).To(BeTrue(), "expected to find artist 'The Beatles'")
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
It("finds albums by name", func() {
|
|
|
|
|
resp := doReq("search2", "query", "Abbey Road")
|
|
|
|
|
|
|
|
|
|
Expect(resp.SearchResult2).ToNot(BeNil())
|
|
|
|
|
Expect(resp.SearchResult2.Album).ToNot(BeEmpty())
|
|
|
|
|
|
|
|
|
|
found := false
|
|
|
|
|
for _, a := range resp.SearchResult2.Album {
|
|
|
|
|
if a.Title == "Abbey Road" {
|
|
|
|
|
found = true
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Expect(found).To(BeTrue(), "expected to find album 'Abbey Road'")
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
It("finds songs by title", func() {
|
|
|
|
|
resp := doReq("search2", "query", "Come Together")
|
|
|
|
|
|
|
|
|
|
Expect(resp.SearchResult2).ToNot(BeNil())
|
|
|
|
|
Expect(resp.SearchResult2.Song).ToNot(BeEmpty())
|
|
|
|
|
|
|
|
|
|
found := false
|
|
|
|
|
for _, s := range resp.SearchResult2.Song {
|
|
|
|
|
if s.Title == "Come Together" {
|
|
|
|
|
found = true
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Expect(found).To(BeTrue(), "expected to find song 'Come Together'")
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
It("respects artistCount/albumCount/songCount limits", func() {
|
|
|
|
|
resp := doReq("search2", "query", "Beatles",
|
|
|
|
|
"artistCount", "1", "albumCount", "1", "songCount", "1")
|
|
|
|
|
|
|
|
|
|
Expect(resp.SearchResult2).ToNot(BeNil())
|
|
|
|
|
Expect(len(resp.SearchResult2.Artist)).To(BeNumerically("<=", 1))
|
|
|
|
|
Expect(len(resp.SearchResult2.Album)).To(BeNumerically("<=", 1))
|
|
|
|
|
Expect(len(resp.SearchResult2.Song)).To(BeNumerically("<=", 1))
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
It("supports offset parameters", func() {
|
|
|
|
|
// First get all results for Beatles
|
|
|
|
|
resp1 := doReq("search2", "query", "Beatles", "songCount", "500")
|
|
|
|
|
allSongs := resp1.SearchResult2.Song
|
|
|
|
|
|
|
|
|
|
if len(allSongs) > 1 {
|
|
|
|
|
// Get with offset to skip the first song
|
|
|
|
|
resp2 := doReq("search2", "query", "Beatles", "songOffset", "1", "songCount", "500")
|
|
|
|
|
|
|
|
|
|
Expect(resp2.SearchResult2).ToNot(BeNil())
|
|
|
|
|
Expect(len(resp2.SearchResult2.Song)).To(Equal(len(allSongs) - 1))
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
It("returns empty results for non-matching query", func() {
|
|
|
|
|
resp := doReq("search2", "query", "ZZZZNONEXISTENT99999")
|
|
|
|
|
|
|
|
|
|
Expect(resp.SearchResult2).ToNot(BeNil())
|
|
|
|
|
Expect(resp.SearchResult2.Artist).To(BeEmpty())
|
|
|
|
|
Expect(resp.SearchResult2.Album).To(BeEmpty())
|
|
|
|
|
Expect(resp.SearchResult2.Song).To(BeEmpty())
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
Describe("Search3", func() {
|
|
|
|
|
It("returns results in ID3 format", func() {
|
|
|
|
|
resp := doReq("search3", "query", "Beatles")
|
|
|
|
|
|
|
|
|
|
Expect(resp.Status).To(Equal(responses.StatusOK))
|
|
|
|
|
Expect(resp.SearchResult3).ToNot(BeNil())
|
|
|
|
|
// Verify ID3 format: Artist should be ArtistID3 with Name and AlbumCount
|
|
|
|
|
Expect(resp.SearchResult3.Artist).ToNot(BeEmpty())
|
|
|
|
|
Expect(resp.SearchResult3.Artist[0].Name).ToNot(BeEmpty())
|
|
|
|
|
Expect(resp.SearchResult3.Artist[0].Id).ToNot(BeEmpty())
|
|
|
|
|
})
|
|
|
|
|
|
2026-02-21 18:00:00 -09:00
|
|
|
It("returns all results when query is empty (OpenSubsonic)", func() {
|
|
|
|
|
resp := doReq("search3", "query", "")
|
|
|
|
|
|
|
|
|
|
Expect(resp.Status).To(Equal(responses.StatusOK))
|
|
|
|
|
Expect(resp.SearchResult3).ToNot(BeNil())
|
2026-03-09 05:43:55 -08:00
|
|
|
Expect(resp.SearchResult3.Artist).To(HaveLen(6))
|
|
|
|
|
Expect(resp.SearchResult3.Album).To(HaveLen(7))
|
fix(transcoding): clamp target channels to codec limit (#5336) (#5345)
* fix(transcoding): clamp target channels to codec limit (#5336)
When transcoding a multi-channel source (e.g. 6-channel FLAC) to MP3, the
decider passed the source channel count through to ffmpeg unchanged. The
default MP3 command path then emitted `-ac 6`, and the template path injected
`-ac 6` after the template's own `-ac 2`, causing ffmpeg to honor the last
occurrence and fail with exit code 234 since libmp3lame only supports up to
2 channels.
Introduce `codecMaxChannels()` in core/stream/codec.go (mp3→2, opus→8),
mirroring the existing `codecMaxSampleRate` pattern, and apply the clamp in
`computeTranscodedStream` right after the sample-rate clamps. Also fix a
pre-existing ordering bug where the profile's MaxAudioChannels check compared
against src.Channels rather than ts.Channels, which would have let a looser
profile setting raise the codec-clamped value back up. Comparing against the
already-clamped ts.Channels makes profile limits strictly narrowing, which
matches how the sample-rate block already behaves.
The ffmpeg buildTemplateArgs comment is refreshed to point at the new upstream
clamp, since the flags it injects are now always codec-safe.
Adds unit tests for codecMaxChannels and four decider scenarios covering the
literal issue repro (6-ch FLAC→MP3 clamps to 2), a stricter profile limit
winning over the codec clamp, a looser profile limit leaving the codec clamp
intact, and a codec with no hard limit (AAC) passing 6 channels through.
* test(e2e): pin codec channel clamp at the Subsonic API surface (#5336)
Add a 6-channel FLAC fixture to the e2e test suite and use it to assert the
codec channel clamp end-to-end on both Subsonic streaming endpoints:
- getTranscodeDecision (mp3OnlyClient, no MaxAudioChannels in profile):
expects TranscodeStream.AudioChannels == 2 for the 6-channel source. This
exercises the new codecMaxChannels() helper through the OpenSubsonic
decision endpoint, with no profile-level channel limit masking the bug.
- /rest/stream (legacy): requests format=mp3 against the multichannel
fixture and asserts streamerSpy.LastRequest.Channels == 2, confirming
the clamp propagates through ResolveRequest into the stream.Request that
the streamer receives.
The fixture is metadata-only (channels: 6 plumbed via the existing
storagetest.File helper) — no real audio bytes required, since the e2e
suite uses a spy streamer rather than invoking ffmpeg. Bumps the empty-query
search3 song count expectation from 13 to 14 to account for the new fixture.
* test(decider): clarify codec-clamp comment terminology
Distinguish "transcoding profile MaxAudioChannels" (Profile.MaxAudioChannels
field) from "LimitationAudioChannels" (CodecProfile rule constant). The
regression test bypasses the former, not the latter.
2026-04-11 19:15:07 -08:00
|
|
|
Expect(resp.SearchResult3.Song).To(HaveLen(14))
|
2026-02-21 18:00:00 -09:00
|
|
|
})
|
|
|
|
|
|
test(subsonic): add comprehensive e2e test suite for Subsonic API (#5003)
* test(e2e): add comprehensive tests for Subsonic API endpoints
Signed-off-by: Deluan <deluan@navidrome.org>
* fix(e2e): improve database handling and snapshot restoration in tests
Signed-off-by: Deluan <deluan@navidrome.org>
* test(e2e): add tests for album sharing and user isolation scenarios
Signed-off-by: Deluan <deluan@navidrome.org>
* test(e2e): add tests for multi-library support and user access control
Signed-off-by: Deluan <deluan@navidrome.org>
* test(e2e): tests are fast, no need to skip on -short
Signed-off-by: Deluan <deluan@navidrome.org>
* address gemini comments
Signed-off-by: Deluan <deluan@navidrome.org>
* fix(tests): prevent MockDataStore from caching repos with stale context
When RealDS is set, MockDataStore previously cached repository instances
on first access, binding them to the initial caller's context. This meant
repos created with an admin context would skip library filtering for all
subsequent non-admin calls, silently masking access control bugs. Changed
MockDataStore to delegate to RealDS on every call without caching, so each
caller gets a fresh repo with the correct context. Removed the pre-warm
calls in e2e setupTestDB that were working around the old caching behavior.
* test(e2e): route subsonic tests through full HTTP middleware stack
Replace direct router method calls with full HTTP round-trips via
router.ServeHTTP(w, r) across all 15 e2e test files. Tests now exercise
the complete chi middleware chain including postFormToQueryParams,
checkRequiredParameters, authenticate, UpdateLastAccessMiddleware,
getPlayer, and sendResponse/sendError serialization.
New helpers (doReq, doReqWithUser, doRawReq, buildReq, parseJSONResponse)
use plaintext password auth and JSON response format. Old helpers that
injected context directly (newReq, newReqWithUser, newRawReq) are removed.
Sharing tests now set conf.Server.EnableSharing before router creation to
ensure sharing routes are registered.
---------
Signed-off-by: Deluan <deluan@navidrome.org>
2026-02-09 04:24:37 -09:00
|
|
|
It("finds across all entity types simultaneously", func() {
|
|
|
|
|
// "Beatles" should match artist, albums, and songs by The Beatles
|
|
|
|
|
resp := doReq("search3", "query", "Beatles")
|
|
|
|
|
|
|
|
|
|
Expect(resp.SearchResult3).ToNot(BeNil())
|
|
|
|
|
|
|
|
|
|
// Should find at least the artist "The Beatles"
|
|
|
|
|
artistFound := false
|
|
|
|
|
for _, a := range resp.SearchResult3.Artist {
|
|
|
|
|
if a.Name == "The Beatles" {
|
|
|
|
|
artistFound = true
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Expect(artistFound).To(BeTrue(), "expected to find artist 'The Beatles'")
|
|
|
|
|
|
|
|
|
|
// Should find albums by The Beatles (albums contain "Beatles" in artist field)
|
|
|
|
|
// Albums are returned as AlbumID3 type
|
|
|
|
|
for _, a := range resp.SearchResult3.Album {
|
|
|
|
|
Expect(a.Id).ToNot(BeEmpty())
|
|
|
|
|
Expect(a.Name).ToNot(BeEmpty())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Songs are returned as Child type
|
|
|
|
|
for _, s := range resp.SearchResult3.Song {
|
|
|
|
|
Expect(s.Id).ToNot(BeEmpty())
|
|
|
|
|
Expect(s.Title).ToNot(BeEmpty())
|
|
|
|
|
}
|
|
|
|
|
})
|
2026-02-21 20:32:14 -09:00
|
|
|
|
|
|
|
|
Describe("MBID search", func() {
|
|
|
|
|
It("finds songs by mbz_recording_id", func() {
|
|
|
|
|
resp := doReq("search3", "query", mbidComeTogetherRec)
|
|
|
|
|
|
|
|
|
|
Expect(resp.Status).To(Equal(responses.StatusOK))
|
|
|
|
|
Expect(resp.SearchResult3).ToNot(BeNil())
|
|
|
|
|
Expect(resp.SearchResult3.Song).To(HaveLen(1))
|
|
|
|
|
Expect(resp.SearchResult3.Song[0].Title).To(Equal("Come Together"))
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
It("finds songs by mbz_release_track_id", func() {
|
|
|
|
|
resp := doReq("search3", "query", mbidSomething)
|
|
|
|
|
|
|
|
|
|
Expect(resp.Status).To(Equal(responses.StatusOK))
|
|
|
|
|
Expect(resp.SearchResult3).ToNot(BeNil())
|
|
|
|
|
Expect(resp.SearchResult3.Song).To(HaveLen(1))
|
|
|
|
|
Expect(resp.SearchResult3.Song[0].Title).To(Equal("Something"))
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
It("finds albums by mbz_album_id", func() {
|
|
|
|
|
resp := doReq("search3", "query", mbidAbbeyRoadAlbum)
|
|
|
|
|
|
|
|
|
|
Expect(resp.Status).To(Equal(responses.StatusOK))
|
|
|
|
|
Expect(resp.SearchResult3).ToNot(BeNil())
|
|
|
|
|
Expect(resp.SearchResult3.Album).To(HaveLen(1))
|
|
|
|
|
Expect(resp.SearchResult3.Album[0].Name).To(Equal("Abbey Road"))
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
It("finds albums by mbz_release_group_id", func() {
|
|
|
|
|
resp := doReq("search3", "query", mbidAbbeyRoadRelGroup)
|
|
|
|
|
|
|
|
|
|
Expect(resp.Status).To(Equal(responses.StatusOK))
|
|
|
|
|
Expect(resp.SearchResult3).ToNot(BeNil())
|
|
|
|
|
Expect(resp.SearchResult3.Album).To(HaveLen(1))
|
|
|
|
|
Expect(resp.SearchResult3.Album[0].Name).To(Equal("Abbey Road"))
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
It("finds artists by mbz_artist_id", func() {
|
|
|
|
|
resp := doReq("search3", "query", mbidBeatlesArtist)
|
|
|
|
|
|
|
|
|
|
Expect(resp.Status).To(Equal(responses.StatusOK))
|
|
|
|
|
Expect(resp.SearchResult3).ToNot(BeNil())
|
|
|
|
|
Expect(resp.SearchResult3.Artist).To(HaveLen(1))
|
|
|
|
|
Expect(resp.SearchResult3.Artist[0].Name).To(Equal("The Beatles"))
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
It("returns empty results for non-matching UUID", func() {
|
|
|
|
|
nonMatchingUUID := uuid.NewString()
|
|
|
|
|
resp := doReq("search3", "query", nonMatchingUUID)
|
|
|
|
|
|
|
|
|
|
Expect(resp.Status).To(Equal(responses.StatusOK))
|
|
|
|
|
Expect(resp.SearchResult3).ToNot(BeNil())
|
|
|
|
|
Expect(resp.SearchResult3.Artist).To(BeEmpty())
|
|
|
|
|
Expect(resp.SearchResult3.Album).To(BeEmpty())
|
|
|
|
|
Expect(resp.SearchResult3.Song).To(BeEmpty())
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
It("does not return songs for artist MBID", func() {
|
|
|
|
|
// media_file MBID search only checks mbz_recording_id and mbz_release_track_id,
|
|
|
|
|
// so an artist MBID should return only the artist, not songs
|
|
|
|
|
resp := doReq("search3", "query", mbidBeatlesArtist)
|
|
|
|
|
|
|
|
|
|
Expect(resp.Status).To(Equal(responses.StatusOK))
|
|
|
|
|
Expect(resp.SearchResult3).ToNot(BeNil())
|
|
|
|
|
Expect(resp.SearchResult3.Artist).To(HaveLen(1))
|
|
|
|
|
Expect(resp.SearchResult3.Artist[0].Name).To(Equal("The Beatles"))
|
|
|
|
|
Expect(resp.SearchResult3.Song).To(BeEmpty())
|
|
|
|
|
})
|
|
|
|
|
})
|
2026-02-23 04:51:54 -09:00
|
|
|
|
|
|
|
|
Describe("CJK search", func() {
|
|
|
|
|
It("finds songs by CJK title", func() {
|
|
|
|
|
resp := doReq("search3", "query", "プラチナ")
|
|
|
|
|
|
|
|
|
|
Expect(resp.Status).To(Equal(responses.StatusOK))
|
|
|
|
|
Expect(resp.SearchResult3).ToNot(BeNil())
|
|
|
|
|
Expect(resp.SearchResult3.Song).To(HaveLen(1))
|
|
|
|
|
Expect(resp.SearchResult3.Song[0].Title).To(Equal("プラチナ・ジェット"))
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
It("finds artists by CJK name", func() {
|
|
|
|
|
resp := doReq("search3", "query", "シートベルツ")
|
|
|
|
|
|
|
|
|
|
Expect(resp.Status).To(Equal(responses.StatusOK))
|
|
|
|
|
Expect(resp.SearchResult3).ToNot(BeNil())
|
|
|
|
|
Expect(resp.SearchResult3.Artist).To(HaveLen(1))
|
|
|
|
|
Expect(resp.SearchResult3.Artist[0].Name).To(Equal("シートベルツ"))
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
It("finds albums by CJK artist name", func() {
|
|
|
|
|
resp := doReq("search3", "query", "シートベルツ")
|
|
|
|
|
|
|
|
|
|
Expect(resp.Status).To(Equal(responses.StatusOK))
|
|
|
|
|
Expect(resp.SearchResult3).ToNot(BeNil())
|
|
|
|
|
Expect(resp.SearchResult3.Album).To(HaveLen(1))
|
|
|
|
|
Expect(resp.SearchResult3.Album[0].Name).To(Equal("COWBOY BEBOP"))
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
Describe("Legacy backend", func() {
|
|
|
|
|
It("returns results using legacy LIKE-based search when configured", func() {
|
|
|
|
|
DeferCleanup(configtest.SetupConfig())
|
|
|
|
|
conf.Server.Search.Backend = "legacy"
|
|
|
|
|
|
|
|
|
|
resp := doReq("search3", "query", "Beatles")
|
|
|
|
|
|
|
|
|
|
Expect(resp.Status).To(Equal(responses.StatusOK))
|
|
|
|
|
Expect(resp.SearchResult3).ToNot(BeNil())
|
|
|
|
|
Expect(resp.SearchResult3.Artist).ToNot(BeEmpty())
|
|
|
|
|
|
|
|
|
|
found := false
|
|
|
|
|
for _, a := range resp.SearchResult3.Artist {
|
|
|
|
|
if a.Name == "The Beatles" {
|
|
|
|
|
found = true
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Expect(found).To(BeTrue(), "expected to find artist 'The Beatles' with legacy backend")
|
|
|
|
|
})
|
|
|
|
|
})
|
test(subsonic): add comprehensive e2e test suite for Subsonic API (#5003)
* test(e2e): add comprehensive tests for Subsonic API endpoints
Signed-off-by: Deluan <deluan@navidrome.org>
* fix(e2e): improve database handling and snapshot restoration in tests
Signed-off-by: Deluan <deluan@navidrome.org>
* test(e2e): add tests for album sharing and user isolation scenarios
Signed-off-by: Deluan <deluan@navidrome.org>
* test(e2e): add tests for multi-library support and user access control
Signed-off-by: Deluan <deluan@navidrome.org>
* test(e2e): tests are fast, no need to skip on -short
Signed-off-by: Deluan <deluan@navidrome.org>
* address gemini comments
Signed-off-by: Deluan <deluan@navidrome.org>
* fix(tests): prevent MockDataStore from caching repos with stale context
When RealDS is set, MockDataStore previously cached repository instances
on first access, binding them to the initial caller's context. This meant
repos created with an admin context would skip library filtering for all
subsequent non-admin calls, silently masking access control bugs. Changed
MockDataStore to delegate to RealDS on every call without caching, so each
caller gets a fresh repo with the correct context. Removed the pre-warm
calls in e2e setupTestDB that were working around the old caching behavior.
* test(e2e): route subsonic tests through full HTTP middleware stack
Replace direct router method calls with full HTTP round-trips via
router.ServeHTTP(w, r) across all 15 e2e test files. Tests now exercise
the complete chi middleware chain including postFormToQueryParams,
checkRequiredParameters, authenticate, UpdateLastAccessMiddleware,
getPlayer, and sendResponse/sendError serialization.
New helpers (doReq, doReqWithUser, doRawReq, buildReq, parseJSONResponse)
use plaintext password auth and JSON response format. Old helpers that
injected context directly (newReq, newReqWithUser, newRawReq) are removed.
Sharing tests now set conf.Server.EnableSharing before router creation to
ensure sharing routes are registered.
---------
Signed-off-by: Deluan <deluan@navidrome.org>
2026-02-09 04:24:37 -09:00
|
|
|
})
|
|
|
|
|
})
|