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
6if {false} {
7
8source "../tests/includes/init-tests.tcl"
9source "../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
15test "Create a 10 nodes cluster" {
16    create_cluster 10 0
17    config_set_all_nodes cluster-allow-replica-migration no
18}
19
20test "Cluster is up" {
21    assert_cluster_state ok
22}
23
24set cluster [redis_cluster 127.0.0.1:[get_instance_attrib redis 0 port]]
25catch {unset nodefrom}
26catch {unset nodeto}
27
28$cluster refresh_nodes_map
29
30test "Set many keys" {
31    for {set i 0} {$i < 40000} {incr i} {
32        $cluster set key:$i val:$i
33    }
34}
35
36test "Keys are accessible" {
37    for {set i 0} {$i < 40000} {incr i} {
38        assert { [$cluster get key:$i] eq "val:$i" }
39    }
40}
41
42test "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
52test "Fix cluster" {
53    wait_for_cluster_propagation
54    fix_cluster $nodefrom(addr)
55}
56
57test "Keys are accessible" {
58    for {set i 0} {$i < 40000} {incr i} {
59        assert { [$cluster get key:$i] eq "val:$i" }
60    }
61}
62
63config_set_all_nodes cluster-allow-replica-migration yes
64}
65