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"));
}
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());
}
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());
}
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"));
}
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")));
}
Aggregations