diff options
author | antirez <antirez@gmail.com> | 2014-02-25 14:33:44 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2014-02-25 14:33:44 +0100 |
commit | fef88681f287ddbd54123d581d02d59771e57311 (patch) | |
tree | 9cd7d8b62a65f54bb54af0b7cee65a599083319e /tests | |
parent | a2c76ffb1c307e0d77a46d8e9e104778d4b8c626 (diff) | |
download | redis-fef88681f287ddbd54123d581d02d59771e57311.tar.gz |
Sentinel test: kill masters instead of using DEBUG SLEEP in all tests.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/sentinel-tests/00-base.tcl | 14 | ||||
-rw-r--r-- | tests/sentinel-tests/01-conf-update.tcl | 3 |
2 files changed, 12 insertions, 5 deletions
diff --git a/tests/sentinel-tests/00-base.tcl b/tests/sentinel-tests/00-base.tcl index dd8771466..74308b775 100644 --- a/tests/sentinel-tests/00-base.tcl +++ b/tests/sentinel-tests/00-base.tcl @@ -6,7 +6,7 @@ test "Basic failover works if the master is down" { set old_port [RI $master_id tcp_port] set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] assert {[lindex $addr 1] == $old_port} - R $master_id debug sleep 10 + kill_instance redis $master_id foreach_sentinel_id id { wait_for_condition 100 50 { [lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port @@ -14,6 +14,7 @@ test "Basic failover works if the master is down" { fail "At least one Sentinel did not received failover info" } } + restart_instance redis $master_id set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] set master_id [get_instance_id_by_port redis [lindex $addr 1]] } @@ -49,11 +50,12 @@ test "ODOWN is not possible without N (quorum) Sentinels reports" { set old_port [RI $master_id tcp_port] set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] assert {[lindex $addr 1] == $old_port} - R $master_id debug sleep 10 + kill_instance redis $master_id # Make sure failover did not happened. set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] assert {[lindex $addr 1] == $old_port} + restart_instance redis $master_id } test "Failover is not possible without majority agreement" { @@ -66,11 +68,13 @@ test "Failover is not possible without majority agreement" { kill_instance sentinel $id } - R $master_id debug sleep 10 + # Kill the current master + kill_instance redis $master_id # Make sure failover did not happened. set addr [S $quorum SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] assert {[lindex $addr 1] == $old_port} + restart_instance redis $master_id # Cleanup: restart Sentinels to monitor the master. for {set id 0} {$id < $quorum} {incr id} { @@ -92,7 +96,8 @@ test "Failover works if we configure for absolute agreement" { } } - R $master_id debug sleep 10 + kill_instance redis $master_id + foreach_sentinel_id id { wait_for_condition 1000 50 { [lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port @@ -100,6 +105,7 @@ test "Failover works if we configure for absolute agreement" { fail "At least one Sentinel did not received failover info" } } + restart_instance redis $master_id set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] set master_id [get_instance_id_by_port redis [lindex $addr 1]] diff --git a/tests/sentinel-tests/01-conf-update.tcl b/tests/sentinel-tests/01-conf-update.tcl index 7f3d1c366..3cf26926e 100644 --- a/tests/sentinel-tests/01-conf-update.tcl +++ b/tests/sentinel-tests/01-conf-update.tcl @@ -10,7 +10,7 @@ test "We can failover with Sentinel 1 crashed" { # Crash Sentinel 1 kill_instance sentinel 1 - R $master_id debug sleep 10 + kill_instance redis $master_id foreach_sentinel_id id { if {$id != 1} { wait_for_condition 1000 50 { @@ -20,6 +20,7 @@ test "We can failover with Sentinel 1 crashed" { } } } + restart_instance redis $master_id set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] set master_id [get_instance_id_by_port redis [lindex $addr 1]] } |