"Fossies" - the Fresh Open Source Software Archive

Member "redis-5.0.6/tests/cluster/tests/11-manual-takeover.tcl" (25 Sep 2019, 1272 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 # Manual takeover test
    2 
    3 source "../tests/includes/init-tests.tcl"
    4 
    5 test "Create a 5 nodes cluster" {
    6     create_cluster 5 5
    7 }
    8 
    9 test "Cluster is up" {
   10     assert_cluster_state ok
   11 }
   12 
   13 test "Cluster is writable" {
   14     cluster_write_test 0
   15 }
   16 
   17 test "Killing majority of master nodes" {
   18     kill_instance redis 0
   19     kill_instance redis 1
   20     kill_instance redis 2
   21 }
   22 
   23 test "Cluster should eventually be down" {
   24     assert_cluster_state fail
   25 }
   26 
   27 test "Use takeover to bring slaves back" {
   28     R 5 cluster failover takeover
   29     R 6 cluster failover takeover
   30     R 7 cluster failover takeover
   31 }
   32 
   33 test "Cluster should eventually be up again" {
   34     assert_cluster_state ok
   35 }
   36 
   37 test "Cluster is writable" {
   38     cluster_write_test 4
   39 }
   40 
   41 test "Instance #5, #6, #7 are now masters" {
   42     assert {[RI 5 role] eq {master}}
   43     assert {[RI 6 role] eq {master}}
   44     assert {[RI 7 role] eq {master}}
   45 }
   46 
   47 test "Restarting the previously killed master nodes" {
   48     restart_instance redis 0
   49     restart_instance redis 1
   50     restart_instance redis 2
   51 }
   52 
   53 test "Instance #0, #1, #2 gets converted into a slaves" {
   54     wait_for_condition 1000 50 {
   55         [RI 0 role] eq {slave} && [RI 1 role] eq {slave} && [RI 2 role] eq {slave}
   56     } else {
   57         fail "Old masters not converted into slaves"
   58     }
   59 }