diff options
author | antirez <antirez@gmail.com> | 2014-05-19 11:39:15 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2014-05-19 11:39:15 +0200 |
commit | a7da78e472b90aec6d877904394b8481d59d1f70 (patch) | |
tree | 0461314abe0e00d337de2a317967beec0a85e67a | |
parent | 4c04744734098576f884aa7ee3dfc64cd856043d (diff) | |
download | redis-a7da78e472b90aec6d877904394b8481d59d1f70.tar.gz |
Cluster test: failure detection initial tests.
-rw-r--r-- | tests/cluster/tests/01-faildet.tcl | 31 | ||||
-rw-r--r-- | tests/cluster/tests/includes/init-tests.tcl | 1 |
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/cluster/tests/01-faildet.tcl b/tests/cluster/tests/01-faildet.tcl new file mode 100644 index 000000000..883548caf --- /dev/null +++ b/tests/cluster/tests/01-faildet.tcl @@ -0,0 +1,31 @@ +# Check the basic monitoring and failover capabilities. + +source "../tests/includes/init-tests.tcl" + +proc create_cluster {masters slaves} { + cluster_allocate_slots $masters + if {$slaves} { + cluster_allocate_slaves $masters $slaves + } + assert_cluster_state ok +} + +test "Create a 5 nodes cluster" { + create_cluster 5 0 +} + +test "Killing one master node" { + kill_instance redis 0 +} + +test "Cluster should be down now" { + assert_cluster_state fail +} + +test "Restarting master node" { + restart_instance redis 0 +} + +test "Cluster should be up again" { + assert_cluster_state ok +} diff --git a/tests/cluster/tests/includes/init-tests.tcl b/tests/cluster/tests/includes/init-tests.tcl index 849dba23d..9f34be181 100644 --- a/tests/cluster/tests/includes/init-tests.tcl +++ b/tests/cluster/tests/includes/init-tests.tcl @@ -23,6 +23,7 @@ test "Cluster nodes hard reset" { foreach_redis_id id { R $id flushall R $id cluster reset hard + R $id config set cluster-node-timeout 3000 } } |