2010-07-06 11:24:00 -04:00
|
|
|
start_server {tags {"repl"}} {
|
|
|
|
start_server {} {
|
|
|
|
test {First server should have role slave after SLAVEOF} {
|
|
|
|
r -1 slaveof [srv 0 host] [srv 0 port]
|
|
|
|
after 1000
|
|
|
|
s -1 role
|
|
|
|
} {slave}
|
|
|
|
|
2011-06-20 11:07:18 -04:00
|
|
|
test {BRPOPLPUSH replication, when blocking against empty list} {
|
|
|
|
set rd [redis_deferring_client]
|
|
|
|
$rd brpoplpush a b 5
|
|
|
|
r lpush a foo
|
|
|
|
after 1000
|
|
|
|
assert_equal [r debug digest] [r -1 debug digest]
|
|
|
|
}
|
|
|
|
|
|
|
|
test {BRPOPLPUSH replication, list exists} {
|
|
|
|
set rd [redis_deferring_client]
|
|
|
|
r lpush c 1
|
|
|
|
r lpush c 2
|
|
|
|
r lpush c 3
|
|
|
|
$rd brpoplpush c d 5
|
|
|
|
after 1000
|
|
|
|
assert_equal [r debug digest] [r -1 debug digest]
|
|
|
|
}
|
2010-07-06 11:24:00 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-02 17:14:55 -04:00
|
|
|
start_server {tags {"repl"}} {
|
2010-05-14 14:50:58 -04:00
|
|
|
r set mykey foo
|
|
|
|
|
2010-06-02 16:23:52 -04:00
|
|
|
start_server {} {
|
2010-05-14 14:50:58 -04:00
|
|
|
test {Second server should have role master at first} {
|
|
|
|
s role
|
|
|
|
} {master}
|
|
|
|
|
|
|
|
test {SLAVEOF should start with link status "down"} {
|
|
|
|
r slaveof [srv -1 host] [srv -1 port]
|
|
|
|
s master_link_status
|
|
|
|
} {down}
|
|
|
|
|
|
|
|
test {The role should immediately be changed to "slave"} {
|
|
|
|
s role
|
|
|
|
} {slave}
|
|
|
|
|
|
|
|
wait_for_sync r
|
|
|
|
test {Sync should have transferred keys from master} {
|
|
|
|
r get mykey
|
|
|
|
} {foo}
|
|
|
|
|
|
|
|
test {The link status should be up} {
|
|
|
|
s master_link_status
|
|
|
|
} {up}
|
|
|
|
|
|
|
|
test {SET on the master should immediately propagate} {
|
|
|
|
r -1 set mykey bar
|
2011-07-11 07:41:06 -04:00
|
|
|
if {$::valgrind} {after 2000}
|
2010-05-14 14:50:58 -04:00
|
|
|
r 0 get mykey
|
|
|
|
} {bar}
|
2011-10-17 04:40:11 -04:00
|
|
|
|
|
|
|
test {FLUSHALL should replicate} {
|
|
|
|
r -1 flushall
|
|
|
|
if {$::valgrind} {after 2000}
|
|
|
|
list [r -1 dbsize] [r 0 dbsize]
|
|
|
|
} {0 0}
|
2010-05-14 14:50:58 -04:00
|
|
|
}
|
|
|
|
}
|