Search in sources :

Example 16 with HealthDetailsFreeIpaResponse

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.HealthDetailsFreeIpaResponse in project cloudbreak by hortonworks.

the class FreeIpaStackHealthDetailsServiceTest method testUnhealthySingleNode.

@Test
public void testUnhealthySingleNode() throws Exception {
    Mockito.when(stackService.getByEnvironmentCrnAndAccountIdWithListsAndMdcContext(anyString(), anyString())).thenReturn(getStack());
    Mockito.when(freeIpaInstanceHealthDetailsService.getInstanceHealthDetails(any(), any())).thenReturn(getUnhealthyDetails1());
    HealthDetailsFreeIpaResponse response = underTest.getHealthDetails(ENVIRONMENT_ID, ACCOUNT_ID);
    Assert.assertEquals(Status.UNHEALTHY, response.getStatus());
    Assert.assertFalse(response.getNodeHealthDetails().isEmpty());
    for (NodeHealthDetails nodeHealth : response.getNodeHealthDetails()) {
        Assert.assertFalse(nodeHealth.getIssues().isEmpty());
        Assert.assertEquals(InstanceStatus.UNHEALTHY, nodeHealth.getStatus());
    }
}
Also used : NodeHealthDetails(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.NodeHealthDetails) HealthDetailsFreeIpaResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.HealthDetailsFreeIpaResponse) Test(org.junit.jupiter.api.Test)

Example 17 with HealthDetailsFreeIpaResponse

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.HealthDetailsFreeIpaResponse in project cloudbreak by hortonworks.

the class FreeIpaStackHealthDetailsServiceTest method testTwoUnresponsiveNodes.

@Test
public void testTwoUnresponsiveNodes() throws Exception {
    InstanceMetaData im1 = getInstance1();
    InstanceMetaData im2 = getInstance2();
    Mockito.when(stackService.getByEnvironmentCrnAndAccountIdWithListsAndMdcContext(anyString(), anyString())).thenReturn(getStackTwoInstances(im1, im2));
    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() == 2);
}
Also used : InstanceMetaData(com.sequenceiq.freeipa.entity.InstanceMetaData) HealthDetailsFreeIpaResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.HealthDetailsFreeIpaResponse) Test(org.junit.jupiter.api.Test)

Example 18 with HealthDetailsFreeIpaResponse

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.HealthDetailsFreeIpaResponse in project cloudbreak by hortonworks.

the class RepairInstancesServiceTest method getMockDetails2.

private HealthDetailsFreeIpaResponse getMockDetails2() {
    HealthDetailsFreeIpaResponse healthDetailsFreeIpaResponse = new HealthDetailsFreeIpaResponse();
    healthDetailsFreeIpaResponse.setCrn(ENVIRONMENT_ID2);
    healthDetailsFreeIpaResponse.setName("test");
    healthDetailsFreeIpaResponse.setStatus(Status.AVAILABLE);
    NodeHealthDetails nodeHealthDetails = new NodeHealthDetails();
    nodeHealthDetails.setInstanceId("instance_1");
    nodeHealthDetails.setStatus(InstanceStatus.CREATED);
    healthDetailsFreeIpaResponse.addNodeHealthDetailsFreeIpaResponses(nodeHealthDetails);
    nodeHealthDetails = new NodeHealthDetails();
    nodeHealthDetails.setInstanceId("instance_2");
    nodeHealthDetails.setStatus(InstanceStatus.UNREACHABLE);
    healthDetailsFreeIpaResponse.addNodeHealthDetailsFreeIpaResponses(nodeHealthDetails);
    return healthDetailsFreeIpaResponse;
}
Also used : NodeHealthDetails(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.NodeHealthDetails) HealthDetailsFreeIpaResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.HealthDetailsFreeIpaResponse)

Example 19 with HealthDetailsFreeIpaResponse

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.HealthDetailsFreeIpaResponse in project cloudbreak by hortonworks.

the class RepairInstancesServiceTest method getMockDetails1.

private HealthDetailsFreeIpaResponse getMockDetails1() {
    HealthDetailsFreeIpaResponse healthDetailsFreeIpaResponse = new HealthDetailsFreeIpaResponse();
    healthDetailsFreeIpaResponse.setCrn(ENVIRONMENT_ID1);
    healthDetailsFreeIpaResponse.setName("test");
    healthDetailsFreeIpaResponse.setStatus(Status.AVAILABLE);
    NodeHealthDetails nodeHealthDetails = new NodeHealthDetails();
    nodeHealthDetails.setInstanceId("instance_1");
    nodeHealthDetails.setStatus(InstanceStatus.TERMINATED);
    healthDetailsFreeIpaResponse.addNodeHealthDetailsFreeIpaResponses(nodeHealthDetails);
    return healthDetailsFreeIpaResponse;
}
Also used : NodeHealthDetails(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.NodeHealthDetails) HealthDetailsFreeIpaResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.HealthDetailsFreeIpaResponse)

Aggregations

HealthDetailsFreeIpaResponse (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.HealthDetailsFreeIpaResponse)18 Test (org.junit.jupiter.api.Test)13 NodeHealthDetails (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.NodeHealthDetails)9 InstanceMetaData (com.sequenceiq.freeipa.entity.InstanceMetaData)9 Stack (com.sequenceiq.freeipa.entity.Stack)2 CloudbreakServiceException (com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException)1