Skip to content

🎧 Your Personal Streaming Service

fix: prevent data race on conf.Server during cleanup in e2e tests

Deluane05a7e230f7a
diff --git a/server/e2e/e2e_suite_test.go b/server/e2e/e2e_suite_test.go
index e658d1fd2..479f9c680 100644
--- a/server/e2e/e2e_suite_test.go
+++ b/server/e2e/e2e_suite_test.go
@@ -318,6 +318,11 @@ func setupTestDB() {
ctx = request.WithUser(GinkgoT().Context(), adminUser)
DeferCleanup(configtest.SetupConfig())
+ DeferCleanup(func() {
+ // Wait for any background scan (e.g. from startScan endpoint) to finish
+ // before config cleanup runs, to avoid a data race on conf.Server.
+ Eventually(scanner.IsScanning).Should(BeFalse())
+ })
conf.Server.MusicFolder = "fake:///music"
conf.Server.DevExternalScanner = false