mirror of
https://github.com/fluencelabs/redis
synced 2025-04-02 15:51:05 +00:00
Sentinel test: initial debugging console.
This commit is contained in:
parent
3072a1e781
commit
7d97a4c99b
tests
@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
source "../sentinel-tests/includes/init-tests.tcl"
|
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" {
|
test "Basic failover works if the master is down" {
|
||||||
set old_port [RI $master_id tcp_port]
|
set old_port [RI $master_id tcp_port]
|
||||||
set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
|
set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
|
||||||
|
@ -12,6 +12,7 @@ source tests/support/test.tcl
|
|||||||
|
|
||||||
set ::verbose 0
|
set ::verbose 0
|
||||||
set ::pause_on_error 0
|
set ::pause_on_error 0
|
||||||
|
set ::simulate_error 0
|
||||||
set ::sentinel_instances {}
|
set ::sentinel_instances {}
|
||||||
set ::redis_instances {}
|
set ::redis_instances {}
|
||||||
set ::sentinel_base_port 20000
|
set ::sentinel_base_port 20000
|
||||||
@ -98,11 +99,14 @@ proc parse_options {} {
|
|||||||
set ::run_matching "*${val}*"
|
set ::run_matching "*${val}*"
|
||||||
} elseif {$opt eq "--pause-on-error"} {
|
} elseif {$opt eq "--pause-on-error"} {
|
||||||
set ::pause_on_error 1
|
set ::pause_on_error 1
|
||||||
|
} elseif {$opt eq "--fail"} {
|
||||||
|
set ::simulate_error 1
|
||||||
} elseif {$opt eq "--help"} {
|
} elseif {$opt eq "--help"} {
|
||||||
puts "Hello, I'm sentinel.tcl and I run Sentinel unit tests."
|
puts "Hello, I'm sentinel.tcl and I run Sentinel unit tests."
|
||||||
puts "\nOptions:"
|
puts "\nOptions:"
|
||||||
puts "--single <pattern> Only runs tests specified by pattern."
|
puts "--single <pattern> Only runs tests specified by pattern."
|
||||||
puts "--pause-on-error Pause for manual inspection on error."
|
puts "--pause-on-error Pause for manual inspection on error."
|
||||||
|
puts "--fail Simulate a test failure."
|
||||||
puts "--help Shows this help."
|
puts "--help Shows this help."
|
||||||
exit 0
|
exit 0
|
||||||
} else {
|
} else {
|
||||||
@ -130,7 +134,23 @@ proc pause_on_error {} {
|
|||||||
while 1 {
|
while 1 {
|
||||||
puts -nonewline "> "
|
puts -nonewline "> "
|
||||||
flush stdout
|
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"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user