Search in sources :

Example 51 with HostgroupView

use of com.sequenceiq.cloudbreak.template.views.HostgroupView in project cloudbreak by hortonworks.

the class CmHostGroupRoleConfigProviderProcessorTest method testGetRoleConfigsWithOneHostGroupZeroAttachedVolumes.

@Test
public void testGetRoleConfigsWithOneHostGroupZeroAttachedVolumes() {
    HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.GATEWAY, 1);
    HostgroupView worker = new HostgroupView("worker", 0, InstanceGroupType.CORE, 2);
    setup("input/clouderamanager.bp", Builder.builder().withHostgroupViews(Set.of(master, worker)));
    underTest.process(templateProcessor, templatePreparator);
    Map<String, List<ApiClusterTemplateConfig>> roleConfigs = mapRoleConfigs();
    assertEquals(List.of(config("dfs_name_dir_list", "/hadoopfs/fs1/namenode")), roleConfigs.get("hdfs-NAMENODE-BASE"));
    assertEquals(List.of(config("fs_checkpoint_dir_list", "/hadoopfs/fs1/namesecondary")), roleConfigs.get("hdfs-SECONDARYNAMENODE-BASE"));
    assertEquals(List.of(config("dfs_data_dir_list", "/hadoopfs/root1/datanode")), roleConfigs.get("hdfs-DATANODE-BASE"));
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Test(org.junit.jupiter.api.Test)

Example 52 with HostgroupView

use of com.sequenceiq.cloudbreak.template.views.HostgroupView in project cloudbreak by hortonworks.

the class CmHostGroupRoleConfigProviderProcessorTest method testGetRoleConfigsWithAllHostGroupZeroAttachedVolumes.

@Test
public void testGetRoleConfigsWithAllHostGroupZeroAttachedVolumes() {
    HostgroupView master = new HostgroupView("master", 0, InstanceGroupType.GATEWAY, 1);
    HostgroupView worker = new HostgroupView("worker", 0, InstanceGroupType.CORE, 2);
    setup("input/clouderamanager.bp", Builder.builder().withHostgroupViews(Set.of(master, worker)));
    underTest.process(templateProcessor, templatePreparator);
    Map<String, List<ApiClusterTemplateConfig>> roleConfigs = mapRoleConfigs();
    List<ApiClusterTemplateConfig> masterNN = roleConfigs.get("hdfs-NAMENODE-BASE");
    List<ApiClusterTemplateConfig> masterSN = roleConfigs.get("hdfs-SECONDARYNAMENODE-BASE");
    List<ApiClusterTemplateConfig> workerDN = roleConfigs.get("hdfs-DATANODE-BASE");
    List<ApiClusterTemplateConfig> workerNM = roleConfigs.get("yarn-NODEMANAGER-BASE");
    assertEquals(1, masterNN.size());
    assertEquals(1, masterSN.size());
    assertEquals(1, workerDN.size());
    assertEquals("dfs_name_dir_list", masterNN.get(0).getName());
    assertEquals("/hadoopfs/root1/namenode", masterNN.get(0).getValue());
    assertEquals("fs_checkpoint_dir_list", masterSN.get(0).getName());
    assertEquals("/hadoopfs/root1/namesecondary", masterSN.get(0).getValue());
    assertEquals("dfs_data_dir_list", workerDN.get(0).getName());
    assertEquals("/hadoopfs/root1/datanode", workerDN.get(0).getValue());
    assertEquals("yarn_nodemanager_local_dirs", workerNM.get(0).getName());
    assertEquals("/hadoopfs/root1/nodemanager", workerNM.get(0).getValue());
    assertEquals("yarn_nodemanager_log_dirs", workerNM.get(1).getName());
    assertEquals("/hadoopfs/root1/nodemanager/log", workerNM.get(1).getValue());
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Test(org.junit.jupiter.api.Test)

Example 53 with HostgroupView

use of com.sequenceiq.cloudbreak.template.views.HostgroupView in project cloudbreak by hortonworks.

the class CmHostGroupRoleConfigProviderProcessorTest method testGetRoleConfigsWithDifferentDataNodeRoleForMultipleGroupsNoComputeDisks.

@Test
public void testGetRoleConfigsWithDifferentDataNodeRoleForMultipleGroupsNoComputeDisks() {
    HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.GATEWAY, 1);
    HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, 2);
    HostgroupView compute = new HostgroupView("compute", 0, InstanceGroupType.CORE, 2);
    setup("input/clouderamanager-3hg-different-DN-role.bp", Builder.builder().withHostgroupViews(Set.of(master, worker, compute)));
    underTest.process(templateProcessor, templatePreparator);
    Map<String, List<ApiClusterTemplateConfig>> roleConfigs = mapRoleConfigs();
    List<ApiClusterTemplateConfig> masterNN = roleConfigs.get("hdfs-NAMENODE-BASE");
    List<ApiClusterTemplateConfig> workerDN = roleConfigs.get("hdfs-DATANODE-BASE");
    List<ApiClusterTemplateConfig> computeDN = roleConfigs.get("hdfs-DATANODE-compute");
    assertEquals(1, workerDN.size());
    assertEquals("dfs_data_dir_list", workerDN.get(0).getName());
    assertEquals("/hadoopfs/fs1/datanode,/hadoopfs/fs2/datanode", workerDN.get(0).getValue());
    assertEquals(1, masterNN.size());
    assertEquals("dfs_name_dir_list", masterNN.get(0).getName());
    assertEquals(1, computeDN.size());
    assertEquals("dfs_data_dir_list", computeDN.get(0).getName());
    assertEquals("/hadoopfs/root1/datanode", computeDN.get(0).getValue());
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Test(org.junit.jupiter.api.Test)

