From d06d8d6ffabf92914cb4f640ce3000a63d22c3ad Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 19 Jun 2014 15:56:28 +0200 Subject: [PATCH] Sentinel test: unit 02, avoid some time related false positives. --- tests/sentinel/tests/02-slaves-reconf.tcl | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/sentinel/tests/02-slaves-reconf.tcl b/tests/sentinel/tests/02-slaves-reconf.tcl index 868bae5e..fa15d2ef 100644 --- a/tests/sentinel/tests/02-slaves-reconf.tcl +++ b/tests/sentinel/tests/02-slaves-reconf.tcl @@ -7,7 +7,7 @@ source "../tests/includes/init-tests.tcl" -proc 03_test_slaves_replication {} { +proc 02_test_slaves_replication {} { uplevel 1 { test "Check that slaves replicate from current master" { set master_port [RI $master_id tcp_port] @@ -15,7 +15,8 @@ proc 03_test_slaves_replication {} { if {$id == $master_id} continue if {[instance_is_killed redis $id]} continue wait_for_condition 1000 50 { - [RI $id master_port] == $master_port + ([RI $id master_port] == $master_port) && + ([RI $id master_link_status] eq {up}) } else { fail "Redis slave $id is replicating from wrong master" } @@ -24,7 +25,7 @@ proc 03_test_slaves_replication {} { } } -proc 03_crash_and_failover {} { +proc 02_crash_and_failover {} { uplevel 1 { test "Crash the master and force a failover" { set old_port [RI $master_id tcp_port] @@ -45,9 +46,9 @@ proc 03_crash_and_failover {} { } } -03_test_slaves_replication -03_crash_and_failover -03_test_slaves_replication +02_test_slaves_replication +02_crash_and_failover +02_test_slaves_replication test "Kill a slave instance" { foreach_redis_id id { @@ -58,8 +59,8 @@ test "Kill a slave instance" { } } -03_crash_and_failover -03_test_slaves_replication +02_crash_and_failover +02_test_slaves_replication test "Wait for failover to end" { set inprogress 1 @@ -80,4 +81,4 @@ test "Restart killed slave and test replication of slaves again..." { # Now we check if the slave rejoining the partition is reconfigured even # if the failover finished. -03_test_slaves_replication +02_test_slaves_replication