-
Notifications
You must be signed in to change notification settings - Fork 591
feat(digest): implement DIGEST command #3313
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
base: unstable
Are you sure you want to change the base?
Changes from 1 commit
fdad4ab
e03b477
624ce78
db10ddd
ec7052e
b9e603c
302b8d0
02670d7
928dcf6
20974ca
694b53a
d1120f8
2226341
8623728
c9e1744
0c93d42
0c3f318
d5da219
d2618f3
c7a99dd
ca1dbdb
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 | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,158 @@ | ||||||
| package string | ||||||
|
|
||||||
| import ( | ||||||
| "context" | ||||||
| "testing" | ||||||
|
|
||||||
| "github.com/stretchr/testify/require" | ||||||
|
|
||||||
| "github.com/apache/kvrocks/tests/gocase/util" | ||||||
| ) | ||||||
|
|
||||||
| func TestDigest(t *testing.T) { | ||||||
| srv := util.StartServer(t, map[string]string{}) | ||||||
| defer srv.Close() | ||||||
| ctx := context.Background() | ||||||
| rdb := srv.NewClient() | ||||||
| defer func() { require.NoError(t, rdb.Close()) }() | ||||||
|
|
||||||
| t.Run("DIGEST with existing string key", func(t *testing.T) { | ||||||
| require.NoError(t, rdb.Set(ctx, "key1", "Hello world", 0).Err()) | ||||||
|
|
||||||
| // DIGEST should return hex hash | ||||||
| digest := rdb.Do(ctx, "DIGEST", "key1").Val() | ||||||
|
||||||
| digest := rdb.Do(ctx, "DIGEST", "key1").Val() | |
| digest := rdb.Do(ctx, "DIGEST", "key1").String() |
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.
Can use the
Stringto avoid the typecast. The same as other places.
Thanks for the suggestion, I will update other places.
Outdated
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.
please fill these expcted value..
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.
Thanks for the reminder, i 've already added.
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.
remove this pls.
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.
Done