navidrome/server
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
..
backgrounds feat(ui): use webp for login backgrounds 2025-03-06 23:32:52 -05:00
e2e test(subsonic): add comprehensive e2e test suite for Subsonic API (#5003) 2026-02-09 08:24:37 -05:00
events feat: Multi-library support (#4181) 2025-07-18 18:41:12 -04:00
nativeapi refactor: run Go modernize (#5002) 2026-02-08 09:57:30 -05:00
public fix: don't expose JWT-related errors (#4892) 2026-01-16 06:20:10 -05:00
subsonic fix(subsonic): validate JSONP callback parameter 2026-02-08 10:33:46 -05:00
testdata fix(server): improve error message for encrypted TLS private keys (#4742) 2025-11-28 17:08:34 -05:00
auth.go refactor: run Go modernize (#5002) 2026-02-08 09:57:30 -05:00
auth_test.go refactor: run Go modernize (#5002) 2026-02-08 09:57:30 -05:00
initial_setup.go chore(server): add logs to begin/end transaction 2025-02-24 19:13:42 -05:00
initial_setup_test.go Upgrade Ginkgo to V2 2022-07-26 16:53:17 -04:00
middlewares.go refactor: run Go modernize (#5002) 2026-02-08 09:57:30 -05:00
middlewares_test.go feat(ui): show user's lastAccess (#3342) 2024-09-30 20:46:10 -04:00
serve_index.go refactor: run Go modernize (#5002) 2026-02-08 09:57:30 -05:00
serve_index_test.go feat(ui): implement new event stream connection logic 2025-06-29 10:18:05 -04:00
server.go refactor: run Go modernize (#5002) 2026-02-08 09:57:30 -05:00
server_suite_test.go Rename log.LevelCritical to log.LevelFatal 2022-12-21 14:53:36 -05:00
server_test.go feat(plugins): New Plugin System with multi-language PDK support (#4833) 2026-01-14 19:22:48 -05:00