use of com.sequenceiq.cloudbreak.telemetry.TelemetryClusterDetails in project cloudbreak by hortonworks.
the class TelemetryCommonConfigServiceTest method testCreateTelemetryCommonConfigs.
@Test
public void testCreateTelemetryCommonConfigs() {
// GIVEN
given(telemetryUpgradeConfiguration.isEnabled()).willReturn(true);
TelemetryComponentUpgradeConfiguration cdpTelemetryConfig = new TelemetryComponentUpgradeConfiguration();
cdpTelemetryConfig.setDesiredVersion("0.0.1");
given(telemetryUpgradeConfiguration.getCdpTelemetry()).willReturn(cdpTelemetryConfig);
given(altusDatabusConnectionConfiguration.getMaxTimeSeconds()).willReturn(1);
Telemetry telemetry = new Telemetry();
Map<String, Object> fluentAttributes = new HashMap<>();
fluentAttributes.put(SERVICE_LOG_FOLDER_PREFIX, "/var/log");
fluentAttributes.put(SERVER_LOG_FOLDER_PREFIX, "/custom/log");
fluentAttributes.put(AGENT_LOG_FOLDER_PREFIX, "/grid/0/log");
telemetry.setFluentAttributes(fluentAttributes);
List<VmLog> vmLogs = new ArrayList<>();
VmLog log1 = new VmLog();
log1.setPath("${serviceLogFolderPrefix}/mylog.log");
VmLog log2 = new VmLog();
log2.setPath("${agentLogFolderPrefix}/*");
VmLog log3 = new VmLog();
log3.setPath("/my/path${serverLogFolderPrefix}/*");
vmLogs.add(log1);
vmLogs.add(log2);
vmLogs.add(log3);
TelemetryClusterDetails telemetryClusterDetails = TelemetryClusterDetails.Builder.builder().build();
// WHEN
TelemetryCommonConfigView result = underTest.createTelemetryCommonConfigs(telemetry, vmLogs, telemetryClusterDetails);
// THEN
assertEquals("/var/log/mylog.log", vmLogs.get(0).getPath());
assertEquals("/grid/0/log/*", vmLogs.get(1).getPath());
assertEquals("/my/path/custom/log/*", vmLogs.get(2).getPath());
assertEquals("0.0.1", result.toMap().get("desiredCdpTelemetryVersion").toString());
assertEquals(1, result.toMap().get("databusConnectMaxTime"));
}
use of com.sequenceiq.cloudbreak.telemetry.TelemetryClusterDetails in project cloudbreak by hortonworks.
the class TelemetryDecoratorTest method testDecorateWithSaasMonitoring.
@Test
public void testDecorateWithSaasMonitoring() {
// GIVEN
Map<String, SaltPillarProperties> servicePillar = new HashMap<>();
TelemetryClusterDetails clusterDetails = TelemetryClusterDetails.Builder.builder().withCrn("myClusterCrn").withType("datahub").withVersion("1.0.0").build();
MonitoringConfigView monitoringConfigView = new MonitoringConfigView.Builder().withEnabled(true).withClusterDetails(clusterDetails).build();
NodeStatusConfigView nodeStatusConfigView = new NodeStatusConfigView.Builder().withServerUsername("admin").withServerPassword("admin".toCharArray()).build();
DatabusConfigView dataConfigView = new DatabusConfigView.Builder().build();
TelemetryCommonConfigView telemetryCommonConfigView = new TelemetryCommonConfigView.Builder().withClusterDetails(clusterDetails).build();
MeteringConfigView meteringConfigView = new MeteringConfigView.Builder().build();
mockConfigServiceResults(dataConfigView, new FluentConfigView.Builder().build(), meteringConfigView, monitoringConfigView, nodeStatusConfigView, telemetryCommonConfigView);
given(entitlementService.isCdpSaasEnabled(anyString())).willReturn(true);
// WHEN
Map<String, SaltPillarProperties> result = underTest.decoratePillar(servicePillar, createStack(), new Telemetry());
// THEN
Map<String, Object> results = createMapFromFluentPillars(result, "monitoring");
assertEquals(results.get("clusterType"), "datahub");
assertEquals(results.get("clusterVersion"), "1.0.0");
assertEquals(results.get("clusterCrn"), "myClusterCrn");
assertEquals(results.get("enabled"), true);
}
Aggregations