summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2012-11-17 12:09:17 +0100
committerantirez <antirez@gmail.com>2012-11-22 10:36:32 +0100
commit52bd3d8a39825d4c7a19a8c248a0889c09c9dd75 (patch)
tree4ade62928fc2fb1869c68df69fb48872b8c3f41c
parent37d978d9b46c0572d0aa0a3ae72fa684c0eccd0a (diff)
downloadredis-52bd3d8a39825d4c7a19a8c248a0889c09c9dd75.tar.gz
Test: make sure EXEC fails after previous transaction errors.
-rw-r--r--tests/unit/multi.tcl28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/unit/multi.tcl b/tests/unit/multi.tcl
index 9069b95be..f8d42d4c7 100644
--- a/tests/unit/multi.tcl
+++ b/tests/unit/multi.tcl
@@ -46,6 +46,34 @@ start_server {tags {"multi"}} {
set _ $err
} {*ERR WATCH*}
+ test {EXEC fails if there are errors while queueing commands #1} {
+ r del foo1 foo2
+ r multi
+ r set foo1 bar1
+ catch {r non-existing-command}
+ r set foo2 bar2
+ catch {r exec} e
+ assert_match {EXECABORT*} $e
+ list [r exists foo1] [r exists foo2]
+ } {0 0}
+
+ test {EXEC fails if there are errors while queueing commands #2} {
+ set rd [redis_deferring_client]
+ r del foo1 foo2
+ r multi
+ r set foo1 bar1
+ $rd config set maxmemory 1
+ catch {r lpush mylist myvalue}
+ $rd config set maxmemory 0
+ r set foo2 bar2
+ catch {r exec} e
+ assert_match {EXECABORT*} $e
+ assert {[$rd read] eq {OK}}
+ assert {[$rd read] eq {OK}}
+ $rd close
+ list [r exists foo1] [r exists foo2]
+ } {0 0}
+
test {EXEC works on WATCHed key not modified} {
r watch x y z
r watch k