1
0
mirror of https://github.com/fluencelabs/redis synced 2025-07-31 08:22:01 +00:00
Files
deps
src
tests
assets
cluster
helpers
integration
sentinel
support
tmp
unit
type
aofrw.tcl
auth.tcl
bitfield.tcl
bitops.tcl
dump.tcl
expire.tcl
geo.tcl
hyperloglog.tcl
introspection-2.tcl
introspection.tcl
keyspace.tcl
latency-monitor.tcl
lazyfree.tcl
limits.tcl
maxmemory.tcl
memefficiency.tcl
multi.tcl
obuf-limits.tcl
other.tcl
printver.tcl
protocol.tcl
pubsub.tcl
quit.tcl
scan.tcl
scripting.tcl
slowlog.tcl
sort.tcl
wait.tcl
instances.tcl
test_helper.tcl
utils
.gitignore
00-RELEASENOTES
BUGS
CONTRIBUTING
COPYING
INSTALL
MANIFESTO
Makefile
README.md
redis.conf
runtest
runtest-cluster
runtest-sentinel
sentinel.conf
redis/tests/unit/wait.tcl

43 lines
1.3 KiB
Tcl
Raw Normal View History

start_server {tags {"wait"}} {
start_server {} {
set slave [srv 0 client]
set slave_host [srv 0 host]
set slave_port [srv 0 port]
set master [srv -1 client]
set master_host [srv -1 host]
set master_port [srv -1 port]
test {Setup slave} {
$slave slaveof $master_host $master_port
wait_for_condition 50 100 {
[s 0 master_link_status] eq {up}
} else {
fail "Replication not started."
}
}
test {WAIT should acknowledge 1 additional copy of the data} {
$master set foo 0
$master incr foo
$master incr foo
$master incr foo
assert {[$master wait 1 5000] == 1}
assert {[$slave get foo] == 3}
}
test {WAIT should not acknowledge 2 additional copies of the data} {
$master incr foo
assert {[$master wait 2 1000] <= 1}
}
test {WAIT should not acknowledge 1 additional copy if slave is blocked} {
exec src/redis-cli -h $slave_host -p $slave_port debug sleep 5 > /dev/null 2> /dev/null &
after 1000 ;# Give redis-cli the time to execute the command.
$master set foo 0
$master incr foo
$master incr foo
$master incr foo
assert {[$master wait 1 3000] == 0}
}
}}