notifications: fix test race

This commit is contained in:
Slyghtning 2026-02-25 11:04:57 +01:00
parent f47b611557
commit 6e4569f916
No known key found for this signature in database
GPG key ID: F82D456EA023C9BF

View file

@ -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()