Search in sources :

Example 11 with InstanceMetaData

use of com.sequenceiq.freeipa.entity.InstanceMetaData 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);
}
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 12 with InstanceMetaData

use of com.sequenceiq.freeipa.entity.InstanceMetaData in project cloudbreak by hortonworks.

the class FreeIpaStackHealthDetailsServiceTest method getDeletedStack.

private Stack getDeletedStack() {
    Stack stack = new Stack();
    stack.setResourceCrn(ENVIRONMENT_ID);
    InstanceGroup instanceGroup = new InstanceGroup();
    stack.getInstanceGroups().add(instanceGroup);
    instanceGroup.setInstanceGroupType(InstanceGroupType.MASTER);
    InstanceMetaData instanceMetaData = new InstanceMetaData();
    instanceMetaData.setInstanceStatus(InstanceStatus.TERMINATED);
    instanceMetaData.setInstanceId(INSTANCE_ID1);
    instanceGroup.setInstanceMetaData(Sets.newHashSet(instanceMetaData));
    instanceMetaData.setDiscoveryFQDN(HOST1);
    return stack;
}
Also used : InstanceMetaData(com.sequenceiq.freeipa.entity.InstanceMetaData) Stack(com.sequenceiq.freeipa.entity.Stack) InstanceGroup(com.sequenceiq.freeipa.entity.InstanceGroup)

Example 13 with InstanceMetaData

use of com.sequenceiq.freeipa.entity.InstanceMetaData 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);
}
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 14 with InstanceMetaData

use of com.sequenceiq.freeipa.entity.InstanceMetaData in project cloudbreak by hortonworks.

the class FreeipaCheckerTest method createInstanceMetaDataSet.

private Set<InstanceMetaData> createInstanceMetaDataSet() {
    Set<InstanceMetaData> instanceMetaDataSet = new HashSet<>();
    InstanceMetaData instance1 = new InstanceMetaData();
    instance1.setInstanceId("id1");
    InstanceMetaData instance2 = new InstanceMetaData();
    instance2.setInstanceId("id2");
    instanceMetaDataSet.add(instance1);
    instanceMetaDataSet.add(instance2);
    return instanceMetaDataSet;
}
Also used : InstanceMetaData(com.sequenceiq.freeipa.entity.InstanceMetaData) HashSet(java.util.HashSet)

Example 15 with InstanceMetaData

use of com.sequenceiq.freeipa.entity.InstanceMetaData in project cloudbreak by hortonworks.

the class RepairInstancesServiceTest method init.

@BeforeAll
public static void init() {
    stack1 = new Stack();
    stack1.setResourceCrn(ENVIRONMENT_ID1);
    stack1.setEnvironmentCrn(ENVIRONMENT_ID1);
    InstanceGroup instanceGroup = new InstanceGroup();
    stack1.getInstanceGroups().add(instanceGroup);
    instanceGroup.setInstanceGroupType(InstanceGroupType.MASTER);
    InstanceMetaData instanceMetaData = new InstanceMetaData();
    instanceGroup.setInstanceMetaData(Sets.newHashSet(instanceMetaData));
    instanceMetaData.setDiscoveryFQDN("host.domain");
    instanceMetaData.setInstanceId("instance_1");
    stack2 = new Stack();
    stack2.setResourceCrn(ENVIRONMENT_ID2);
    stack2.setEnvironmentCrn(ENVIRONMENT_ID2);
    instanceGroup = new InstanceGroup();
    stack2.getInstanceGroups().add(instanceGroup);
    instanceGroup.setInstanceGroupType(InstanceGroupType.MASTER);
    instanceMetaData = new InstanceMetaData();
    instanceGroup.setInstanceMetaData(Sets.newHashSet(instanceMetaData));
    instanceMetaData.setDiscoveryFQDN("host1.domain");
    instanceMetaData.setInstanceId("instance_1");
    instanceMetaData = new InstanceMetaData();
    instanceGroup.getInstanceMetaData().add(instanceMetaData);
    instanceMetaData.setDiscoveryFQDN("host2.domain");
    instanceMetaData.setInstanceId("instance_2");
}
Also used : InstanceMetaData(com.sequenceiq.freeipa.entity.InstanceMetaData) Stack(com.sequenceiq.freeipa.entity.Stack) InstanceGroup(com.sequenceiq.freeipa.entity.InstanceGroup) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

InstanceMetaData (com.sequenceiq.freeipa.entity.InstanceMetaData)163 Stack (com.sequenceiq.freeipa.entity.Stack)104 Test (org.junit.jupiter.api.Test)77 InstanceGroup (com.sequenceiq.freeipa.entity.InstanceGroup)30 List (java.util.List)19 Logger (org.slf4j.Logger)19 LoggerFactory (org.slf4j.LoggerFactory)19 Map (java.util.Map)18 Collectors (java.util.stream.Collectors)18 Inject (javax.inject.Inject)18 Set (java.util.Set)16 CloudInstance (com.sequenceiq.cloudbreak.cloud.model.CloudInstance)13 GatewayConfig (com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)13 Node (com.sequenceiq.cloudbreak.common.orchestration.Node)12 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)11 StackService (com.sequenceiq.freeipa.service.stack.StackService)10 ArrayList (java.util.ArrayList)10 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)9 HealthDetailsFreeIpaResponse (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.HealthDetailsFreeIpaResponse)9 Operation (com.sequenceiq.freeipa.entity.Operation)9