From c48355e920f6387b85cf9d46bf40f00d4cd46f5d Mon Sep 17 00:00:00 2001 From: antirez Date: Fri, 18 Dec 2015 11:33:49 +0100 Subject: [PATCH] Cluster: verify slaves consistency after resharding. --- tests/cluster/tests/04-resharding.tcl | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/cluster/tests/04-resharding.tcl b/tests/cluster/tests/04-resharding.tcl index a719a0bf..42541609 100644 --- a/tests/cluster/tests/04-resharding.tcl +++ b/tests/cluster/tests/04-resharding.tcl @@ -142,3 +142,26 @@ test "Disable AOF in all the instances" { R $id config set appendonly no } } + +test "Verify slaves consistency" { + set verified_masters 0 + foreach_redis_id id { + set role [R $id role] + lassign $role myrole myoffset slaves + if {$myrole eq {slave}} continue + set masterport [get_instance_attrib redis $id port] + set masterdigest [R $id debug digest] + foreach_redis_id sid { + set srole [R $sid role] + if {[lindex $srole 0] eq {master}} continue + if {[lindex $srole 2] != $masterport} continue + wait_for_condition 1000 500 { + [R $sid debug digest] eq $masterdigest + } else { + fail "Master and slave data digest are different" + } + incr verified_masters + } + } + assert {$verified_masters >= 5} +}