From 5e3a15ae1b58630a10639b34cd016ba9c0ff6b15 Mon Sep 17 00:00:00 2001 From: Yossi Gottlieb <yossigo@gmail.com> Date: Tue, 13 Apr 2021 00:00:57 +0300 Subject: [PATCH] Fix failing cluster tests. (#8763) Disable replica migration to avoid a race condition where the migrated-from node turns into a replica. Long term, this test should probably be improved to handle multiple slots and accept such auto migrations but this is a quick fix to stabilize the CI without completely dropping this test. --- tests/cluster/cluster.tcl | 2 +- tests/cluster/tests/20-half-migrated-slot.tcl | 3 +++ tests/cluster/tests/21-many-slot-migration.tcl | 2 ++ tests/cluster/tests/includes/utils.tcl | 6 ++++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/cluster/cluster.tcl b/tests/cluster/cluster.tcl index fb10fffcc..e95789282 100644 --- a/tests/cluster/cluster.tcl +++ b/tests/cluster/cluster.tcl @@ -174,4 +174,4 @@ proc wait_for_cluster_propagation {} { } else { fail "cluster config did not reach a consistent state" } -} \ No newline at end of file +} diff --git a/tests/cluster/tests/20-half-migrated-slot.tcl b/tests/cluster/tests/20-half-migrated-slot.tcl index 69a90818c..e78867961 100644 --- a/tests/cluster/tests/20-half-migrated-slot.tcl +++ b/tests/cluster/tests/20-half-migrated-slot.tcl @@ -9,6 +9,7 @@ source "../tests/includes/utils.tcl" test "Create a 2 nodes cluster" { create_cluster 2 0 + config_set_all_nodes cluster-allow-replica-migration no } test "Cluster is up" { @@ -87,3 +88,5 @@ test "Half-finish importing" { fix_cluster $nodefrom(addr) assert_equal "xyz" [$cluster get aga] } + +config_set_all_nodes cluster-allow-replica-migration yes diff --git a/tests/cluster/tests/21-many-slot-migration.tcl b/tests/cluster/tests/21-many-slot-migration.tcl index 18daff1d4..22020505c 100644 --- a/tests/cluster/tests/21-many-slot-migration.tcl +++ b/tests/cluster/tests/21-many-slot-migration.tcl @@ -9,6 +9,7 @@ source "../tests/includes/utils.tcl" test "Create a 10 nodes cluster" { create_cluster 10 0 + config_set_all_nodes cluster-allow-replica-migration no } test "Cluster is up" { @@ -54,3 +55,4 @@ test "Keys are accessible" { } } +config_set_all_nodes cluster-allow-replica-migration yes diff --git a/tests/cluster/tests/includes/utils.tcl b/tests/cluster/tests/includes/utils.tcl index 43a2f2803..48c40a050 100644 --- a/tests/cluster/tests/includes/utils.tcl +++ b/tests/cluster/tests/includes/utils.tcl @@ -1,5 +1,11 @@ source "../../../tests/support/cli.tcl" +proc config_set_all_nodes {keyword value} { + foreach_redis_id id { + R $id config set $keyword $value + } +} + proc fix_cluster {addr} { set code [catch { exec ../../../src/redis-cli {*}[rediscli_tls_config "../../../tests"] --cluster fix $addr << yes