use of com.ctrip.xpipe.redis.keeper.RedisKeeperServer in project x-pipe by ctripcorp.
the class DefaultRedisKeeperServerConnectToFakeRedisTest method testReplicationData.
@Test
public void testReplicationData() throws Exception {
RedisKeeperServer redisKeeperServer = startRedisKeeperServerAndConnectToFakeRedis();
sleep(1500);
logger.info(remarkableMessage("[testReplicationData][read replication store]"));
ReplicationStore replicationStore = redisKeeperServer.getReplicationStore();
String rdbContent = readRdbFileTilEnd(replicationStore);
Assert.assertEquals(fakeRedisServer.getRdbContent(), rdbContent);
String commands = readCommandFileTilEnd(replicationStore, fakeRedisServer.currentCommands().length());
Assert.assertEquals(fakeRedisServer.currentCommands(), commands);
}
use of com.ctrip.xpipe.redis.keeper.RedisKeeperServer in project x-pipe by ctripcorp.
the class AbstractFakeRedisTest method startRedisKeeperServer.
protected RedisKeeperServer startRedisKeeperServer(int replicationStoreCommandFileNumToKeep, int replicationStoreMaxCommandsToTransferBeforeCreateRdb, int minTimeMilliToGcAfterCreate) throws Exception {
KeeperConfig keeperConfig = new TestKeeperConfig(commandFileSize, replicationStoreCommandFileNumToKeep, replicationStoreMaxCommandsToTransferBeforeCreateRdb, minTimeMilliToGcAfterCreate);
RedisKeeperServer redisKeeperServer = createRedisKeeperServer(keeperConfig);
redisKeeperServer.initialize();
redisKeeperServer.start();
add(redisKeeperServer);
return redisKeeperServer;
}
use of com.ctrip.xpipe.redis.keeper.RedisKeeperServer in project x-pipe by ctripcorp.
the class FakeRedisRdbDumpLong method testRedisWithLf.
@Test
public void testRedisWithLf() throws Exception {
int sleepBeforeSendRdb = replicationTimeoutMilli * 2;
fakeRedisServer.setSleepBeforeSendRdb(sleepBeforeSendRdb);
RedisKeeperServer redisKeeperServer = startRedisKeeperServerAndConnectToFakeRedis();
waitConditionUntilTimeOut(() -> MASTER_STATE.REDIS_REPL_CONNECTED == redisKeeperServer.getRedisMaster().getMasterState(), replicationTimeoutMilli * 5);
}
use of com.ctrip.xpipe.redis.keeper.RedisKeeperServer in project x-pipe by ctripcorp.
the class KeeperContainerServiceTest method testAddKeeper.
@Test
public void testAddKeeper() throws Exception {
RedisKeeperServer redisKeeperServer = keeperContainerService.add(someKeeperTransMeta);
verify(componentRegistry, times(1)).add(redisKeeperServer);
assertEquals(someCluster, redisKeeperServer.getClusterId());
assertEquals(someShard, redisKeeperServer.getShardId());
assertEquals(somePort, redisKeeperServer.getListeningPort());
}
Aggregations