-
Notifications
You must be signed in to change notification settings - Fork 2
Add timeout for redis key deletion check #268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ package adapter | |
| import ( | ||
| "context" | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/redis/go-redis/v9" | ||
| "github.com/stretchr/testify/assert" | ||
|
|
@@ -67,9 +68,10 @@ func TestRedis_follower_redirect_node_set_get_deleted(t *testing.T) { | |
| assert.NoError(t, res3.Err()) | ||
| assert.Equal(t, int64(1), res3.Val()) | ||
|
|
||
| res4 := rdb.Get(ctx, string(key)) | ||
| assert.Equal(t, redis.Nil, res4.Err()) | ||
| assert.Equal(t, "", res4.Val()) | ||
| assert.Eventually(t, func() bool { | ||
| res4 := rdb.Get(ctx, string(key)) | ||
| return res4.Err() == redis.Nil && res4.Val() == "" | ||
| }, 2*time.Second, 50*time.Millisecond) | ||
|
Comment on lines
+71
to
+74
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using This makes their purpose clearer and simplifies future modifications. You could define them at the top of the test function, for example: const (
replicationTimeout = 2 * time.Second
checkInterval = 50 * time.Millisecond
)Then, you can use these constants in the |
||
| } | ||
|
|
||
| func TestRedis_leader_keys(t *testing.T) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error (errorlint)