use of com.sequenceiq.cloudbreak.cloud.model.HostName in project cloudbreak by hortonworks.
the class CandidateUnhealthyInstancesSelectorTest method shouldRemoveNonCoreGroupNodes.
@Test
public void shouldRemoveNonCoreGroupNodes() {
Map<HostName, String> hostStatuses = new HashMap<>();
hostStatuses.put(hostName("ip-10-0-0-1.ec2.internal"), "HEALTHY");
hostStatuses.put(hostName("ip-10-0-0-2.ec2.internal"), "UNKNOWN");
hostStatuses.put(hostName("ip-10-0-0-3.ec2.internal"), "UNKNOWN");
hostStatuses.put(hostName("ip-10-0-0-4.ec2.internal"), "UNKNOWN");
when(clusterService.getHostStatuses(stack.getId())).thenReturn(hostStatuses);
InstanceGroup slaveGroup = setupInstanceGroup(InstanceGroupType.CORE);
InstanceGroup gatewayGroup = setupInstanceGroup(InstanceGroupType.GATEWAY);
InstanceMetaData imd1 = setupInstanceMetaData(stack.getId(), "ip-10-0-0-2.ec2.internal", slaveGroup);
InstanceMetaData imd2 = setupInstanceMetaData(stack.getId(), "ip-10-0-0-4.ec2.internal", slaveGroup);
setupInstanceMetaData(stack.getId(), "ip-10-0-0-3.ec2.internal", gatewayGroup);
Set<InstanceMetaData> candidateUnhealthyInstances = undertest.selectCandidateUnhealthyInstances(stack.getId());
assertEquals(2L, candidateUnhealthyInstances.size());
assertTrue(candidateUnhealthyInstances.contains(imd1));
assertTrue(candidateUnhealthyInstances.contains(imd2));
}
use of com.sequenceiq.cloudbreak.cloud.model.HostName in project cloudbreak by hortonworks.
the class CandidateUnhealthyInstancesSelectorTest method shouldSelectInstancesWithUnknownStatus.
@Test
public void shouldSelectInstancesWithUnknownStatus() {
Map<HostName, String> hostStatuses = new HashMap<>();
hostStatuses.put(hostName("ip-10-0-0-1.ec2.internal"), "HEALTHY");
hostStatuses.put(hostName("ip-10-0-0-2.ec2.internal"), "UNKNOWN");
hostStatuses.put(hostName("ip-10-0-0-3.ec2.internal"), "HEALTHY");
hostStatuses.put(hostName("ip-10-0-0-4.ec2.internal"), "UNKNOWN");
when(clusterService.getHostStatuses(stack.getId())).thenReturn(hostStatuses);
InstanceGroup slaveGroup = setupInstanceGroup(InstanceGroupType.CORE);
InstanceMetaData imd1 = setupInstanceMetaData(stack.getId(), "ip-10-0-0-2.ec2.internal", slaveGroup);
InstanceMetaData imd2 = setupInstanceMetaData(stack.getId(), "ip-10-0-0-4.ec2.internal", slaveGroup);
Set<InstanceMetaData> candidateUnhealthyInstances = undertest.selectCandidateUnhealthyInstances(stack.getId());
assertEquals(2, candidateUnhealthyInstances.size());
assertTrue(candidateUnhealthyInstances.contains(imd1));
assertTrue(candidateUnhealthyInstances.contains(imd2));
}
Aggregations