summaryrefslogtreecommitdiff
path: root/tests/unit/scripting.tcl
diff options
context:
space:
mode:
authorMeir Shpilraien (Spielrein) <meir@redis.com>2022-01-03 19:04:29 +0200
committerGitHub <noreply@github.com>2022-01-03 19:04:29 +0200
commit78a62c012438a8ae23161f6cfef8159e3a254524 (patch)
treea5e581edb68556e2f59408d11f6ba2af19fda64f /tests/unit/scripting.tcl
parent5460c100471fda537468d1f1fa43258638c8a1ce (diff)
downloadredis-78a62c012438a8ae23161f6cfef8159e3a254524.tar.gz
Fix OOM error not raised of functions (#10048)
OOM Error did not raise on functions due to a bug. Added test to verify the fix.
Diffstat (limited to 'tests/unit/scripting.tcl')
-rw-r--r--tests/unit/scripting.tcl14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/unit/scripting.tcl b/tests/unit/scripting.tcl
index 0b5b261f2..970cab992 100644
--- a/tests/unit/scripting.tcl
+++ b/tests/unit/scripting.tcl
@@ -36,6 +36,20 @@ if {$is_eval == 1} {
start_server {tags {"scripting"}} {
+ test {Script - disallow write on OOM} {
+ r FUNCTION create lua f1 replace { return redis.call('set', 'x', '1') }
+
+ r config set maxmemory 1
+
+ catch {[r fcall f1 1 k]} e
+ assert_match {*command not allowed when used memory*} $e
+
+ catch {[r eval "redis.call('set', 'x', 1)" 0]} e
+ assert_match {*command not allowed when used memory*} $e
+
+ r config set maxmemory 0
+ }
+
test {EVAL - Does Lua interpreter replies to our requests?} {
run_script {return 'hello'} 0
} {hello}