From 60fb9feec87ed58eedbd26e531524d76315ef869 Mon Sep 17 00:00:00 2001 From: Vladislav Date: Fri, 10 Nov 2023 18:31:57 +0300 Subject: [PATCH] fix(tests): Fix flaky cluster test (#2158) Fixes flaky cluster family test --- src/server/cluster/cluster_family_test.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/server/cluster/cluster_family_test.cc b/src/server/cluster/cluster_family_test.cc index 93166bec8..c4a6a0dee 100644 --- a/src/server/cluster/cluster_family_test.cc +++ b/src/server/cluster/cluster_family_test.cc @@ -623,7 +623,7 @@ TEST_F(ClusterFamilyTest, ClusterConfigDeleteSomeSlots) { "slot_ranges": [ { "start": 0, - "end": 8000 + "end": $1 } ], "master": { @@ -636,7 +636,7 @@ TEST_F(ClusterFamilyTest, ClusterConfigDeleteSomeSlots) { { "slot_ranges": [ { - "start": 8001, + "start": $2, "end": 16383 } ], @@ -648,7 +648,8 @@ TEST_F(ClusterFamilyTest, ClusterConfigDeleteSomeSlots) { "replicas": [] } ])json"; - string config = absl::Substitute(config_template, GetMyId()); + + string config = absl::Substitute(config_template, GetMyId(), "8000", "8001"); EXPECT_EQ(RunPrivileged({"dflycluster", "config", config}), "OK"); @@ -662,7 +663,7 @@ TEST_F(ClusterFamilyTest, ClusterConfigDeleteSomeSlots) { EXPECT_THAT(Run({"dbsize"}), IntArg(3)); // Move ownership over 8000 to other master - config = absl::StrReplaceAll(config, {{"8000", "7999"}, {"8001", "8000"}}); + config = absl::Substitute(config_template, GetMyId(), "7999", "8000"); EXPECT_EQ(RunPrivileged({"dflycluster", "config", config}), "OK"); // Verify that keys for slot 8000 were deleted, while key for slot 7999 was kept