"Fossies" - the Fresh Open Source Software Archive

Member "redis-5.0.6/tests/sentinel/tests/06-ckquorum.tcl" (25 Sep 2019, 1109 Bytes) of package /linux/misc/redis-5.0.6.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Tcl/Tk source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 # Test for the SENTINEL CKQUORUM command
    2 
    3 source "../tests/includes/init-tests.tcl"
    4 set num_sentinels [llength $::sentinel_instances]
    5 
    6 test "CKQUORUM reports OK and the right amount of Sentinels" {
    7     foreach_sentinel_id id {
    8         assert_match "*OK $num_sentinels usable*" [S $id SENTINEL CKQUORUM mymaster]
    9     }
   10 }
   11 
   12 test "CKQUORUM detects quorum cannot be reached" {
   13     set orig_quorum [expr {$num_sentinels/2+1}]
   14     S 0 SENTINEL SET mymaster quorum [expr {$num_sentinels+1}]
   15     catch {[S 0 SENTINEL CKQUORUM mymaster]} err
   16     assert_match "*NOQUORUM*" $err
   17     S 0 SENTINEL SET mymaster quorum $orig_quorum
   18 }
   19 
   20 test "CKQUORUM detects failover authorization cannot be reached" {
   21     set orig_quorum [expr {$num_sentinels/2+1}]
   22     S 0 SENTINEL SET mymaster quorum 1
   23     kill_instance sentinel 1
   24     kill_instance sentinel 2
   25     kill_instance sentinel 3
   26     after 5000
   27     catch {[S 0 SENTINEL CKQUORUM mymaster]} err
   28     assert_match "*NOQUORUM*" $err
   29     S 0 SENTINEL SET mymaster quorum $orig_quorum
   30     restart_instance sentinel 1
   31     restart_instance sentinel 2
   32     restart_instance sentinel 3
   33 }
   34