use of com.palantir.leader.PingableLeader in project atlasdb by palantir.
the class LeaderPingHealthCheckTest method getMockOfPingableLeaderWherePingThrows.
private PingableLeader getMockOfPingableLeaderWherePingThrows() {
PingableLeader mockLeader = mock(PingableLeader.class);
when(mockLeader.ping()).thenThrow(mock(AtlasDbRemoteException.class));
return mockLeader;
}
use of com.palantir.leader.PingableLeader in project atlasdb by palantir.
the class LeaderPingHealthCheckTest method shouldBeUnhealthyIfQuorumNodesAreNotUpAndOnePingedSuccessfully.
@Test
public void shouldBeUnhealthyIfQuorumNodesAreNotUpAndOnePingedSuccessfully() throws Exception {
PingableLeader leader1 = getMockOfPingableLeaderWherePingReturns(true);
PingableLeader leader2 = getMockOfPingableLeaderWherePingThrows();
PingableLeader leader3 = getMockOfPingableLeaderWherePingThrows();
ImmutableSet<PingableLeader> leaders = ImmutableSet.of(leader1, leader2, leader3);
assertEquals(TimeLockStatus.NO_QUORUM, new LeaderPingHealthCheck(leaders).getStatus());
}
use of com.palantir.leader.PingableLeader in project atlasdb by palantir.
the class PaxosTimeLockServerIntegrationTest method waitForClusterToStabilize.
@BeforeClass
public static void waitForClusterToStabilize() {
PingableLeader leader = AtlasDbHttpClients.createProxy(Optional.of(TestProxies.SSL_SOCKET_FACTORY), "https://localhost:" + TIMELOCK_SERVER_HOLDER.getTimelockPort(), PingableLeader.class);
Awaitility.await().atMost(30, TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS).until(() -> {
try {
// Returns true only if this node is ready to serve timestamps and locks on all clients.
CLIENTS.forEach(client -> getTimelockService(client).getFreshTimestamp());
CLIENTS.forEach(client -> getTimelockService(client).currentTimeMillis());
CLIENTS.forEach(client -> getLockService(client).currentTimeMillis());
return leader.ping();
} catch (Throwable t) {
return false;
}
});
}
Aggregations