Search in sources :

Example 56 with HostgroupView

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

the class CmHostGroupRoleConfigProviderProcessorTest method testGetRoleConfigsWithSingleRolesPerHostGroup.

@Test
public void testGetRoleConfigsWithSingleRolesPerHostGroup() {
    HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.GATEWAY, 1);
    HostgroupView worker = new HostgroupView("worker", 2, 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_data_dir_list", "/hadoopfs/fs1/datanode,/hadoopfs/fs2/datanode")), roleConfigs.get("hdfs-DATANODE-BASE"));
    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("yarn_nodemanager_local_dirs", "/hadoopfs/fs1/nodemanager,/hadoopfs/fs2/nodemanager"), config("yarn_nodemanager_log_dirs", "/hadoopfs/fs1/nodemanager/log,/hadoopfs/fs2/nodemanager/log")), roleConfigs.get("yarn-NODEMANAGER-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 57 with HostgroupView

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

the class HbaseVolumeConfigProviderTest method getRoleConfigsWithMultipleEphemeralVolumes.

@Test
void getRoleConfigsWithMultipleEphemeralVolumes() {
    HostgroupView worker = hostGroupWithVolumeTemplatesAndTemporaryStorage(2, Sets.newHashSet(new VolumeTemplate()), TemporaryStorage.EPHEMERAL_VOLUMES, 3);
    List<ApiClusterTemplateConfig> roleConfigs = underTest.getRoleConfigs(HbaseRoles.REGIONSERVER, worker, preparatorWithHostGroups(worker));
    assertEquals(List.of(config("hbase_bucketcache_ioengine", "file:/hadoopfs/ephfs1/hbase_cache")), roleConfigs);
}
Also used : VolumeTemplate(com.sequenceiq.cloudbreak.domain.VolumeTemplate) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Test(org.junit.jupiter.api.Test)

Example 58 with HostgroupView

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

the class HdfsRoleConfigProviderTest method nameNodeHA.

@Test
void nameNodeHA() {
    HostgroupView gateway = new HostgroupView("gateway", 1, InstanceGroupType.GATEWAY, 1);
    HostgroupView master = new HostgroupView("master", 0, InstanceGroupType.CORE, 2);
    HostgroupView quorum = new HostgroupView("quorum", 0, InstanceGroupType.CORE, 3);
    HostgroupView worker = new HostgroupView("worker", 0, InstanceGroupType.CORE, 3);
    String inputJson = FileReaderUtils.readFileFromClasspathQuietly("input/namenode-ha.bp");
    CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson);
    TemplatePreparationObject preparationObject = TemplatePreparationObject.Builder.builder().withHostgroupViews(Set.of(gateway, master, quorum, worker)).withBlueprintView(new BlueprintView(inputJson, "CDP", "1.0", cmTemplateProcessor)).build();
    Map<String, List<ApiClusterTemplateConfig>> roleConfigs = subject.getRoleConfigs(cmTemplateProcessor, preparationObject);
    List<ApiClusterTemplateConfig> namenodeConfigs = roleConfigs.get("hdfs-NAMENODE-BASE");
    Map<String, ApiClusterTemplateConfig> configMap = cmTemplateProcessor.mapByName(namenodeConfigs);
    assertEquals(NN_HA_PROPERTIES, configMap.keySet());
    assertEquals("true", configMap.get("autofailover_enabled").getValue());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) List(java.util.List) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Test(org.junit.jupiter.api.Test)

Example 59 with HostgroupView

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

the class HdfsVolumeConfigProviderTest method getRoleConfigsWithoutVolumes.

@Test
void getRoleConfigsWithoutVolumes() {
    HostgroupView hostGroup = hostGroupWithVolumeCount(0);
    assertEquals(List.of(config("dfs_data_dir_list", "/hadoopfs/root1/datanode")), subject.getRoleConfigs(HdfsRoles.DATANODE, hostGroup, preparatorWithHostGroups(hostGroup)));
    assertEquals(List.of(config("dfs_name_dir_list", "/hadoopfs/root1/namenode")), subject.getRoleConfigs(HdfsRoles.NAMENODE, hostGroup, preparatorWithHostGroups(hostGroup)));
    assertEquals(List.of(config("fs_checkpoint_dir_list", "/hadoopfs/root1/namesecondary")), subject.getRoleConfigs(HdfsRoles.SECONDARYNAMENODE, hostGroup, preparatorWithHostGroups(hostGroup)));
    assertEquals(List.of(config("dfs_journalnode_edits_dir", "/hadoopfs/root1/journalnode")), subject.getRoleConfigs(HdfsRoles.JOURNALNODE, hostGroup, preparatorWithHostGroups(hostGroup)));
}
Also used : HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Test(org.junit.jupiter.api.Test)

Example 60 with HostgroupView

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

the class HdfsVolumeConfigProviderTest method getRoleConfigsWithSingleVolume.

@Test
void getRoleConfigsWithSingleVolume() {
    HostgroupView hostGroup = hostGroupWithVolumeCount(1);
    assertEquals(List.of(config("dfs_data_dir_list", "/hadoopfs/fs1/datanode")), subject.getRoleConfigs(HdfsRoles.DATANODE, hostGroup, preparatorWithHostGroups(hostGroup)));
    assertEquals(List.of(config("dfs_name_dir_list", "/hadoopfs/fs1/namenode")), subject.getRoleConfigs(HdfsRoles.NAMENODE, hostGroup, preparatorWithHostGroups(hostGroup)));
    assertEquals(List.of(config("fs_checkpoint_dir_list", "/hadoopfs/fs1/namesecondary")), subject.getRoleConfigs(HdfsRoles.SECONDARYNAMENODE, hostGroup, preparatorWithHostGroups(hostGroup)));
    assertEquals(List.of(config("dfs_journalnode_edits_dir", "/hadoopfs/fs1/journalnode")), subject.getRoleConfigs(HdfsRoles.JOURNALNODE, hostGroup, preparatorWithHostGroups(hostGroup)));
}
Also used : 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