use of redis.clients.jedis.JedisCluster in project jedis by xetorthio.
the class JedisClusterTest method testLocalhostNodeNotAddedWhen127Present.
@Test
public void testLocalhostNodeNotAddedWhen127Present() {
HostAndPort localhost = new HostAndPort("localhost", 7379);
Set<HostAndPort> jedisClusterNode = new HashSet<HostAndPort>();
// cluster node is defined as 127.0.0.1; adding localhost should work,
// but shouldn't show up.
jedisClusterNode.add(localhost);
JedisPoolConfig config = DEFAULT_CONFIG;
config.setMaxTotal(1);
JedisCluster jc = new JedisCluster(jedisClusterNode, 0, 2, DEFAULT_REDIRECTIONS, "cluster", DEFAULT_CONFIG);
Map<String, JedisPool> clusterNodes = jc.getClusterNodes();
assertEquals(3, clusterNodes.size());
assertFalse(clusterNodes.containsKey(JedisClusterInfoCache.getNodeKey(localhost)));
}
Aggregations