summaryrefslogtreecommitdiff
path: root/tests/unit/scripting.tcl
diff options
context:
space:
mode:
authorRaghav Muddur <r@nmvk.com>2021-05-12 21:07:34 -0700
committerGitHub <noreply@github.com>2021-05-12 21:07:34 -0700
commit31edc22ecc6f21ab53dd6254b135fbfd5be23e2c (patch)
tree47862126e19890bfb8837fc862434cec19d68e4a /tests/unit/scripting.tcl
parente01c92a5ef6127067922f74cd8dac2ba72a1ad52 (diff)
downloadredis-31edc22ecc6f21ab53dd6254b135fbfd5be23e2c.tar.gz
EVALSHA_RO and EVAL_RO Commands (#8820)
* EVALSHA_RO and EVAL_RO Commands Added new readonly versions of EVAL and EVALSHA.
Diffstat (limited to 'tests/unit/scripting.tcl')
-rw-r--r--tests/unit/scripting.tcl11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/unit/scripting.tcl b/tests/unit/scripting.tcl
index 0efe34cad..d5c876f3d 100644
--- a/tests/unit/scripting.tcl
+++ b/tests/unit/scripting.tcl
@@ -320,6 +320,17 @@ start_server {tags {"scripting"}} {
r eval {return 'hello' --trailing comment} 0
} {hello}
+ 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
+ } {*Write commands are not allowed from read-only scripts*}
+
test {SCRIPTING FLUSH - is able to clear the scripts cache?} {
r set mykey myval
set v [r evalsha fd758d1589d044dd850a6f05d52f2eefd27f033f 1 mykey]