2014-02-18 11:04:01 +01:00
|
|
|
test "Sentinels aren't monitoring any master" {
|
|
|
|
foreach_sentinel_id id {
|
|
|
|
assert {[S $id sentinel masters] eq {}}
|
|
|
|
}
|
2014-02-17 17:37:56 +01:00
|
|
|
}
|
2014-02-18 11:38:49 +01:00
|
|
|
|
2014-02-18 11:53:54 +01:00
|
|
|
test "Create a master-slaves cluster of 3 instances" {
|
2014-02-18 11:38:49 +01:00
|
|
|
create_redis_master_slave_cluster 3
|
|
|
|
}
|
2014-02-18 11:53:54 +01:00
|
|
|
|
|
|
|
test "Sentinels can start monitoring a master" {
|
|
|
|
set sentinels [llength $::sentinel_instances]
|
|
|
|
set quorum [expr {$sentinels/2+1}]
|
|
|
|
foreach_sentinel_id id {
|
|
|
|
S $id SENTINEL MONITOR mymaster [get_instance_attrib redis 0 host] \
|
|
|
|
[get_instance_attrib redis 0 port] $quorum
|
|
|
|
}
|
|
|
|
foreach_sentinel_id id {
|
|
|
|
assert {[S $id sentinel master mymaster] ne {}}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test "Sentinels are able to auto-discover other sentinels" {
|
|
|
|
set sentinels [llength $::sentinel_instances]
|
|
|
|
foreach_sentinel_id id {
|
|
|
|
wait_for_condition 100 50 {
|
|
|
|
[dict get [S $id SENTINEL MASTER mymaster] num-other-sentinels] == ($sentinels-1)
|
|
|
|
} else {
|
|
|
|
fail "At least some sentinel can't detect some other sentinel"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|