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);
}
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;
}
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);
}
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;
}
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");
}
Aggregations