"Fossies" - the Fresh Open Source Software Archive

Member "redis-7.0.5/tests/cluster/tests/21-many-slot-migration.tcl" (21 Sep 2022, 1658 Bytes) of package /linux/misc/redis-7.0.5.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. Alternatively you can here view or download the uninterpreted source code file.

    1 # Tests for many simultaneous migrations.
    2 
    3 # TODO: Test is currently disabled until it is stabilized (fixing the test
    4 # itself or real issues in Redis).
    5 
    6 if {false} {
    7 
    8 source "../tests/includes/init-tests.tcl"
    9 source "../tests/includes/utils.tcl"
   10 
   11 # TODO: This test currently runs without replicas, as failovers (which may
   12 # happen on lower-end CI platforms) are still not handled properly by the
   13 # cluster during slot migration (related to #6339).
   14 
   15 test "Create a 10 nodes cluster" {
   16     create_cluster 10 0
   17     config_set_all_nodes cluster-allow-replica-migration no
   18 }
   19 
   20 test "Cluster is up" {
   21     assert_cluster_state ok
   22 }
   23 
   24 set cluster [redis_cluster 127.0.0.1:[get_instance_attrib redis 0 port]]
   25 catch {unset nodefrom}
   26 catch {unset nodeto}
   27 
   28 $cluster refresh_nodes_map
   29 
   30 test "Set many keys" {
   31     for {set i 0} {$i < 40000} {incr i} {
   32         $cluster set key:$i val:$i
   33     }
   34 }
   35 
   36 test "Keys are accessible" {
   37     for {set i 0} {$i < 40000} {incr i} {
   38         assert { [$cluster get key:$i] eq "val:$i" }
   39     }
   40 }
   41 
   42 test "Init migration of many slots" {
   43     for {set slot 0} {$slot < 1000} {incr slot} {
   44         array set nodefrom [$cluster masternode_for_slot $slot]
   45         array set nodeto [$cluster masternode_notfor_slot $slot]
   46 
   47         $nodefrom(link) cluster setslot $slot migrating $nodeto(id)
   48         $nodeto(link) cluster setslot $slot importing $nodefrom(id)
   49     }
   50 }
   51 
   52 test "Fix cluster" {
   53     wait_for_cluster_propagation
   54     fix_cluster $nodefrom(addr)
   55 }
   56 
   57 test "Keys are accessible" {
   58     for {set i 0} {$i < 40000} {incr i} {
   59         assert { [$cluster get key:$i] eq "val:$i" }
   60     }
   61 }
   62 
   63 config_set_all_nodes cluster-allow-replica-migration yes
   64 }