Example 54 with HostgroupView

use of com.sequenceiq.cloudbreak.template.views.HostgroupView in project cloudbreak by hortonworks.

the class CmHostGroupRoleConfigProviderProcessorTest method testGetRoleConfigsWithEphemeralVolumes.

@Test
public void testGetRoleConfigsWithEphemeralVolumes() {
    HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.GATEWAY, Collections.<String>emptySet(), Sets.newHashSet(new VolumeTemplate()), TemporaryStorage.EPHEMERAL_VOLUMES, 1);
    HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, Collections.<String>emptySet(), Sets.newHashSet(new VolumeTemplate()), TemporaryStorage.EPHEMERAL_VOLUMES, 3);
    setup("input/clouderamanager.bp", Builder.builder().withHostgroupViews(Set.of(master, worker)));
    underTest.process(templateProcessor, templatePreparator);
    Map<String, List<ApiClusterTemplateConfig>> roleConfigs = mapRoleConfigs();
    assertEquals(List.of(config("hbase_bucketcache_ioengine", "file:/hadoopfs/ephfs1/hbase_cache")), roleConfigs.get("hbase-REGIONSERVER-BASE"));
    assertEquals(List.of(config("yarn_nodemanager_local_dirs", "/hadoopfs/ephfs1/nodemanager,/hadoopfs/ephfs2/nodemanager,/hadoopfs/ephfs3/nodemanager"), config("yarn_nodemanager_log_dirs", "/hadoopfs/ephfs1/nodemanager/log,/hadoopfs/ephfs2/nodemanager/log," + "/hadoopfs/ephfs3/nodemanager/log")), roleConfigs.get("yarn-NODEMANAGER-BASE"));
}
Also used : VolumeTemplate(com.sequenceiq.cloudbreak.domain.VolumeTemplate) ArrayList(java.util.ArrayList) List(java.util.List) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Test(org.junit.jupiter.api.Test)

Example 55 with HostgroupView

use of com.sequenceiq.cloudbreak.template.views.HostgroupView in project cloudbreak by hortonworks.

the class CmHostGroupRoleConfigProviderProcessorTest method retainsExistingConfigsInEachClone.

