summaryrefslogtreecommitdiff
path: root/tests/unit/moduleapi/propagate.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/moduleapi/propagate.tcl')
-rw-r--r--tests/unit/moduleapi/propagate.tcl114
1 files changed, 96 insertions, 18 deletions
diff --git a/tests/unit/moduleapi/propagate.tcl b/tests/unit/moduleapi/propagate.tcl
index aa0f55e5e..adebd37a6 100644
--- a/tests/unit/moduleapi/propagate.tcl
+++ b/tests/unit/moduleapi/propagate.tcl
@@ -14,25 +14,103 @@ tags "modules" {
# Start the replication process...
$replica replicaof $master_host $master_port
wait_for_sync $replica
-
after 1000
- $master propagate-test
- wait_for_condition 5000 10 {
- ([$replica get timer] eq "10") && \
- ([$replica get a-from-thread] eq "10")
- } else {
- fail "The two counters don't match the expected value."
+ test {module propagates from timer} {
+ set repl [attach_to_replication_stream]
+
+ $master propagate-test.timer
+
+ wait_for_condition 5000 10 {
+ [$replica get timer] eq "3"
+ } else {
+ fail "The two counters don't match the expected value."
+ }
+
+ assert_replication_stream $repl {
+ {select *}
+ {multi}
+ {incr timer}
+ {exec}
+ {multi}
+ {incr timer}
+ {exec}
+ {multi}
+ {incr timer}
+ {exec}
+ }
+ close_replication_stream $repl
}
- $master propagate-test-2
- $master propagate-test-3
- $master multi
- $master propagate-test-2
- $master propagate-test-3
- $master exec
- wait_for_ofs_sync $master $replica
+ test {module propagates from thread} {
+ set repl [attach_to_replication_stream]
+
+ $master propagate-test.thread
+
+ wait_for_condition 5000 10 {
+ [$replica get a-from-thread] eq "3"
+ } else {
+ fail "The two counters don't match the expected value."
+ }
+
+ assert_replication_stream $repl {
+ {select *}
+ {incr a-from-thread}
+ {incr b-from-thread}
+ {incr a-from-thread}
+ {incr b-from-thread}
+ {incr a-from-thread}
+ {incr b-from-thread}
+ }
+ close_replication_stream $repl
+ }
+ test {module propagates from from command} {
+ set repl [attach_to_replication_stream]
+
+ $master propagate-test.simple
+ $master propagate-test.mixed
+
+ # Note the 'after-call' propagation below is out of order (known limitation)
+ assert_replication_stream $repl {
+ {select *}
+ {multi}
+ {incr counter-1}
+ {incr counter-2}
+ {exec}
+ {multi}
+ {incr using-call}
+ {incr after-call}
+ {incr counter-1}
+ {incr counter-2}
+ {exec}
+ }
+ close_replication_stream $repl
+ }
+
+ test {module propagates from from multi-exec} {
+ set repl [attach_to_replication_stream]
+
+ $master multi
+ $master propagate-test.simple
+ $master propagate-test.mixed
+ $master exec
+ wait_for_ofs_sync $master $replica
+
+ # Note the 'after-call' propagation below is out of order (known limitation)
+ assert_replication_stream $repl {
+ {select *}
+ {multi}
+ {incr counter-1}
+ {incr counter-2}
+ {incr using-call}
+ {incr after-call}
+ {incr counter-1}
+ {incr counter-2}
+ {exec}
+ }
+ close_replication_stream $repl
+ }
assert_equal [s -1 unexpected_error_replies] 0
}
}
@@ -47,11 +125,11 @@ tags "modules aof" {
r config set auto-aof-rewrite-percentage 0 ; # Disable auto-rewrite.
waitForBgrewriteaof r
- r propagate-test-2
- r propagate-test-3
+ r propagate-test.simple
+ r propagate-test.mixed
r multi
- r propagate-test-2
- r propagate-test-3
+ r propagate-test.simple
+ r propagate-test.mixed
r exec
# Load the AOF