Valay17 commented on code in PR #3317:
URL: https://github.com/apache/kvrocks/pull/3317#discussion_r2656010903
##########
tests/gocase/unit/type/strings/strings_test.go:
##########
@@ -277,6 +277,79 @@ func testString(t *testing.T, configs
util.KvrocksServerConfigs) {
require.Equal(t, "", rdb.GetDel(ctx, "foo").Val())
})
+ t.Run("DelEX command no args", func(t *testing.T) {
+ key := "test-string-key69"
+ value := "test-strings-value69"
+ require.NoError(t, rdb.Set(ctx, key, value, 0).Err())
+ require.Equal(t, value, rdb.Get(ctx, key).Val())
+
+ require.Equal(t, "1", rdb.Do(ctx, "DelEX", key).Val())
+ require.Equal(t, "", rdb.Get(ctx, key).Val())
+ //on same key
+ require.Error(t, rdb.Do(ctx, "DelEX", key).Err())
+ require.Equal(t, "0", rdb.Do(ctx, "DelEX",
"test-string-key69").Val())
+ //on non existent key
+ key := "random"
+ require.Equal(t, "", rdb.Get(ctx, key).Val())
+ require.Error(t, rdb.Do(ctx, "DelEX", key).Err())
+ require.Equal(t, "0", rdb.Do(ctx, "DelEX", "random").Val())
+ })
+
+ t.Run("DelEX command with args", func(t *testing.T) {
+ key := "test-string-key69"
+ value := "test-strings-value69"
+ require.NoError(t, rdb.Set(ctx, key, value, 0).Err())
+ require.Equal(t, value, rdb.Get(ctx, key).Val())
+
+ // More than 4 args
+ require.Error(t, rdb.Do(ctx, "DelEX", "test-string-key69",
"random", "random", "random").Err())
+ //Incorrect option
+ require.Error(t, rdb.Do(ctx, "DELEX", "test-string-key69",
"random", "random").Err())
+ //True cases for all options
+ //digest := rdb.Do(ctx, "DIGEST", value).Val().(string)
Review Comment:
It depends on the DIGEST command which is yet to be implemented in the issue
#3309 once that is done, just need to uncomment
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]