use of com.ctrip.xpipe.redis.meta.server.dcchange.exception.ChooseNewMasterFailException in project x-pipe by ctripcorp.
the class FirstNewMasterChooserTest method testMultiMaster.
@Test
public void testMultiMaster() throws Exception {
int addRedisCount = 5;
Set<Integer> ports = new HashSet<>();
redises.forEach(redisMeta -> ports.add(redisMeta.getPort()));
for (int i = 0; i < addRedisCount; i++) {
int port = randomPort(ports);
redises.add(new RedisMeta().setIp("localhost").setPort(port));
}
for (RedisMeta redis : redises) {
startSlaveFakeRedis(redis.getPort(), SERVER_ROLE.MASTER);
}
try {
RedisMeta choose = firstNewMasterChooser.choose(redises);
Assert.fail();
} catch (ChooseNewMasterFailException e) {
Assert.assertEquals(redises.size(), e.getRedises().size());
}
}
Aggregations