summaryrefslogtreecommitdiff
path: root/workhorse/internal/redis/keywatcher_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'workhorse/internal/redis/keywatcher_test.go')
-rw-r--r--workhorse/internal/redis/keywatcher_test.go12
1 files changed, 2 insertions, 10 deletions
diff --git a/workhorse/internal/redis/keywatcher_test.go b/workhorse/internal/redis/keywatcher_test.go
index 99892bc64b8..7ff5f8204c0 100644
--- a/workhorse/internal/redis/keywatcher_test.go
+++ b/workhorse/internal/redis/keywatcher_test.go
@@ -180,11 +180,7 @@ func TestShutdown(t *testing.T) {
}()
go func() {
- for countWatchers(runnerKey) == 0 {
- time.Sleep(time.Millisecond)
- }
-
- require.Equal(t, 1, countWatchers(runnerKey))
+ require.Eventually(t, func() bool { return countWatchers(runnerKey) == 1 }, 10*time.Second, time.Millisecond)
Shutdown()
wg.Done()
@@ -192,11 +188,7 @@ func TestShutdown(t *testing.T) {
wg.Wait()
- for countWatchers(runnerKey) == 1 {
- time.Sleep(time.Millisecond)
- }
-
- require.Equal(t, 0, countWatchers(runnerKey))
+ require.Eventually(t, func() bool { return countWatchers(runnerKey) == 0 }, 10*time.Second, time.Millisecond)
// Adding a key after the shutdown should result in an immediate response
var val WatchKeyStatus