Search in sources :

Example 56 with Telemetry

use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.

the class ClouderaManagerMgmtTelemetryServiceTest method testSetupTelemetryForDatalake.

@Test
public void testSetupTelemetryForDatalake() throws ApiException {
    // GIVEN
    Stack stack = new Stack();
    stack.setType(StackType.DATALAKE);
    WorkloadAnalytics wa = new WorkloadAnalytics();
    Telemetry telemetry = new Telemetry();
    telemetry.setWorkloadAnalytics(wa);
    when(entitlementService.useDataBusCNameEndpointEnabled(anyString())).thenReturn(false);
    when(dataBusEndpointProvider.getDataBusEndpoint(anyString(), anyBoolean())).thenReturn("https://dbusapi.us-west-1.sigma.altus.cloudera.com");
    // WHEN
    underTest.setupTelemetryRole(stack, null, null, null, telemetry, SDX_STACK_CRN);
    // THEN
    verify(externalAccountService, times(0)).createExternalAccount(anyString(), anyString(), anyString(), anyMap(), any(ApiClient.class));
}
Also used : Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) ApiClient(com.cloudera.api.swagger.client.ApiClient) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) WorkloadAnalytics(com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics) Test(org.junit.Test)

Example 57 with Telemetry

use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.

the class ClouderaManagerMgmtTelemetryServiceTest method testSetupTelemetry.

@Test
public void testSetupTelemetry() throws ApiException {
    // GIVEN
    Stack stack = new Stack();
    stack.setType(StackType.WORKLOAD);
    User user = new User();
    user.setUserCrn("crn:cdp:iam:us-west-1:accountId:user:name");
    stack.setCreator(user);
    stack.setResourceCrn("crn:cdp:datahub:us-west-1:accountId:cluster:name");
    WorkloadAnalytics wa = new WorkloadAnalytics();
    Telemetry telemetry = new Telemetry();
    telemetry.setWorkloadAnalytics(wa);
    ApiConfigList apiConfigList = new ApiConfigList();
    ApiResponse response = new ApiResponse<>(0, null, apiConfigList);
    AltusCredential credential = new AltusCredential("accessKey", "secretKey".toCharArray());
    when(entitlementService.useDataBusCNameEndpointEnabled(anyString())).thenReturn(false);
    when(dataBusEndpointProvider.getDataBusEndpoint(anyString(), anyBoolean())).thenReturn("https://dbusapi.us-west-1.sigma.altus.cloudera.com");
    when(apiClient.execute(any(), any())).thenReturn(response);
    when(clouderaManagerDatabusService.getAltusCredential(stack, SDX_STACK_CRN)).thenReturn(credential);
    when(clouderaManagerApiFactory.getClouderaManagerResourceApi(apiClient)).thenReturn(cmResourceApi);
    when(cmResourceApi.updateConfig(anyString(), any())).thenReturn(apiConfigList);
    // WHEN
    underTest.setupTelemetryRole(stack, apiClient, null, new ApiRoleList(), telemetry, SDX_STACK_CRN);
    // THEN
    verify(externalAccountService, times(1)).createExternalAccount(anyString(), anyString(), anyString(), anyMap(), any(ApiClient.class));
    verify(clouderaManagerDatabusService, times(1)).getAltusCredential(stack, SDX_STACK_CRN);
}
Also used : ApiConfigList(com.cloudera.api.swagger.model.ApiConfigList) User(com.sequenceiq.cloudbreak.workspace.model.User) AltusCredential(com.sequenceiq.cloudbreak.auth.altus.model.AltusCredential) ApiRoleList(com.cloudera.api.swagger.model.ApiRoleList) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) ApiClient(com.cloudera.api.swagger.client.ApiClient) ApiResponse(com.cloudera.api.swagger.client.ApiResponse) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) WorkloadAnalytics(com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics) Test(org.junit.Test)

Example 58 with Telemetry

use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.

the class ClouderaManagerMgmtTelemetryServiceTest method testSetupTelemetryWaDisabled.

@Test
public void testSetupTelemetryWaDisabled() throws ApiException {
    // GIVEN
    Stack stack = new Stack();
    stack.setType(StackType.WORKLOAD);
    Telemetry telemetry = new Telemetry();
    // WHEN
    underTest.setupTelemetryRole(stack, null, null, null, telemetry, SDX_STACK_CRN);
    // THEN
    verify(externalAccountService, times(0)).createExternalAccount(anyString(), anyString(), anyString(), anyMap(), any(ApiClient.class));
}
Also used : Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) ApiClient(com.cloudera.api.swagger.client.ApiClient) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.Test)

Example 59 with Telemetry

use of com.sequenceiq.common.api.telemetry.model.Telemetry 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);
}
Also used : TelemetryCommonConfigView(com.sequenceiq.cloudbreak.telemetry.common.TelemetryCommonConfigView) NodeStatusConfigView(com.sequenceiq.cloudbreak.telemetry.nodestatus.NodeStatusConfigView) HashMap(java.util.HashMap) TelemetryClusterDetails(com.sequenceiq.cloudbreak.telemetry.TelemetryClusterDetails) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) DatabusConfigView(com.sequenceiq.cloudbreak.telemetry.databus.DatabusConfigView) MeteringConfigView(com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfigView) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties) MonitoringConfigView(com.sequenceiq.cloudbreak.telemetry.monitoring.MonitoringConfigView) Test(org.junit.Test)

Example 60 with Telemetry

use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.

the class TelemetryDecoratorTest method testDecorateWithMetering.

@Test
public void testDecorateWithMetering() {
    // GIVEN
    Map<String, SaltPillarProperties> servicePillar = new HashMap<>();
    MeteringConfigView meteringConfigView = new MeteringConfigView.Builder().withEnabled(true).withPlatform("AWS").withServiceType("DATAHUB").withServiceVersion("1.0.0").withClusterCrn("myClusterCrn").build();
    DatabusConfigView dataConfigView = new DatabusConfigView.Builder().build();
    mockConfigServiceResults(dataConfigView, new FluentConfigView.Builder().build(), meteringConfigView);
    // WHEN
    Map<String, SaltPillarProperties> result = underTest.decoratePillar(servicePillar, createStack(), new Telemetry());
    // THEN
    Map<String, Object> results = createMapFromFluentPillars(result, "metering");
    assertEquals(results.get("serviceType"), "DATAHUB");
    assertEquals(results.get("serviceVersion"), "1.0.0");
    assertEquals(results.get("clusterCrn"), "myClusterCrn");
    assertEquals(results.get("enabled"), true);
}
Also used : HashMap(java.util.HashMap) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) MeteringConfigView(com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfigView) 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