Merge branch 'support-cluster-slots' of https://github.com/HeartSaVioR/jedis into HeartSaVioR-support-cluster-slots
This commit is contained in:
@@ -45,6 +45,8 @@ public class ClusterCommandsTest extends JedisTestBase {
|
||||
node1.clusterDelSlots(1, 2, 3, 4, 5, 500);
|
||||
node1.clusterSetSlotNode(5000, node1Id);
|
||||
node1.clusterDelSlots(5000, 10000);
|
||||
node1.clusterDelSlots(3000, 3001, 3002);
|
||||
node2.clusterDelSlots(4000, 4001, 4002);
|
||||
node1.clusterAddSlots(6000);
|
||||
node1.clusterDelSlots(6000);
|
||||
waitForGossip();
|
||||
@@ -134,5 +136,34 @@ public class ClusterCommandsTest extends JedisTestBase {
|
||||
String status = node1.clusterSetSlotMigrating(5000, nodeId);
|
||||
assertEquals("OK", status);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void clusterSlots() {
|
||||
// please see cluster slot output format from below commit
|
||||
// @see:
|
||||
// https://github.com/antirez/redis/commit/e14829de3025ffb0d3294e5e5a1553afd9f10b60
|
||||
String status = node1.clusterAddSlots(3000, 3001, 3002);
|
||||
assertEquals("OK", status);
|
||||
status = node2.clusterAddSlots(4000, 4001, 4002);
|
||||
assertEquals("OK", status);
|
||||
|
||||
List<Object> slots = node1.clusterSlots();
|
||||
assertNotNull(slots);
|
||||
assertTrue(slots.size() > 0);
|
||||
|
||||
for (Object slotInfoObj : slots) {
|
||||
List<Object> slotInfo = (List<Object>) slotInfoObj;
|
||||
assertNotNull(slots);
|
||||
assertTrue(slots.size() >= 2);
|
||||
|
||||
assertTrue(slotInfo.get(0) instanceof Long);
|
||||
assertTrue(slotInfo.get(1) instanceof Long);
|
||||
|
||||
if (slots.size() > 2) {
|
||||
// assigned slots
|
||||
assertTrue(slotInfo.get(2) instanceof List);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user