Skip to content

Commit 973ff8f

Browse files
committed
Add timeout for redis key deletion check
1 parent 6629c40 commit 973ff8f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

adapter/redis_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package adapter
33
import (
44
"context"
55
"testing"
6+
"time"
67

78
"github.com/redis/go-redis/v9"
89
"github.com/stretchr/testify/assert"
@@ -67,9 +68,10 @@ func TestRedis_follower_redirect_node_set_get_deleted(t *testing.T) {
6768
assert.NoError(t, res3.Err())
6869
assert.Equal(t, int64(1), res3.Val())
6970

70-
res4 := rdb.Get(ctx, string(key))
71-
assert.Equal(t, redis.Nil, res4.Err())
72-
assert.Equal(t, "", res4.Val())
71+
assert.Eventually(t, func() bool {
72+
res4 := rdb.Get(ctx, string(key))
73+
return res4.Err() == redis.Nil && res4.Val() == ""
74+
}, 2*time.Second, 50*time.Millisecond)
7375
}
7476

7577
func TestRedis_leader_keys(t *testing.T) {

0 commit comments

Comments
 (0)