diff options
author | antirez <antirez@gmail.com> | 2015-05-19 12:26:57 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2015-05-19 12:26:57 +0200 |
commit | 164b6bbab5c4cf3daf2e26653b114697bafb502b (patch) | |
tree | eb77b1648968ed198f2bb887a19c93f3785d9720 /tests | |
parent | eb138f1511127c3aff428729feed99741b4f0124 (diff) | |
parent | d614f1c37e7cef759f655d72eadd9f9e421b2196 (diff) | |
download | redis-164b6bbab5c4cf3daf2e26653b114697bafb502b.tar.gz |
Merge branch 'sentinel-32' into unstable
Diffstat (limited to 'tests')
-rw-r--r-- | tests/sentinel/tests/06-ckquorum.tcl | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/sentinel/tests/06-ckquorum.tcl b/tests/sentinel/tests/06-ckquorum.tcl new file mode 100644 index 000000000..31e5fa2f8 --- /dev/null +++ b/tests/sentinel/tests/06-ckquorum.tcl @@ -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 +} + |