From 136537dcb06ec19fe62c4c7c13e17cbf7fad867a Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 18 Feb 2014 17:03:56 +0100 Subject: [PATCH] Sentinel test: check reconfig of slaves and old master. --- tests/sentinel-tests/00-base.tcl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/sentinel-tests/00-base.tcl b/tests/sentinel-tests/00-base.tcl index 0b70cc26..aec344b1 100644 --- a/tests/sentinel-tests/00-base.tcl +++ b/tests/sentinel-tests/00-base.tcl @@ -72,3 +72,23 @@ test "Basic failover works if the master is down" { test "New master [join $addr {:}] role matches" { assert {[RI $master_id role] eq {master}} } + +test "All the other slaves now point to the new master" { + foreach_redis_id id { + if {$id != $master_id && $id != 0} { + wait_for_condition 1000 50 { + [RI $id master_port] == [lindex $addr 1] + } else { + fail "Redis ID $id not configured to replicate with new master" + } + } + } +} + +test "The old master eventually gets reconfigured as a slave" { + wait_for_condition 1000 50 { + [RI 0 master_port] == [lindex $addr 1] + } else { + fail "Old master not reconfigured as slave of new master" + } +}