navidrome/tests
Deluan Quintão 8319905d2c
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 08:24:37 -05:00
..
fixtures feat(agents): Add artist url and top and similar songs to ListenBrainz agent (#4934) 2026-02-07 13:20:42 -05:00
fake_http_client.go Retry calls to Last.FM without MBIDs when if returns artist invalid (#1138) 2021-05-27 20:53:24 -04:00
init_tests.go Allow configuring cache folder (#2357) 2023-06-02 17:14:11 -04:00
mock_album_repo.go fix(server): optimize search3 performance with multi-library (#4382) 2025-07-25 18:53:40 -04:00
mock_artist_repo.go fix(server): optimize search3 performance with multi-library (#4382) 2025-07-25 18:53:40 -04:00
mock_data_store.go test(subsonic): add comprehensive e2e test suite for Subsonic API (#5003) 2026-02-09 08:24:37 -05:00
mock_ffmpeg.go refactor(server): remove ffmpeg unused code 2024-10-20 19:35:16 -04:00
mock_genre_repo.go refactor: external_metadata -> external.Provider (#3903) 2025-04-08 21:11:09 -04:00
mock_library_repo.go refactor: run Go modernize (#5002) 2026-02-08 09:57:30 -05:00
mock_library_service.go feat(plugins): New Plugin System with multi-language PDK support (#4833) 2026-01-14 19:22:48 -05:00
mock_mediafile_repo.go refactor: run Go modernize (#5002) 2026-02-08 09:57:30 -05:00
mock_playlist_repo.go Add getShares and createShare Subsonic endpoints 2023-01-24 18:36:46 -05:00
mock_playqueue_repo.go feat(server): add update and clear play queue endpoints to native API (#4215) 2025-06-11 12:02:31 -04:00
mock_plugin_manager.go feat(plugins): add JSONForms-based plugin configuration UI (#4911) 2026-01-19 20:51:00 -05:00
mock_plugin_repo.go refactor: run Go modernize (#5002) 2026-02-08 09:57:30 -05:00
mock_property_repo.go refactor: external_metadata -> external.Provider (#3903) 2025-04-08 21:11:09 -04:00
mock_radio_repository.go refactor: external_metadata -> external.Provider (#3903) 2025-04-08 21:11:09 -04:00
mock_scanner.go feat(scanner): implement selective folder scanning and file system watcher improvements (#4674) 2025-11-14 22:15:43 -05:00
mock_scrobble_buffer_repo.go feat(ui): add EnableNowPlaying configuration (default true) (#4219) 2025-06-13 00:06:08 -04:00
mock_scrobble_repo.go feat(server): track scrobble/linstens history (#4770) 2025-12-06 11:07:18 -05:00
mock_share_repo.go refactor: run Go modernize (#5002) 2026-02-08 09:57:30 -05:00
mock_transcoding_repo.go Add global Downsampling feature (#1575) 2022-12-06 19:41:16 -05:00
mock_user_props_repo.go refactor: external_metadata -> external.Provider (#3903) 2025-04-08 21:11:09 -04:00
mock_user_repo.go refactor: run Go modernize (#5002) 2026-02-08 09:57:30 -05:00
mock_user_service.go feat(plugins): New Plugin System with multi-language PDK support (#4833) 2026-01-14 19:22:48 -05:00
navidrome-test.toml feat(plugins): experimental support for plugins (#3998) 2025-06-22 20:45:38 -04:00
test_helpers.go fix: album statistics not updating after deleting missing files (#4668) 2025-11-08 20:11:00 -05:00