From 386467acfb53e855369e9ffdad316462462802e5 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 25 Feb 2014 08:48:46 +0100 Subject: [PATCH] Sentinel test: restart instances left killed by previous unit. An unit can abort in the middle for an error. The next unit should not assume that the instances are in a clean state, and must restart what was left killed. --- tests/sentinel-tests/includes/init-tests.tcl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/sentinel-tests/includes/init-tests.tcl b/tests/sentinel-tests/includes/init-tests.tcl index cea437a8..91b179b4 100644 --- a/tests/sentinel-tests/includes/init-tests.tcl +++ b/tests/sentinel-tests/includes/init-tests.tcl @@ -1,5 +1,17 @@ # Initialization tests -- most units will start including this. +test "(init) Restart killed instances" { + foreach type {redis sentinel} { + foreach_${type}_id id { + if {[get_instance_attrib $type $id pid] == -1} { + puts -nonewline "$type/$id " + flush stdout + restart_instance $type $id + } + } + } +} + set redis_slaves 4 test "(init) Create a master-slaves cluster of [expr $redis_slaves+1] instances" { create_redis_master_slave_cluster [expr {$redis_slaves+1}]