Skip to content

Commit ca6200f

Browse files
committed
notifications: fix test race
1 parent 375cf47 commit ca6200f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

notifications/manager_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,11 @@ func TestManager_ReservationNotification(t *testing.T) {
140140
return len(mgr.subscribers[NotificationTypeReservation]) > 0
141141
}, time.Second*5, 10*time.Millisecond)
142142

143-
mockClient.Lock()
144-
require.Equal(t, 1, mockClient.timesCalled)
145-
mockClient.Unlock()
143+
require.Eventually(t, func() bool {
144+
mockClient.Lock()
145+
defer mockClient.Unlock()
146+
return mockClient.timesCalled == 1
147+
}, time.Second*5, 10*time.Millisecond)
146148

147149
// Send a test notification
148150
testNotif := getTestNotification(testReservationId)

0 commit comments

Comments
 (0)