use of com.sequenceiq.freeipa.client.FreeIpaHealthCheckClient in project cloudbreak by hortonworks.
the class FreeIpaInstanceHealthDetailsServiceTest method testCheckFreeIpaHealthUnhealthyNodeWithFiltering.
@Test
public void testCheckFreeIpaHealthUnhealthyNodeWithFiltering() throws Exception {
FreeIpaHealthCheckClient mockIpaHealthClient = Mockito.mock(FreeIpaHealthCheckClient.class);
Mockito.when(healthCheckAvailabilityChecker.isCdpFreeIpaHeathAgentAvailable(any())).thenReturn(true);
Mockito.when(freeIpaHealthCheckClientFactory.getClient(any(), any())).thenReturn(mockIpaHealthClient);
Mockito.when(mockIpaHealthClient.nodeHealth()).thenReturn(getErrorPayloadWithMixedResults(HOST));
InstanceMetaData instanceMetaData = getInstance();
Stack stack = getStack(Set.of(instanceMetaData));
RPCResponse<Boolean> response = underTest.checkFreeIpaHealth(stack, instanceMetaData);
assertFalse(response.getResult());
assertEquals("node health check", response.getFirstRpcMessage().getName());
CheckResult checkResult = JsonUtil.readValue(response.getFirstRpcMessage().getMessage(), CheckResult.class);
assertEquals(1, checkResult.getChecks().size());
assertEquals("UNHEALTHY", checkResult.getChecks().get(0).getStatus());
assertEquals(1, checkResult.getPluginStats().size());
assertEquals("UNHEALTHY", checkResult.getPluginStats().get(0).getStatus());
assertEquals(HOST, checkResult.getHost());
assertEquals(HOST, checkResult.getPluginStats().get(0).getHost());
}
use of com.sequenceiq.freeipa.client.FreeIpaHealthCheckClient in project cloudbreak by hortonworks.
the class FreeIpaInstanceHealthDetailsServiceTest method testCheckFreeIpaHealthHealthyNode.
@Test
public void testCheckFreeIpaHealthHealthyNode() throws Exception {
FreeIpaHealthCheckClient mockIpaHealthClient = Mockito.mock(FreeIpaHealthCheckClient.class);
Mockito.when(healthCheckAvailabilityChecker.isCdpFreeIpaHeathAgentAvailable(any())).thenReturn(true);
Mockito.when(freeIpaHealthCheckClientFactory.getClient(any(), any())).thenReturn(mockIpaHealthClient);
Mockito.when(mockIpaHealthClient.nodeHealth()).thenReturn(getGoodPayload(HOST));
InstanceMetaData instanceMetaData = getInstance();
Stack stack = getStack(Set.of(instanceMetaData));
RPCResponse<Boolean> response = underTest.checkFreeIpaHealth(stack, instanceMetaData);
Assertions.assertTrue(response.getResult());
}
Aggregations