use of com.ctrip.xpipe.redis.meta.server.TestMetaServer in project x-pipe by ctripcorp.
the class ClusterServersApiTest method testUpdateUpstream.
@Test
public void testUpdateUpstream() throws Exception {
createMetaServers(metaServerCount);
sleep(waitForMetaServerOkTime);
logger.info(remarkableMessage("[testUpdateUpstream][begin send upstream update message]"));
for (TestMetaServer server : getServers()) {
String path = META_SERVER_SERVICE.UPSTREAM_CHANGE.getRealPath(server.getAddress());
logger.info("[testClusterChanged]{}", path);
restTemplate.put(path, null, "cluster1", "shard1", "localhost", 7777);
}
}
use of com.ctrip.xpipe.redis.meta.server.TestMetaServer in project x-pipe by ctripcorp.
the class ManualTest method testMetaServerGc.
@Test
public void testMetaServerGc() throws Exception {
for (int i = 0; i < 10000; i++) {
try {
TestMetaServer server = createMetaServer(i, 9747, getZkPort());
server.stop();
server.dispose();
} catch (Exception e) {
logger.error("[testMetaServer]", e);
}
}
}
use of com.ctrip.xpipe.redis.meta.server.TestMetaServer in project x-pipe by ctripcorp.
the class ClusterServerShardingTest method simpleTest.
@Test
public void simpleTest() throws Exception {
createMetaServers(1);
sleep(sleepForBalance);
TestMetaServer server = getLeader();
server.stop();
}
use of com.ctrip.xpipe.redis.meta.server.TestMetaServer in project x-pipe by ctripcorp.
the class ClusterServerShardingTest method testShutdownLeader.
@Test
public void testShutdownLeader() throws Exception {
createMetaServers(serverCount);
sleep(sleepForBalance);
TestMetaServer leader = null;
for (TestMetaServer server : getServers()) {
if (server.isLeader()) {
logger.info(remarkableMessage("[testShutdownLeader][begin]{}"), server);
leader = server;
server.stop();
logger.info(remarkableMessage("[testShutdownLeader][ end ]{}"), server);
break;
}
}
sleep(TestMetaServer.getZksessiontimeoutmillis() + 1000);
TestMetaServer newLeader = getLeader();
logger.info("[testShutdownLeader][new leader]{}", newLeader);
Assert.assertNotEquals(leader, newLeader);
SlotManager slotManager = newLeader.getContext().getBean(SlotManager.class);
slotManager.refresh();
Assert.assertEquals(serverCount - 1, slotManager.allServers().size());
AssertBalance(slotManager);
}
Aggregations