PSYNC2 test: check ability to resync after restart.

This commit is contained in:
antirez 2016-11-29 11:15:12 +01:00
parent 93c5198c17
commit ce1f9cf81d

View File

@ -1,4 +1,4 @@
start_server {tags {"wait"}} {
start_server {tags {"psync2"}} {
start_server {} {
start_server {} {
start_server {} {
@ -141,6 +141,40 @@ start_server {} {
}
}
test "PSYNC2: Bring the master back again for next test" {
$R($master_id) slaveof no one
set master_host $R_host($master_id)
set master_port $R_port($master_id)
for {set j 0} {$j < 5} {incr j} {
if {$j == $master_id} continue
$R($j) slaveof $master_host $master_port
}
# Wait for slaves to sync
wait_for_condition 50 1000 {
[status $R($master_id) connected_slaves] == 4
} else {
fail "Slave not reconnecting"
}
}
test "PSYNC2: Partial resync after restart using RDB aux fields" {
# Pick a random slave
set slave_id [expr {($master_id+1)%5}]
set sync_count [status $R($master_id) sync_full]
catch {
$R($slave_id) config rewrite
$R($slave_id) debug restart
}
wait_for_condition 50 1000 {
[status $R($master_id) connected_slaves] == 4
} else {
fail "Slave not reconnecting"
}
set new_sync_count [status $R($master_id) sync_full]
assert {$sync_count == $new_sync_count}
}
if {$no_exit} {
while 1 { puts -nonewline .; flush stdout; after 1000}
}