From 6e4569f91612345a628280b4f1376508aa872caa Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Wed, 25 Feb 2026 11:04:57 +0100 Subject: [PATCH] notifications: fix test race --- notifications/manager_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/notifications/manager_test.go b/notifications/manager_test.go index 6f94a5a0..19da9c16 100644 --- a/notifications/manager_test.go +++ b/notifications/manager_test.go @@ -133,11 +133,13 @@ func TestManager_ReservationNotification(t *testing.T) { require.NoError(t, err) }() - // Wait a bit to ensure manager is running and has subscribed + // Wait a bit to ensure manager is running and has subscribed to the + // server notifications stream. require.Eventually(t, func() bool { - mgr.Lock() - defer mgr.Unlock() - return len(mgr.subscribers[NotificationTypeReservation]) > 0 + mockClient.Lock() + defer mockClient.Unlock() + + return mockClient.timesCalled > 0 }, time.Second*5, 10*time.Millisecond) mockClient.Lock()