From 18572c06a3f13e575606242787a2b6bf2877cc60 Mon Sep 17 00:00:00 2001 From: "sojung.kim" Date: Fri, 14 Jun 2024 19:48:55 +0900 Subject: [PATCH] fix(#2341): Clone node2 from node1 using the RedisClusterNode constructor and compare the two clusters with hasSameSlotsAs() --- .../partitions/RedisClusterNodeUnitTests.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/test/java/io/lettuce/core/cluster/models/partitions/RedisClusterNodeUnitTests.java b/src/test/java/io/lettuce/core/cluster/models/partitions/RedisClusterNodeUnitTests.java index ec21559197..8c9ed71688 100644 --- a/src/test/java/io/lettuce/core/cluster/models/partitions/RedisClusterNodeUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/models/partitions/RedisClusterNodeUnitTests.java @@ -72,18 +72,14 @@ void shouldCopyNodeWithNonEmptySlots() { @Test public void testHasSameSlotsAs() { - BitSet slots1 = new BitSet(SlotHash.SLOT_COUNT); - slots1.set(1); - slots1.set(2); - - BitSet slots2 = new BitSet(SlotHash.SLOT_COUNT); - slots2.set(1); - slots2.set(2); + BitSet emptySlots = new BitSet(SlotHash.SLOT_COUNT); + emptySlots.set(1); + emptySlots.set(2); RedisClusterNode node1 = new RedisClusterNode(RedisURI.create("localhost", 6379), "nodeId1", true, "slaveOf", 0L, 0L, - 0L, slots1, new HashSet<>()); - RedisClusterNode node2 = new RedisClusterNode(RedisURI.create("localhost", 6379), "nodeId2", true, "slaveOf", 0L, 0L, - 0L, slots2, new HashSet<>()); + 0L, emptySlots, new HashSet<>()); + + RedisClusterNode node2 = new RedisClusterNode(node1); assertThat(node1.hasSameSlotsAs(node2)).isTrue(); }