Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
7d97a4c9
Commit
7d97a4c9
authored
Mar 04, 2014
by
antirez
Browse files
Sentinel test: initial debugging console.
parent
3072a1e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/sentinel-tests/00-base.tcl
View file @
7d97a4c9
...
...
@@ -2,6 +2,12 @@
source
"../sentinel-tests/includes/init-tests.tcl"
if
{
$::simulate
_error
}
{
test
"This test will fail"
{
fail
"Simulated error"
}
}
test
"Basic failover works if the master is down"
{
set old_port
[
RI $master_id tcp_port
]
set addr
[
S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster
]
...
...
tests/sentinel.tcl
View file @
7d97a4c9
...
...
@@ -12,6 +12,7 @@ source tests/support/test.tcl
set ::verbose 0
set ::pause_on_error 0
set ::simulate_error 0
set ::sentinel_instances
{}
set ::redis_instances
{}
set ::sentinel_base_port 20000
...
...
@@ -98,11 +99,14 @@ proc parse_options {} {
set ::run_matching
"*
${val}
*"
}
elseif
{
$opt
eq
"--pause-on-error"
}
{
set ::pause_on_error 1
}
elseif
{
$opt
eq
"--fail"
}
{
set ::simulate_error 1
}
elseif
{
$opt
eq
"--help"
}
{
puts
"Hello, I'm sentinel.tcl and I run Sentinel unit tests."
puts
"
\n
Options:"
puts
"--single <pattern> Only runs tests specified by pattern."
puts
"--pause-on-error Pause for manual inspection on error."
puts
"--fail Simulate a test failure."
puts
"--help Shows this help."
exit 0
}
else
{
...
...
@@ -130,7 +134,23 @@ proc pause_on_error {} {
while 1
{
puts -nonewline
"> "
flush stdout
if
{[
gets stdin
]
eq
{
continue
}}
break
set line
[
gets stdin
]
set argv
[
split $line
" "
]
set cmd
[
lindex $argv 0
]
if
{
$cmd
eq
{
continue
}}
{
break
}
elseif
{
$cmd
eq
{
show-sentinel-logs
}}
{
set count 10
if
{[
lindex $argv 1
]
ne
{}}
{
set count
[
lindex $argv 1
]}
foreach_sentinel_id id
{
puts
"=== SENTINEL
$id
===="
puts
[
exec tail -$count sentinel_$id/log.txt
]
puts
"---------------------
\n
"
}
}
else
{
set errcode
[
catch
{
eval $line
}
retval
]
puts
"
$retval
"
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment