mirror of
https://github.com/fluencelabs/redis
synced 2025-04-07 10:01:04 +00:00
Sentinel test: move init tests as includes.
Most units will start with these two basic tests to create an environment where the real tests are ran.
This commit is contained in:
parent
5765444454
commit
d7da507683
@ -1,30 +1,6 @@
|
|||||||
# Check the basic monitoring and failover capabilities.
|
# Check the basic monitoring and failover capabilities.
|
||||||
|
|
||||||
test "Sentinels aren't monitoring any master" {
|
source "../sentinel-tests/includes/init-tests.tcl"
|
||||||
foreach_sentinel_id id {
|
|
||||||
assert {[S $id sentinel masters] eq {}}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
set redis_slaves 4
|
|
||||||
test "Create a master-slaves cluster of [expr $redis_slaves+1] instances" {
|
|
||||||
create_redis_master_slave_cluster [expr {$redis_slaves+1}]
|
|
||||||
}
|
|
||||||
set master_id 0
|
|
||||||
|
|
||||||
test "Sentinels can start monitoring a master" {
|
|
||||||
set sentinels [llength $::sentinel_instances]
|
|
||||||
set quorum [expr {$sentinels/2+1}]
|
|
||||||
foreach_sentinel_id id {
|
|
||||||
catch {S $id SENTINEL REMOVE mymaster}
|
|
||||||
S $id SENTINEL MONITOR mymaster \
|
|
||||||
[get_instance_attrib redis $master_id host] \
|
|
||||||
[get_instance_attrib redis $master_id port] $quorum
|
|
||||||
}
|
|
||||||
foreach_sentinel_id id {
|
|
||||||
assert {[S $id sentinel master mymaster] ne {}}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
test "Sentinels are able to auto-discover other sentinels" {
|
test "Sentinels are able to auto-discover other sentinels" {
|
||||||
set sentinels [llength $::sentinel_instances]
|
set sentinels [llength $::sentinel_instances]
|
||||||
|
23
tests/sentinel-tests/includes/init-tests.tcl
Normal file
23
tests/sentinel-tests/includes/init-tests.tcl
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Initialization tests -- most units will start including this.
|
||||||
|
|
||||||
|
set redis_slaves 4
|
||||||
|
test "Create a master-slaves cluster of [expr $redis_slaves+1] instances" {
|
||||||
|
create_redis_master_slave_cluster [expr {$redis_slaves+1}]
|
||||||
|
}
|
||||||
|
set master_id 0
|
||||||
|
|
||||||
|
test "Sentinels can start monitoring a master" {
|
||||||
|
set sentinels [llength $::sentinel_instances]
|
||||||
|
set quorum [expr {$sentinels/2+1}]
|
||||||
|
foreach_sentinel_id id {
|
||||||
|
catch {S $id SENTINEL REMOVE mymaster}
|
||||||
|
S $id SENTINEL MONITOR mymaster \
|
||||||
|
[get_instance_attrib redis $master_id host] \
|
||||||
|
[get_instance_attrib redis $master_id port] $quorum
|
||||||
|
}
|
||||||
|
foreach_sentinel_id id {
|
||||||
|
assert {[S $id sentinel master mymaster] ne {}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -141,6 +141,7 @@ proc run_tests {} {
|
|||||||
if {$::run_matching ne {} && [string match $::run_matching $test] == 0} {
|
if {$::run_matching ne {} && [string match $::run_matching $test] == 0} {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if {[file isdirectory $test]} continue
|
||||||
puts [colorstr yellow "Testing unit: [lindex [file split $test] end]"]
|
puts [colorstr yellow "Testing unit: [lindex [file split $test] end]"]
|
||||||
source $test
|
source $test
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user