From 2af2173a60d7593937754c87c94f1abea2569d48 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 4 Mar 2014 15:55:36 +0100 Subject: [PATCH] Sentinel test: debugging console improved. --- tests/sentinel.tcl | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/tests/sentinel.tcl b/tests/sentinel.tcl index 7fdf2d75..faa39354 100644 --- a/tests/sentinel.tcl +++ b/tests/sentinel.tcl @@ -130,7 +130,7 @@ proc main {} { proc pause_on_error {} { puts "" puts [colorstr yellow "*** Please inspect the error now ***"] - puts "\nType \"continue\" to resume the test.\n" + puts "\nType \"continue\" to resume the test, \"help\" for help screen.\n" while 1 { puts -nonewline "> " flush stdout @@ -147,9 +147,49 @@ proc pause_on_error {} { puts [exec tail -$count sentinel_$id/log.txt] puts "---------------------\n" } + } elseif {$cmd eq {ls}} { + foreach_redis_id id { + puts -nonewline "Redis $id" + set errcode [catch { + set str {} + append str "@[RI $id tcp_port]: " + append str "[RI $id role] " + if {[RI $id role] eq {slave}} { + append str "[RI $id master_host]:[RI $id master_port]" + } + set str + } retval] + if {$errcode} { + puts " -- $retval" + } else { + puts $retval + } + } + foreach_sentinel_id id { + puts -nonewline "Sentinel $id" + set errcode [catch { + set str {} + append str "@[SI $id tcp_port]: " + append str "[join [S $id sentinel get-master-addr-by-name mymaster]]" + set str + } retval] + if {$errcode} { + puts " -- $retval" + } else { + puts $retval + } + } + } elseif {$cmd eq {help}} { + puts "ls List Sentinel and Redis instances." + puts "show-sentinel-logs \[N\] Show latest N lines of logs." + puts "S cmd ... arg Call command in Sentinel ." + puts "R cmd ... arg Call command in Redis ." + puts "SI Show Sentinel INFO ." + puts "RI Show Sentinel INFO ." + puts "continue Resume test." } else { set errcode [catch {eval $line} retval] - puts "$retval" + if {$retval ne {}} {puts "$retval"} } } } -- GitLab