@Test
public void retainsExistingConfigsInEachClone() {
    HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.GATEWAY, 1);
    HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, 2);
    HostgroupView compute = new HostgroupView("compute", 3, InstanceGroupType.CORE, 2);
    setup("input/clouderamanager-3hg-same-DN-role.bp", Builder.builder().withHostgroupViews(Set.of(master, worker, compute)));
    ApiClusterTemplateConfig existingConfig = config("existing_config", "some_Value");
    templateProcessor.getServiceByType("HDFS").ifPresent(service -> service.getRoleConfigGroups().stream().filter(rcg -> "hdfs-DATANODE-BASE".equals(rcg.getRefName())).forEach(rcg -> rcg.addConfigsItem(existingConfig)));
    underTest.process(templateProcessor, templatePreparator);
    Map<String, List<ApiClusterTemplateConfig>> roleConfigs = mapRoleConfigs();
    assertNull(roleConfigs.get("hdfs-DATANODE-BASE"));
    assertEquals(Set.of(existingConfig, config("dfs_data_dir_list", "/hadoopfs/fs1/datanode,/hadoopfs/fs2/datanode")), Set.copyOf(roleConfigs.get("hdfs-DATANODE-worker")));
    assertEquals(Set.of(existingConfig, config("dfs_data_dir_list", "/hadoopfs/fs1/datanode,/hadoopfs/fs2/datanode,/hadoopfs/fs3/datanode")), Set.copyOf(roleConfigs.get("hdfs-DATANODE-compute")));
}
Also used : Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) GeneralClusterConfigs(com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs) HbaseVolumeConfigProvider(com.sequenceiq.cloudbreak.cmtemplate.configproviders.hbase.HbaseVolumeConfigProvider) ConfigUtils.config(com.sequenceiq.cloudbreak.cmtemplate.configproviders.ConfigUtils.config) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) Builder(com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder) ArrayList(java.util.ArrayList) VolumeTemplate(com.sequenceiq.cloudbreak.domain.VolumeTemplate) BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) Map(java.util.Map) Spy(org.mockito.Spy) ApiClusterTemplateRoleConfigGroup(com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroup) FileReaderUtils(com.sequenceiq.cloudbreak.util.FileReaderUtils) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) YarnVolumeConfigProvider(com.sequenceiq.cloudbreak.cmtemplate.configproviders.yarn.YarnVolumeConfigProvider) InjectMocks(org.mockito.InjectMocks) MockitoExtension(org.mockito.junit.jupiter.MockitoExtension) ZooKeeperVolumeConfigProvider(com.sequenceiq.cloudbreak.cmtemplate.configproviders.zookeeper.ZooKeeperVolumeConfigProvider) Optional.ofNullable(java.util.Optional.ofNullable) Set(java.util.Set) Collectors(java.util.stream.Collectors) TemporaryStorage(com.sequenceiq.cloudbreak.common.type.TemporaryStorage) TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) Sets(com.google.common.collect.Sets) InstanceGroupType(com.sequenceiq.common.api.type.InstanceGroupType) Objects(java.util.Objects) Test(org.junit.jupiter.api.Test) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) List(java.util.List) HdfsVolumeConfigProvider(com.sequenceiq.cloudbreak.cmtemplate.configproviders.hdfs.HdfsVolumeConfigProvider) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Collections(java.util.Collections) ArrayList(java.util.ArrayList) List(java.util.List) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Test(org.junit.jupiter.api.Test)

Aggregations

HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)122 Test (org.junit.jupiter.api.Test)63 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)39 ArrayList (java.util.ArrayList)34 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)26 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)25 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)23 List (java.util.List)23 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)23 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)19 StorageLocationView (com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView)19 S3FileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView)18 S3FileSystem (com.sequenceiq.common.api.filesystem.S3FileSystem)18 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)16 DisplayName (org.junit.jupiter.api.DisplayName)16 MethodSource (org.junit.jupiter.params.provider.MethodSource)16 BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)15 ApiClusterTemplateRoleConfigGroup (com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroup)8 Map (java.util.Map)8 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)7