use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.HealthDetailsFreeIpaResponse in project cloudbreak by hortonworks.
the class FreeIpaStackHealthDetailsServiceTest method testTwoGoodNodes.
@Test
public void testTwoGoodNodes() throws Exception {
InstanceMetaData im1 = getInstance1();
InstanceMetaData im2 = getInstance2();
Mockito.when(stackService.getByEnvironmentCrnAndAccountIdWithListsAndMdcContext(anyString(), anyString())).thenReturn(getStackTwoInstances(im1, im2));
Mockito.when(freeIpaInstanceHealthDetailsService.getInstanceHealthDetails(any(), eq(im1))).thenReturn(getGoodDetails1());
Mockito.when(freeIpaInstanceHealthDetailsService.getInstanceHealthDetails(any(), eq(im2))).thenReturn(getGoodDetails2());
HealthDetailsFreeIpaResponse response = underTest.getHealthDetails(ENVIRONMENT_ID, ACCOUNT_ID);
Assert.assertEquals(Status.AVAILABLE, response.getStatus());
Assert.assertTrue(response.getNodeHealthDetails().size() == 2);
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.HealthDetailsFreeIpaResponse in project cloudbreak by hortonworks.
the class FreeIpaStackHealthDetailsServiceTest method testUnresponsiveSingleNode.
@Test
public void testUnresponsiveSingleNode() throws Exception {
Mockito.when(stackService.getByEnvironmentCrnAndAccountIdWithListsAndMdcContext(anyString(), anyString())).thenReturn(getStack());
Mockito.when(freeIpaInstanceHealthDetailsService.getInstanceHealthDetails(any(), any())).thenThrow(ipaClientException);
HealthDetailsFreeIpaResponse response = underTest.getHealthDetails(ENVIRONMENT_ID, ACCOUNT_ID);
Assert.assertEquals(Status.UNREACHABLE, response.getStatus());
Assert.assertTrue(response.getNodeHealthDetails().size() == 1);
for (NodeHealthDetails nodeHealth : response.getNodeHealthDetails()) {
Assert.assertTrue(!nodeHealth.getIssues().isEmpty());
Assert.assertEquals(InstanceStatus.UNREACHABLE, nodeHealth.getStatus());
Assert.assertTrue(nodeHealth.getIssues().size() == 1);
Assert.assertTrue(nodeHealth.getIssues().get(0).equals("Error during healthcheck"));
}
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.HealthDetailsFreeIpaResponse in project cloudbreak by hortonworks.
the class FreeIpaStackHealthDetailsServiceTest method testUnresponsiveSecondaryNode.
@Test
public void testUnresponsiveSecondaryNode() throws Exception {
InstanceMetaData im1 = getInstance1();
InstanceMetaData im2 = getInstance2();
Mockito.when(stackService.getByEnvironmentCrnAndAccountIdWithListsAndMdcContext(anyString(), anyString())).thenReturn(getStackTwoInstances(im1, im2));
Mockito.when(freeIpaInstanceHealthDetailsService.getInstanceHealthDetails(any(), eq(im1))).thenReturn(getGoodDetails1());
Mockito.when(freeIpaInstanceHealthDetailsService.getInstanceHealthDetails(any(), eq(im2))).thenThrow(ipaClientException);
HealthDetailsFreeIpaResponse response = underTest.getHealthDetails(ENVIRONMENT_ID, ACCOUNT_ID);
Assert.assertEquals(Status.UNHEALTHY, response.getStatus());
Assert.assertTrue(response.getNodeHealthDetails().size() == 2);
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.HealthDetailsFreeIpaResponse in project cloudbreak by hortonworks.
the class FreeIpaStackHealthDetailsServiceTest method testOneGoodOneUnhealthyNode.
@Test
public void testOneGoodOneUnhealthyNode() throws Exception {
InstanceMetaData im1 = getInstance1();
InstanceMetaData im2 = getInstance2();
Mockito.when(stackService.getByEnvironmentCrnAndAccountIdWithListsAndMdcContext(anyString(), anyString())).thenReturn(getStackTwoInstances(im1, im2));
Mockito.when(freeIpaInstanceHealthDetailsService.getInstanceHealthDetails(any(), eq(im1))).thenReturn(getGoodDetails1());
Mockito.when(freeIpaInstanceHealthDetailsService.getInstanceHealthDetails(any(), eq(im2))).thenReturn(getUnhealthyDetails2());
HealthDetailsFreeIpaResponse response = underTest.getHealthDetails(ENVIRONMENT_ID, ACCOUNT_ID);
Assert.assertEquals(Status.UNHEALTHY, response.getStatus());
Assert.assertTrue(response.getNodeHealthDetails().size() == 2);
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.HealthDetailsFreeIpaResponse in project cloudbreak by hortonworks.
the class FreeIpaStackHealthDetailsServiceTest method testTwoUnhealthyNodes.
@Test
public void testTwoUnhealthyNodes() throws Exception {
InstanceMetaData im1 = getInstance1();
InstanceMetaData im2 = getInstance2();
Mockito.when(stackService.getByEnvironmentCrnAndAccountIdWithListsAndMdcContext(anyString(), anyString())).thenReturn(getStackTwoInstances(im1, im2));
Mockito.when(freeIpaInstanceHealthDetailsService.getInstanceHealthDetails(any(), eq(im1))).thenReturn(getUnhealthyDetails1());
Mockito.when(freeIpaInstanceHealthDetailsService.getInstanceHealthDetails(any(), eq(im2))).thenReturn(getUnhealthyDetails2());
HealthDetailsFreeIpaResponse response = underTest.getHealthDetails(ENVIRONMENT_ID, ACCOUNT_ID);
Assert.assertEquals(Status.UNHEALTHY, response.getStatus());
Assert.assertTrue(response.getNodeHealthDetails().size() == 2);
}
Aggregations