diff options
Diffstat (limited to 'tests/unit/wait.tcl')
-rw-r--r-- | tests/unit/wait.tcl | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/unit/wait.tcl b/tests/unit/wait.tcl index b1500cff8..0a4965c20 100644 --- a/tests/unit/wait.tcl +++ b/tests/unit/wait.tcl @@ -5,6 +5,7 @@ start_server {} { set slave [srv 0 client] set slave_host [srv 0 host] set slave_port [srv 0 port] + set slave_pid [srv 0 pid] set master [srv -1 client] set master_host [srv -1 host] set master_port [srv -1 port] @@ -33,13 +34,25 @@ start_server {} { } test {WAIT should not acknowledge 1 additional copy if slave is blocked} { - set cmd [rediscli $slave_host $slave_port "debug sleep 5"] - exec {*}$cmd > /dev/null 2> /dev/null & - after 1000 ;# Give redis-cli the time to execute the command. + exec kill -SIGSTOP $slave_pid $master set foo 0 $master incr foo $master incr foo $master incr foo - assert {[$master wait 1 3000] == 0} + assert {[$master wait 1 1000] == 0} + exec kill -SIGCONT $slave_pid + assert {[$master wait 1 1000] == 1} + } + + test {WAIT implicitly blocks on client pause since ACKs aren't sent} { + exec kill -SIGSTOP $slave_pid + $master multi + $master incr foo + $master client pause 10000 write + $master exec + assert {[$master wait 1 1000] == 0} + $master client unpause + exec kill -SIGCONT $slave_pid + assert {[$master wait 1 1000] == 1} } }} |