Search in sources :

Example 41 with InstanceGroup

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

Example 42 with 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);
}
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 43 with InstanceGroup

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)));
}
Also used : JsonToString(com.sequenceiq.cloudbreak.common.json.JsonToString) 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 44 with InstanceGroup

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);
}
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 45 with InstanceGroup

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);
}
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)

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