summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-02-25 08:23:48 +0100
committerantirez <antirez@gmail.com>2014-02-25 10:24:16 +0100
commit491bcbaf73442bb39db8de93eac154765d5e80ba (patch)
tree3c9a711b9751ce149021e3d21ee39452d88552d5
parent55643361f113689116bc1b9fe22dcd884493fb39 (diff)
downloadredis-491bcbaf73442bb39db8de93eac154765d5e80ba.tar.gz
Sentinel test: restart_instance should refresh pid attrib.
Also kill_instance was modified to warn when a test will try to kill the same instance multiple times for error.
-rw-r--r--tests/sentinel.tcl4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/sentinel.tcl b/tests/sentinel.tcl
index 669bc8307..e278aea70 100644
--- a/tests/sentinel.tcl
+++ b/tests/sentinel.tcl
@@ -280,6 +280,9 @@ proc get_instance_id_by_port {type port} {
# The instance can be restarted with restart-instance.
proc kill_instance {type id} {
set pid [get_instance_attrib $type $id pid]
+ if {$pid == -1} {
+ error "You tried to kill $type $id twice."
+ }
exec kill -9 $pid
set_instance_attrib $type $id pid -1
set_instance_attrib $type $id link you_tried_to_talk_with_killed_instance
@@ -302,6 +305,7 @@ proc restart_instance {type id} {
set prgname redis-sentinel
}
set pid [exec ../../src/${prgname} $cfgfile &]
+ set_instance_attrib $type $id pid $pid
lappend ::pids $pid
# Check that the instance is running