Search in sources :

Example 16 with Telemetry

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

the class TelemetryDecoratorTest method testDecorateWithDatabus.

@Test
public void testDecorateWithDatabus() {
    // GIVEN
    Map<String, SaltPillarProperties> servicePillar = new HashMap<>();
    FluentConfigView fluentConfigView = new FluentConfigView.Builder().build();
    DatabusConfigView dataConfigView = new DatabusConfigView.Builder().withEnabled(true).withAccessKeyId("myAccessKeyId").withAccessKeySecret("mySecret".toCharArray()).withEndpoint("databusEndpoint").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, "databus");
    assertEquals(results.get("accessKeyId"), "myAccessKeyId");
    assertEquals(results.get("enabled"), true);
}
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 17 with Telemetry

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

the class TelemetryServiceTest method testCreateTelemetryConfigs.

@Test
public void testCreateTelemetryConfigs() {
    // GIVEN
    given(stackService.getById(STACK_ID)).willReturn(stack("{}"));
    given(componentConfigProviderService.getTelemetry(STACK_ID)).willReturn(new Telemetry());
    given(telemetryDecorator.decoratePillar(anyMap(), any(), any(), any())).willReturn(new HashMap<>());
    // WHEN
    underTest.createTelemetryConfigs(STACK_ID, Set.of(TelemetryComponentType.CDP_TELEMETRY));
    // THEN
    verify(telemetryDecorator, times(1)).decoratePillar(anyMap(), any(), any(), isNotNull());
}
Also used : Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.jupiter.api.Test)

Example 18 with Telemetry

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

the class TelemetryServiceTest method testCreateTelemetryConfigsWithIOException.

@Test
public void testCreateTelemetryConfigsWithIOException() {
    // GIVEN
    given(stackService.getById(STACK_ID)).willReturn(stack("wrongJson"));
    given(componentConfigProviderService.getTelemetry(STACK_ID)).willReturn(new Telemetry());
    given(telemetryDecorator.decoratePillar(anyMap(), any(), any(), any())).willReturn(new HashMap<>());
    // WHEN
    underTest.createTelemetryConfigs(STACK_ID, Set.of(TelemetryComponentType.CDP_TELEMETRY));
    // THEN
    verify(telemetryDecorator, times(1)).decoratePillar(anyMap(), any(), any(), isNull());
}
Also used : Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.jupiter.api.Test)

Example 19 with Telemetry

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

the class MachineUserRemoveHandler method cleanupMachineUser.

private void cleanupMachineUser(Long stackId) {
    Stack stack = stackService.getStackById(stackId);
    Telemetry telemetry = stack.getTelemetry();
    if (telemetry != null && (telemetry.isClusterLogsCollectionEnabled() || StringUtils.isNotBlank(stack.getDatabusCredential()))) {
        ThreadBasedUserCrnProvider.doAsInternalActor(regionAwareInternalCrnGeneratorFactory.iam().getInternalCrnForServiceAsString(), () -> altusMachineUserService.cleanupMachineUser(stack, telemetry));
    } else {
        LOGGER.info("Machine user cleanup is not needed.");
    }
}
Also used : Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Stack(com.sequenceiq.freeipa.entity.Stack)

Example 20 with Telemetry

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

the class DiagnosticsCollectionValidatorTest method testValidateWithValidCloudStorage.

@Test
void testValidateWithValidCloudStorage() {
    BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
    request.setDestination(DiagnosticsDestination.CLOUD_STORAGE);
    Telemetry telemetry = new Telemetry();
    Logging logging = new Logging();
    logging.setS3(new S3CloudStorageV1Parameters());
    telemetry.setLogging(logging);
    underTest.validate(request, createStack(), telemetry);
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) BaseDiagnosticsCollectionRequest(com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.jupiter.api.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