use of com.sequenceiq.cloudbreak.domain.InstanceMetaData in project cloudbreak by hortonworks.
the class ComponentLocatorServiceTest method createHostGroup.
private HostGroup createHostGroup(String name, String hostname) {
HostGroup hg = new HostGroup();
hg.setName(name);
Constraint constraint = new Constraint();
hg.setConstraint(constraint);
InstanceGroup ig = new InstanceGroup();
constraint.setInstanceGroup(ig);
InstanceMetaData im = new InstanceMetaData();
im.setDiscoveryFQDN(hostname);
ig.setInstanceMetaData(ImmutableSet.of(im));
return hg;
}
use of com.sequenceiq.cloudbreak.domain.InstanceMetaData in project cloudbreak by hortonworks.
the class CandidateUnhealthyInstancesSelectorTest method shouldSelectInstancesWithUnknownStatus.
@Test
public void shouldSelectInstancesWithUnknownStatus() throws CloudbreakSecuritySetupException {
Map<String, String> hostStatuses = new HashMap<>();
hostStatuses.put("ip-10-0-0-1.ec2.internal", "HEALTHY");
hostStatuses.put("ip-10-0-0-2.ec2.internal", "UNKNOWN");
hostStatuses.put("ip-10-0-0-3.ec2.internal", "HEALTHY");
hostStatuses.put("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));
}
use of com.sequenceiq.cloudbreak.domain.InstanceMetaData in project cloudbreak by hortonworks.
the class CandidateUnhealthyInstancesSelectorTest method shouldRemoveNonCoreGroupNodes.
@Test
public void shouldRemoveNonCoreGroupNodes() throws CloudbreakSecuritySetupException {
Map<String, String> hostStatuses = new HashMap<>();
hostStatuses.put("ip-10-0-0-1.ec2.internal", "HEALTHY");
hostStatuses.put("ip-10-0-0-2.ec2.internal", "UNKNOWN");
hostStatuses.put("ip-10-0-0-3.ec2.internal", "UNKNOWN");
hostStatuses.put("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(2, candidateUnhealthyInstances.size());
assertTrue(candidateUnhealthyInstances.contains(imd1));
assertTrue(candidateUnhealthyInstances.contains(imd2));
}
use of com.sequenceiq.cloudbreak.domain.InstanceMetaData in project cloudbreak by hortonworks.
the class CandidateUnhealthyInstancesSelectorTest method setupInstanceMetaData.
private InstanceMetaData setupInstanceMetaData(Long stackId, String privateIp, InstanceGroup group) {
InstanceMetaData imd1 = mock(InstanceMetaData.class);
when(imd1.getInstanceGroup()).thenReturn(group);
when(instanceMetaDataRepository.findHostInStack(stackId, privateIp)).thenReturn(imd1);
return imd1;
}
use of com.sequenceiq.cloudbreak.domain.InstanceMetaData in project cloudbreak by hortonworks.
the class StackRepairServiceTest method setupInstanceMetadata.
private void setupInstanceMetadata(Long stackId, String instanceId, String privateIp) {
InstanceMetaData imd1 = mock(InstanceMetaData.class);
when(imd1.getDiscoveryFQDN()).thenReturn(privateIp);
when(instanceMetaDataRepository.findByInstanceId(stackId, instanceId)).thenReturn(imd1);
}
Aggregations