Skip to content

Commit

Permalink
fix(#2341): Clone node2 from node1 using the RedisClusterNode constru…
Browse files Browse the repository at this point in the history
…ctor and compare the two clusters with hasSameSlotsAs()
  • Loading branch information
zeze1004 authored and tishun committed Jul 12, 2024
1 parent c5b8720 commit 18572c0
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 18572c0

Please sign in to comment.