This is an automated email from the ASF dual-hosted git repository.
tison pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/incubator-kvrocks.git
The following commit(s) were added to refs/heads/unstable by this push:
new 6f2def24 Fix the script load should return SHA as the bulk string
(#1133)
6f2def24 is described below
commit 6f2def24c6043c51415dcef75d3c385748a3d471
Author: hulk <[email protected]>
AuthorDate: Wed Nov 23 23:53:16 2022 +0800
Fix the script load should return SHA as the bulk string (#1133)
---
src/commands/redis_cmd.cc | 2 +-
tests/gocase/unit/scripting/scripting_test.go | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/commands/redis_cmd.cc b/src/commands/redis_cmd.cc
index 81d2fb8f..a0dee16d 100644
--- a/src/commands/redis_cmd.cc
+++ b/src/commands/redis_cmd.cc
@@ -5033,7 +5033,7 @@ class CommandScript : public Commander {
if (!s.IsOK()) {
return s;
}
- *output = Redis::SimpleString(sha);
+ *output = Redis::BulkString(sha);
} else {
return Status(Status::NotOK, "Unknown SCRIPT subcommand or wrong # of
args");
}
diff --git a/tests/gocase/unit/scripting/scripting_test.go
b/tests/gocase/unit/scripting/scripting_test.go
index 90e774e4..984f6cbd 100644
--- a/tests/gocase/unit/scripting/scripting_test.go
+++ b/tests/gocase/unit/scripting/scripting_test.go
@@ -366,6 +366,14 @@ assert(bit.bor(1,2,4,8,16,32,64,128) == 255)
require.Equal(t, []bool{true, false}, r2.Val())
})
+ t.Run("SCRIPT LOAD - should return SHA as the bulk string", func(t
*testing.T) {
+ c := srv.NewTCPClient()
+ defer func() { require.NoError(t, c.Close()) }()
+ require.NoError(t, c.WriteArgs("script", "load", "return 'bulk
string'"))
+ c.MustRead(t, "$40")
+ c.MustRead(t, "04b85c6fe6dbd424de3fb5914509afa7597570f2")
+ })
+
t.Run("SCRIPT LOAD - is able to register scripts in the scripting
cache", func(t *testing.T) {
r1 := rdb.ScriptLoad(ctx, "return 'loaded'")
require.NoError(t, r1.Err())