From 9865ce0e64f1877588e9c87f05a2203ced6356be Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 10 Jun 2014 14:18:54 +0200 Subject: [PATCH] Cluster test: unit 02 should wait for failover. --- tests/cluster/tests/02-failover.tcl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/cluster/tests/02-failover.tcl b/tests/cluster/tests/02-failover.tcl index 2be22d33..0ccfa7d0 100644 --- a/tests/cluster/tests/02-failover.tcl +++ b/tests/cluster/tests/02-failover.tcl @@ -18,10 +18,20 @@ test "Instance #5 is a slave" { assert {[RI 5 role] eq {slave}} } +set current_epoch [CI 1 cluster_current_epoch] + test "Killing one master node" { kill_instance redis 0 } +test "Wait for failover" { + wait_for_condition 1000 50 { + [CI 1 cluster_current_epoch] > $current_epoch + } else { + fail "No failover detected" + } +} + test "Cluster should eventually be up again" { assert_cluster_state ok }