use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertFromRequestForDatalake.
@Test
public void testConvertFromRequestForDatalake() {
// GIVEN
TelemetryRequest telemetryRequest = new TelemetryRequest();
// WHEN
Telemetry result = underTest.convert(telemetryRequest, StackType.DATALAKE);
// THEN
assertFalse(result.getFeatures().getClusterLogsCollection().isEnabled());
assertNull(result.getFeatures().getMetering());
}
use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertWhenMonitoringIsDisabledThenItShouldBeFalseInTheResult.
@Test
public void testConvertWhenMonitoringIsDisabledThenItShouldBeFalseInTheResult() {
ReflectionTestUtils.setField(underTest, "monitoringEnabled", false);
TelemetryRequest input = new TelemetryRequest();
Telemetry result = underTest.convert(input, StackType.WORKLOAD);
assertNotNull(result);
assertFalse(result.getFeatures().getMonitoring().isEnabled());
}
use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class TelemetryDecoratorTest method testS3DecorateWithOverrides.
@Test
public void testS3DecorateWithOverrides() {
// GIVEN
Map<String, SaltPillarProperties> servicePillar = new HashMap<>();
Map<String, Object> overrides = new HashMap<>();
overrides.put("providerPrefix", "s3a");
TelemetryClusterDetails clusterDetails = TelemetryClusterDetails.Builder.builder().withPlatform("AWS").build();
FluentConfigView fluentConfigView = new FluentConfigView.Builder().withClusterDetails(clusterDetails).withEnabled(true).withS3LogArchiveBucketName("mybucket").withLogFolderName("cluster-logs/datahub/cl1").withProviderPrefix("s3").withOverrideAttributes(overrides).build();
DatabusConfigView dataConfigView = new DatabusConfigView.Builder().build();
mockConfigServiceResults(dataConfigView, fluentConfigView, new MeteringConfigView.Builder().build());
// WHEN
Map<String, SaltPillarProperties> result = underTest.decoratePillar(servicePillar, createStack(), new Telemetry());
// THEN
Map<String, Object> results = createMapFromFluentPillars(result, "fluent");
assertEquals(results.get("providerPrefix"), "s3a");
assertEquals(results.get("s3LogArchiveBucketName"), "mybucket");
assertEquals(results.get("logFolderName"), "cluster-logs/datahub/cl1");
assertEquals(results.get("enabled"), true);
}
use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class TelemetryDecoratorTest method testDecorateWithDisabledLogging.
@Test
public void testDecorateWithDisabledLogging() {
// GIVEN
Map<String, SaltPillarProperties> servicePillar = new HashMap<>();
FluentConfigView fluentConfigView = new FluentConfigView.Builder().build();
DatabusConfigView dataConfigView = new DatabusConfigView.Builder().build();
mockConfigServiceResults(dataConfigView, fluentConfigView, new MeteringConfigView.Builder().build());
// WHEN
Map<String, SaltPillarProperties> result = underTest.decoratePillar(servicePillar, createStack(), new Telemetry());
// THEN
assertNotNull(result.get("telemetry"));
assertNull(result.get("fleunt"));
}
use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class TelemetryDecoratorTest method testS3DecorateWithDefaultPath.
@Test
public void testS3DecorateWithDefaultPath() {
// GIVEN
Map<String, SaltPillarProperties> servicePillar = new HashMap<>();
TelemetryClusterDetails clusterDetails = TelemetryClusterDetails.Builder.builder().withPlatform("AWS").build();
FluentConfigView fluentConfigView = new FluentConfigView.Builder().withClusterDetails(clusterDetails).withEnabled(true).withS3LogArchiveBucketName("mybucket").withLogFolderName("cluster-logs/datahub/cl1").withProviderPrefix("s3").build();
DatabusConfigView dataConfigView = new DatabusConfigView.Builder().withAccessKeySecretAlgorithm("RSA").build();
mockConfigServiceResults(dataConfigView, fluentConfigView, new MeteringConfigView.Builder().build());
// WHEN
Map<String, SaltPillarProperties> result = underTest.decoratePillar(servicePillar, createStack(), new Telemetry());
// THEN
Map<String, Object> results = createMapFromFluentPillars(result, "fluent");
assertEquals(results.get("providerPrefix"), "s3");
assertEquals(results.get("s3LogArchiveBucketName"), "mybucket");
assertEquals(results.get("logFolderName"), "cluster-logs/datahub/cl1");
assertEquals(results.get("enabled"), true);
assertEquals(results.get("platform"), CloudPlatform.AWS.name());
assertEquals(results.get("user"), "root");
verify(fluentConfigService, times(1)).createFluentConfigs(any(TelemetryClusterDetails.class), anyBoolean(), anyBoolean(), isNull(), any(Telemetry.class));
verify(meteringConfigService, times(1)).createMeteringConfigs(anyBoolean(), anyString(), anyString(), anyString(), anyString(), anyString());
}
Aggregations