use of com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup in project cloudbreak by hortonworks.
the class InstanceGroupToInstanceGroupDetailsConverterTest method createInstanceGroup.
private InstanceGroup createInstanceGroup() {
InstanceGroup instanceGroup = new InstanceGroup();
Template template = new Template();
Map<String, Object> attributes = Map.of("encrypted", Boolean.TRUE, "everything-else", Boolean.TRUE);
template.setAttributes(new Json(attributes));
template.setCloudPlatform("AWS");
instanceGroup.setTemplate(template);
return instanceGroup;
}
use of com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup in project cloudbreak by hortonworks.
the class StackStopRestrictionServiceTest method stoppableWhenEphemeralOnlyAndAfter253CbVersion.
@Test
public void stoppableWhenEphemeralOnlyAndAfter253CbVersion() {
Set<InstanceGroup> groups = new HashSet<>();
groups.add(createGroup(List.of("ebs"), temporaryStorage, "master"));
groups.add(createGroup(List.of(AwsDiskType.Ephemeral.value()), temporaryStorage, "worker"));
when(componentConfigProviderService.getCloudbreakDetails(any())).thenReturn(new CloudbreakDetails("2.53.0-XXb"));
createServiceComponentMap(Set.of(ServiceComponent.of("YARN", "NODEMANAGER"), ServiceComponent.of("HDFS", "GATEWAY"), ServiceComponent.of("YARN", "GATEWAY")));
StopRestrictionReason actual = underTest.isInfrastructureStoppable(createStack("AWS", groups));
Assertions.assertEquals(StopRestrictionReason.NONE, actual);
}
use of com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup in project cloudbreak by hortonworks.
the class StackStopRestrictionServiceTest method infrastructureShouldBeStoppableForValidInstanceGroups.
@Test
public void infrastructureShouldBeStoppableForValidInstanceGroups() {
Set<InstanceGroup> groups = new HashSet<>();
groups.add(createGroup(List.of("ebs"), temporaryStorage, "worker"));
InstanceGroup master = createGroup(List.of("ebs"), temporaryStorage, "master");
master.getTemplate().setAttributes(new JsonToString().convertToEntityAttribute("{\"sshLocation\":\"0.0.0.0/0\",\"encrypted\":false}"));
groups.add(master);
when(componentConfigProviderService.getCloudbreakDetails(any())).thenReturn(new CloudbreakDetails("2.47.0-bXX"));
Assertions.assertEquals(StopRestrictionReason.NONE, underTest.isInfrastructureStoppable(createStack("AWS", groups)));
when(componentConfigProviderService.getCloudbreakDetails(any())).thenReturn(new CloudbreakDetails("2.48.0-bXX"));
Assertions.assertEquals(StopRestrictionReason.NONE, underTest.isInfrastructureStoppable(createStack("AWS", groups)));
}
use of com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup in project cloudbreak by hortonworks.
the class StackStopRestrictionServiceTest method stoppableWhenEphemeralOnlyAndBefore253CbVersionAndAfter253SaltCbVersion.
@Test
public void stoppableWhenEphemeralOnlyAndBefore253CbVersionAndAfter253SaltCbVersion() {
Set<InstanceGroup> groups = new HashSet<>();
groups.add(createGroup(List.of("ebs"), temporaryStorage, "master"));
groups.add(createGroup(List.of(AwsDiskType.Ephemeral.value()), temporaryStorage, "worker"));
when(componentConfigProviderService.getCloudbreakDetails(any())).thenReturn(new CloudbreakDetails("2.48.0-XXb"));
when(clusterComponentProvider.getSaltStateComponentCbVersion(any())).thenReturn("2.53.0-XXb");
createServiceComponentMap(Set.of(ServiceComponent.of("YARN", "NODEMANAGER"), ServiceComponent.of("HDFS", "GATEWAY"), ServiceComponent.of("YARN", "GATEWAY")));
StopRestrictionReason actual = underTest.isInfrastructureStoppable(createStack("AWS", groups));
Assertions.assertEquals(StopRestrictionReason.NONE, actual);
}
use of com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup in project cloudbreak by hortonworks.
the class StackStopRestrictionServiceTest method infrastructureShouldBeStoppableForEBSVolumesOnly.
@Test
public void infrastructureShouldBeStoppableForEBSVolumesOnly() {
Set<InstanceGroup> groups = new HashSet<>();
groups.add(createGroup(List.of("ebs"), temporaryStorage, "master"));
when(componentConfigProviderService.getCloudbreakDetails(any())).thenReturn(new CloudbreakDetails("2.48.0-XXb"));
StopRestrictionReason actual = underTest.isInfrastructureStoppable(createStack("AWS", groups));
Assertions.assertEquals(StopRestrictionReason.NONE, actual);
}
Aggregations