summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2013-03-27 11:31:27 +0100
committerantirez <antirez@gmail.com>2013-03-27 11:44:50 +0100
commit252cf3052dedbfd7a74d076898762e8ad0f265a0 (patch)
tree1fb6f90db9f246ad990d789897fdfcf4bc2bba4a
parent40b692e82275ae5a17b23c2ddd74b9b2edd69c25 (diff)
downloadredis-252cf3052dedbfd7a74d076898762e8ad0f265a0.tar.gz
Test: test replication of MULTI/EXEC.
-rw-r--r--tests/unit/multi.tcl54
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/unit/multi.tcl b/tests/unit/multi.tcl
index 798f589b0..6655bf62c 100644
--- a/tests/unit/multi.tcl
+++ b/tests/unit/multi.tcl
@@ -252,4 +252,58 @@ start_server {tags {"multi"}} {
r incr x
r exec
} {11}
+
+ test {MULTI / EXEC is propagated correctly (single write command)} {
+ set repl [attach_to_replication_stream]
+ r multi
+ r set foo bar
+ r exec
+ assert_replication_stream $repl {
+ {select *}
+ {multi}
+ {set foo bar}
+ {exec}
+ }
+ close_replication_stream $repl
+ }
+
+ test {MULTI / EXEC is propagated correctly (empty transaction)} {
+ set repl [attach_to_replication_stream]
+ r multi
+ r exec
+ r set foo bar
+ assert_replication_stream $repl {
+ {select *}
+ {set foo bar}
+ }
+ close_replication_stream $repl
+ }
+
+ test {MULTI / EXEC is propagated correctly (read-only commands)} {
+ r set foo value1
+ set repl [attach_to_replication_stream]
+ r multi
+ r get foo
+ r exec
+ r set foo value2
+ assert_replication_stream $repl {
+ {select *}
+ {set foo value2}
+ }
+ close_replication_stream $repl
+ }
+
+ test {MULTI / EXEC is propagated correctly (write command, no effect)} {
+ r del bar foo bar
+ set repl [attach_to_replication_stream]
+ r multi
+ r del foo
+ r exec
+ assert_replication_stream $repl {
+ {select *}
+ {multi}
+ {exec}
+ }
+ close_replication_stream $repl
+ }
}