You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by GitBox <gi...@apache.org> on 2022/08/27 08:34:40 UTC

[GitHub] [incubator-kvrocks] xiaobiaozhao commented on a diff in pull request #782: Add EVAL_RO

xiaobiaozhao commented on code in PR #782:
URL: https://github.com/apache/incubator-kvrocks/pull/782#discussion_r956556420


##########
tests/tcl/tests/unit/scripting.tcl:
##########
@@ -387,6 +387,17 @@ start_server {tags {"scripting"}} {
         set v [r eval { return redis.log(redis.LOG_WARNING, 'warning level'); } 0]
         assert_equal "" $v
     } {}
+
+    test {EVAL_RO - Successful case} {
+        r set foo bar
+        assert_equal bar [r eval_ro {return redis.call('get', KEYS[1]);} 1 foo]
+    }
+
+    test {EVAL_RO - Cannot run write commands} {
+        r set foo bar
+        catch {r eval_ro {redis.call('del', KEYS[1]);} 1 foo} e
+        set e
+    } {ERR Write commands are not allowed from read-only scripts*}

Review Comment:
   added



-- 
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: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org