use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.HealthDetailsFreeIpaResponse in project cloudbreak by hortonworks.
the class FreeIpaStackHealthDetailsServiceTest method testTwoStoppedNodes.
@Test
public void testTwoStoppedNodes() throws Exception {
InstanceMetaData im1 = getInstance1();
im1.setInstanceStatus(InstanceStatus.STOPPED);
InstanceMetaData im2 = getInstance2();
im2.setInstanceStatus(InstanceStatus.STOPPED);
Mockito.when(stackService.getByEnvironmentCrnAndAccountIdWithListsAndMdcContext(anyString(), anyString())).thenReturn(getStackTwoInstances(im1, im2));
HealthDetailsFreeIpaResponse response = underTest.getHealthDetails(ENVIRONMENT_ID, ACCOUNT_ID);
Assert.assertEquals(Status.STOPPED, 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 testHealthySingleNode.
@Test
public void testHealthySingleNode() throws Exception {
Mockito.when(stackService.getByEnvironmentCrnAndAccountIdWithListsAndMdcContext(anyString(), anyString())).thenReturn(getStack());
Mockito.when(freeIpaInstanceHealthDetailsService.getInstanceHealthDetails(any(), any())).thenReturn(getGoodDetails1());
HealthDetailsFreeIpaResponse response = underTest.getHealthDetails(ENVIRONMENT_ID, ACCOUNT_ID);
Assert.assertEquals(Status.AVAILABLE, response.getStatus());
Assert.assertFalse(response.getNodeHealthDetails().isEmpty());
for (NodeHealthDetails nodeHealth : response.getNodeHealthDetails()) {
Assert.assertTrue(nodeHealth.getIssues().isEmpty());
Assert.assertEquals(InstanceStatus.CREATED, nodeHealth.getStatus());
}
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.HealthDetailsFreeIpaResponse in project cloudbreak by hortonworks.
the class FreeIpaStackHealthDetailsServiceTest method testTwoFailedNodes.
@Test
public void testTwoFailedNodes() throws Exception {
InstanceMetaData im1 = getInstance1();
im1.setInstanceStatus(InstanceStatus.FAILED);
InstanceMetaData im2 = getInstance2();
im2.setInstanceStatus(InstanceStatus.FAILED);
Mockito.when(stackService.getByEnvironmentCrnAndAccountIdWithListsAndMdcContext(anyString(), anyString())).thenReturn(getStackTwoInstances(im1, im2));
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 testNodeDeletedOnProvider.
@Test
public void testNodeDeletedOnProvider() throws Exception {
Mockito.when(stackService.getByEnvironmentCrnAndAccountIdWithListsAndMdcContext(anyString(), anyString())).thenReturn(getDeletedStack());
HealthDetailsFreeIpaResponse response = underTest.getHealthDetails(ENVIRONMENT_ID, ACCOUNT_ID);
Assert.assertEquals(Status.UNHEALTHY, response.getStatus());
Assert.assertFalse(response.getNodeHealthDetails().isEmpty());
Assert.assertTrue(response.getNodeHealthDetails().stream().findFirst().get().getStatus() == InstanceStatus.TERMINATED);
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.HealthDetailsFreeIpaResponse in project cloudbreak by hortonworks.
the class FreeIpaStackHealthDetailsServiceTest method testOneStoppedOneGoodNode.
@Test
public void testOneStoppedOneGoodNode() throws Exception {
InstanceMetaData im1 = getInstance1();
im1.setInstanceStatus(InstanceStatus.STOPPED);
InstanceMetaData im2 = getInstance2();
Mockito.when(stackService.getByEnvironmentCrnAndAccountIdWithListsAndMdcContext(anyString(), anyString())).thenReturn(getStackTwoInstances(im1, im2));
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