use of com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup in project cloudbreak by hortonworks.
the class StackStopRestrictionServiceTest method infrastructureShouldBeStoppableForMixedStorage.
@Test
public void infrastructureShouldBeStoppableForMixedStorage() {
Set<InstanceGroup> groups = new HashSet<>();
groups.add(createGroup(List.of("ebs"), temporaryStorage, "master"));
groups.add(createGroup(List.of(AwsDiskType.Ephemeral.value(), AwsDiskType.Gp2.value()), temporaryStorage, "worker"));
when(componentConfigProviderService.getCloudbreakDetails(any())).thenReturn(new CloudbreakDetails("2.47.0-bXX"));
Assertions.assertEquals(StopRestrictionReason.EPHEMERAL_VOLUMES, 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 notStoppableWhenEphemeralOnlyAndServiceNotPermitted.
@Test
public void notStoppableWhenEphemeralOnlyAndServiceNotPermitted() {
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", "DATANODE"), ServiceComponent.of("YARN", "GATEWAY")));
StopRestrictionReason actual = underTest.isInfrastructureStoppable(createStack("AWS", groups));
Assertions.assertEquals(StopRestrictionReason.EPHEMERAL_VOLUMES, actual);
}
use of com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup in project cloudbreak by hortonworks.
the class StackStopRestrictionServiceTest method infrastructureShouldNotBeStoppableIfTemporaryStorageIsEphemeralVolumesBefore248CbVersion.
@Test
public void infrastructureShouldNotBeStoppableIfTemporaryStorageIsEphemeralVolumesBefore248CbVersion() {
Set<InstanceGroup> groups = new HashSet<>();
groups.add(createGroup(List.of("ebs"), temporaryStorage, "master"));
groups.add(createGroup(List.of("ebs"), TemporaryStorage.EPHEMERAL_VOLUMES, "worker"));
when(componentConfigProviderService.getCloudbreakDetails(any())).thenReturn(new CloudbreakDetails("2.47.0-bXX"));
StopRestrictionReason actual = underTest.isInfrastructureStoppable(createStack("AWS", groups));
Assertions.assertEquals(StopRestrictionReason.EPHEMERAL_VOLUME_CACHING, actual);
}
use of com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup in project cloudbreak by hortonworks.
the class StackStopRestrictionServiceTest method stoppableWhenEphemeralOnlyAndAfter253CbVersionAndNodemanagerOnly.
@Test
public void stoppableWhenEphemeralOnlyAndAfter253CbVersionAndNodemanagerOnly() {
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")));
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 InstanceGroupEphemeralVolumeCheckerTest method createGroup.
private InstanceGroup createGroup(List<Pair<String, VolumeUsageType>> volumeTypes, InstanceGroupType groupType, String groupName) {
InstanceGroup group = new InstanceGroup();
group.setInstanceGroupType(groupType);
group.setGroupName(groupName);
Template template = new Template();
group.setTemplate(template);
template.setVolumeTemplates(Sets.newHashSet());
for (Pair<String, VolumeUsageType> volumeType : volumeTypes) {
VolumeTemplate volumeTemplate = new VolumeTemplate();
volumeTemplate.setVolumeType(volumeType.getLeft());
volumeTemplate.setUsageType(volumeType.getRight());
template.getVolumeTemplates().add(volumeTemplate);
}
return group;
}
Aggregations