mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
Sentinel: CKQUORUM tests
This commit is contained in:
parent
abc65e8987
commit
d614f1c37e
34
tests/sentinel/tests/06-ckquorum.tcl
Normal file
34
tests/sentinel/tests/06-ckquorum.tcl
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# Test for the SENTINEL CKQUORUM command
|
||||||
|
|
||||||
|
source "../tests/includes/init-tests.tcl"
|
||||||
|
set num_sentinels [llength $::sentinel_instances]
|
||||||
|
|
||||||
|
test "CKQUORUM reports OK and the right amount of Sentinels" {
|
||||||
|
foreach_sentinel_id id {
|
||||||
|
assert_match "*OK $num_sentinels usable*" [S $id SENTINEL CKQUORUM mymaster]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test "CKQUORUM detects quorum cannot be reached" {
|
||||||
|
set orig_quorum [expr {$num_sentinels/2+1}]
|
||||||
|
S 0 SENTINEL SET mymaster quorum [expr {$num_sentinels+1}]
|
||||||
|
catch {[S 0 SENTINEL CKQUORUM mymaster]} err
|
||||||
|
assert_match "*NOQUORUM*" $err
|
||||||
|
S 0 SENTINEL SET mymaster quorum $orig_quorum
|
||||||
|
}
|
||||||
|
|
||||||
|
test "CKQUORUM detects failover authorization cannot be reached" {
|
||||||
|
set orig_quorum [expr {$num_sentinels/2+1}]
|
||||||
|
S 0 SENTINEL SET mymaster quorum 1
|
||||||
|
kill_instance sentinel 1
|
||||||
|
kill_instance sentinel 2
|
||||||
|
kill_instance sentinel 3
|
||||||
|
after 5000
|
||||||
|
catch {[S 0 SENTINEL CKQUORUM mymaster]} err
|
||||||
|
assert_match "*NOQUORUM*" $err
|
||||||
|
S 0 SENTINEL SET mymaster quorum $orig_quorum
|
||||||
|
restart_instance sentinel 1
|
||||||
|
restart_instance sentinel 2
|
||||||
|
restart_instance sentinel 3
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user