Search in sources :

Example 11 with Telemetry

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());
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.Test)

Example 12 with Telemetry

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());
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.Test)

Example 13 with Telemetry

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);
}
Also used : HashMap(java.util.HashMap) TelemetryClusterDetails(com.sequenceiq.cloudbreak.telemetry.TelemetryClusterDetails) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) DatabusConfigView(com.sequenceiq.cloudbreak.telemetry.databus.DatabusConfigView) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties) FluentConfigView(com.sequenceiq.cloudbreak.telemetry.fluent.FluentConfigView) Test(org.junit.Test)

Example 14 with Telemetry

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"));
}
Also used : HashMap(java.util.HashMap) FluentConfigView(com.sequenceiq.cloudbreak.telemetry.fluent.FluentConfigView) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) DatabusConfigView(com.sequenceiq.cloudbreak.telemetry.databus.DatabusConfigView) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties) Test(org.junit.Test)

Example 15 with Telemetry

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());
}
Also used : HashMap(java.util.HashMap) TelemetryClusterDetails(com.sequenceiq.cloudbreak.telemetry.TelemetryClusterDetails) FluentConfigView(com.sequenceiq.cloudbreak.telemetry.fluent.FluentConfigView) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) DatabusConfigView(com.sequenceiq.cloudbreak.telemetry.databus.DatabusConfigView) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties) Test(org.junit.Test)

Aggregations

Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)109 Test (org.junit.Test)55 Test (org.junit.jupiter.api.Test)31 Logging (com.sequenceiq.common.api.telemetry.model.Logging)30 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)20 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)16 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)15 BaseDiagnosticsCollectionRequest (com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest)13 AdlsGen2CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters)12 Backup (com.sequenceiq.freeipa.api.model.Backup)12 HashMap (java.util.HashMap)12 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)11 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)10 Features (com.sequenceiq.common.api.telemetry.model.Features)10 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)8 SaltPillarProperties (com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)8 ApiClient (com.cloudera.api.swagger.client.ApiClient)7 GcsCloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters)7 WorkloadAnalytics (com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics)6 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)6