Search in sources :

Example 46 with InstanceGroup

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)));
}
Also used : CloudbreakDetails(com.sequenceiq.cloudbreak.cloud.model.CloudbreakDetails) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) HashSet(java.util.HashSet) Test(org.junit.jupiter.api.Test)

Example 47 with InstanceGroup

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);
}
Also used : StopRestrictionReason(com.sequenceiq.cloudbreak.domain.StopRestrictionReason) CloudbreakDetails(com.sequenceiq.cloudbreak.cloud.model.CloudbreakDetails) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) HashSet(java.util.HashSet) Test(org.junit.jupiter.api.Test)

Example 48 with InstanceGroup

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);
}
Also used : StopRestrictionReason(com.sequenceiq.cloudbreak.domain.StopRestrictionReason) CloudbreakDetails(com.sequenceiq.cloudbreak.cloud.model.CloudbreakDetails) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) HashSet(java.util.HashSet) Test(org.junit.jupiter.api.Test)

Example 49 with InstanceGroup

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);
}
Also used : StopRestrictionReason(com.sequenceiq.cloudbreak.domain.StopRestrictionReason) CloudbreakDetails(com.sequenceiq.cloudbreak.cloud.model.CloudbreakDetails) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) HashSet(java.util.HashSet) Test(org.junit.jupiter.api.Test)

Example 50 with InstanceGroup

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;
}
Also used : VolumeTemplate(com.sequenceiq.cloudbreak.domain.VolumeTemplate) VolumeUsageType(com.sequenceiq.cloudbreak.domain.VolumeUsageType) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) Template(com.sequenceiq.cloudbreak.domain.Template) VolumeTemplate(com.sequenceiq.cloudbreak.domain.VolumeTemplate)

Aggregations

InstanceGroup (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup)288 InstanceMetaData (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData)132 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)93 Test (org.junit.jupiter.api.Test)91 HashSet (java.util.HashSet)68 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)57 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)47 Template (com.sequenceiq.cloudbreak.domain.Template)45 Test (org.junit.Test)44 Json (com.sequenceiq.cloudbreak.common.json.Json)38 Set (java.util.Set)37 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)34 ArrayList (java.util.ArrayList)31 LinkedHashSet (java.util.LinkedHashSet)31 Map (java.util.Map)28 InstanceTemplate (com.sequenceiq.cloudbreak.cloud.model.InstanceTemplate)27 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)27 List (java.util.List)26 HostGroup (com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup)25 CloudStack (com.sequenceiq.cloudbreak.cloud.model.CloudStack)22