Search in sources :

Example 41 with ApiClusterTemplateConfig

use of com.cloudera.api.swagger.model.ApiClusterTemplateConfig in project cloudbreak by hortonworks.

the class SqlStreamBuilderAdminDatabaseConfigProviderTest method testProperDbConfig.

@Test
public void testProperDbConfig() {
    CmTemplateProcessor cmTemplateProcessor = initTemplateProcessor("7.2.11");
    TemplatePreparationObject preparationObject = initTemplatePreparationObject(cmTemplateProcessor);
    List<ApiClusterTemplateConfig> roleConfigs = underTest.getServiceConfigs(cmTemplateProcessor, preparationObject);
    assertThat(roleConfigs).hasSameElementsAs(List.of(config("database_type", "postgresql"), config("database_host", "testhost"), config("database_port", "5432"), config("database_schema", "eventador_admin"), config("database_user", "ssb_test_user"), config("database_password", "ssb_test_pw")));
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.Test)

Example 42 with ApiClusterTemplateConfig

use of com.cloudera.api.swagger.model.ApiClusterTemplateConfig in project cloudbreak by hortonworks.

the class TezRoleConfigProviderTest method testGetTezClientRoleConfigsWhenNoStorageConfigured.

@Test
public void testGetTezClientRoleConfigsWhenNoStorageConfigured() {
    TemplatePreparationObject preparationObject = getTemplatePreparationObject();
    String inputJson = getBlueprintText("input/clouderamanager-ds.bp");
    CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson);
    Map<String, List<ApiClusterTemplateConfig>> roleConfigs = underTest.getRoleConfigs(cmTemplateProcessor, preparationObject);
    List<ApiClusterTemplateConfig> tezConfigs = roleConfigs.get("tez-GATEWAY-BASE");
    assertEquals(0, tezConfigs.size());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ArrayList(java.util.ArrayList) List(java.util.List) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.Test)

Example 43 with ApiClusterTemplateConfig

use of com.cloudera.api.swagger.model.ApiClusterTemplateConfig in project cloudbreak by hortonworks.

the class YarnResourceManagerRoleConfigProviderTest method testGetConfigsWhenRoleIsResourceManagerPlacementVersionPasses.

@Test
public void testGetConfigsWhenRoleIsResourceManagerPlacementVersionPasses() {
    setupMocks(true, true, "7.2.11");
    List<ApiClusterTemplateConfig> serviceConfigs = underTest.getRoleConfigs(YarnRoles.RESOURCEMANAGER, source);
    assertEquals(3, serviceConfigs.size());
    assertTrue(serviceConfigs.stream().anyMatch(sc -> StringUtils.equals(sc.getName(), "resourcemanager_capacity_scheduler_configuration")));
    assertTrue(serviceConfigs.stream().anyMatch(sc -> StringUtils.equals(sc.getName(), "yarn_resourcemanager_scheduler_class")));
    assertTrue(serviceConfigs.stream().anyMatch(sc -> StringUtils.equals(sc.getName(), "resourcemanager_config_safety_valve")));
    // Note: This is explicitly not referring to the constants. If the constants change, make sure to rationalize
    // changes with the YARN script which processes these.
    ApiClusterTemplateConfig rmSafetyValve = serviceConfigs.stream().filter(sc -> StringUtils.equals(sc.getName(), "resourcemanager_config_safety_valve")).findFirst().get();
    assertEquals("<property>" + "<name>yarn.resourcemanager.am.placement-preference-with-node-attributes</name>" + "<value>ORDER NODES IN NodeInstanceType WITH worker > compute</value></property><property>" + "<name>yarn.resourcemanager.non-am.placement-preference-with-node-attributes</name>" + "<value>ORDER NODES IN NodeInstanceType WITH compute > worker</value></property>", rmSafetyValve.getValue());
}
Also used : Mock(org.mockito.Mock) HiveRoles(com.sequenceiq.cloudbreak.cmtemplate.configproviders.hive.HiveRoles) RunWith(org.junit.runner.RunWith) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) ArgumentMatchers.anyList(org.mockito.ArgumentMatchers.anyList) StringUtils(org.apache.commons.lang3.StringUtils) TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) List(java.util.List) BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) Assert.assertFalse(org.junit.Assert.assertFalse) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Optional(java.util.Optional) ApiClusterTemplateService(com.cloudera.api.swagger.model.ApiClusterTemplateService) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) Assert.assertEquals(org.junit.Assert.assertEquals) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Mockito.mock(org.mockito.Mockito.mock) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.Test)

Example 44 with ApiClusterTemplateConfig

use of com.cloudera.api.swagger.model.ApiClusterTemplateConfig in project cloudbreak by hortonworks.

the class YarnVolumeConfigProviderTest method getRoleConfigsWithoutVolumes.

@Test
void getRoleConfigsWithoutVolumes() {
    HostgroupView worker = hostGroupWithVolumeCount(0);
    List<ApiClusterTemplateConfig> roleConfigs = subject.getRoleConfigs(YarnRoles.NODEMANAGER, worker, preparatorWithHostGroups(worker));
    assertEquals(List.of(config("yarn_nodemanager_local_dirs", "/hadoopfs/root1/nodemanager"), config("yarn_nodemanager_log_dirs", "/hadoopfs/root1/nodemanager/log")), roleConfigs);
}
Also used : ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Test(org.junit.jupiter.api.Test)

Example 45 with ApiClusterTemplateConfig

use of com.cloudera.api.swagger.model.ApiClusterTemplateConfig in project cloudbreak by hortonworks.

the class YarnVolumeConfigProviderTest method getRoleConfigsWithMultipleAttachedVolumes.

@Test
void getRoleConfigsWithMultipleAttachedVolumes() {
    HostgroupView worker = hostGroupWithVolumeTemplatesAndTemporaryStorage(2, Sets.newHashSet(new VolumeTemplate()), TemporaryStorage.ATTACHED_VOLUMES, 0);
    List<ApiClusterTemplateConfig> roleConfigs = subject.getRoleConfigs(YarnRoles.NODEMANAGER, worker, preparatorWithHostGroups(worker));
    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);
}
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)

Aggregations

ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)172 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)129 Test (org.junit.Test)78 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)74 Test (org.junit.jupiter.api.Test)57 ArrayList (java.util.ArrayList)55 List (java.util.List)50 HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)25 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)22 Builder (com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder)21 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)18 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)17 BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)17 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)13 AccountMappingView (com.sequenceiq.cloudbreak.template.views.AccountMappingView)13 ApiClusterTemplateRoleConfigGroup (com.cloudera.api.swagger.model.ApiClusterTemplateRoleConfigGroup)12 HashMap (java.util.HashMap)12 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)11 BaseFileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView)9 BlueprintTextProcessor (com.sequenceiq.cloudbreak.template.processor.BlueprintTextProcessor)8