Search in sources :

Example 31 with Telemetry

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

the class StackToCloudStackConverterTest method testBuildFileSystemViewDifferentAWSInstanceProfile.

@Test
public void testBuildFileSystemViewDifferentAWSInstanceProfile() throws Exception {
    Telemetry telemetry = mock(Telemetry.class);
    Backup backup = mock(Backup.class);
    Logging logging = mock(Logging.class);
    S3CloudStorageV1Parameters s3Logging = new S3CloudStorageV1Parameters();
    s3Logging.setInstanceProfile("arn:aws:iam::id:instance-profile/role1");
    S3CloudStorageV1Parameters s3Backup = new S3CloudStorageV1Parameters();
    s3Backup.setInstanceProfile("arn:aws:iam::id:instance-profile/role2");
    when(stack.getTelemetry()).thenReturn(telemetry);
    when(telemetry.getLogging()).thenReturn(logging);
    when(stack.getBackup()).thenReturn(backup);
    when(backup.getS3()).thenReturn(s3Backup);
    when(logging.getS3()).thenReturn(s3Logging);
    expectedException.expect(BadRequestException.class);
    underTest.buildFileSystemView(stack);
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) Backup(com.sequenceiq.freeipa.api.model.Backup) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.Test)

Example 32 with Telemetry

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

the class StackToCloudStackConverterTest method testBuildFileSystemViewSameAzureManagedIdentity.

@Test
public void testBuildFileSystemViewSameAzureManagedIdentity() throws Exception {
    Telemetry telemetry = mock(Telemetry.class);
    Backup backup = mock(Backup.class);
    Logging logging = mock(Logging.class);
    AdlsGen2CloudStorageV1Parameters adlsGen2Logging = new AdlsGen2CloudStorageV1Parameters();
    adlsGen2Logging.setManagedIdentity("/subscriptions/id/resourceGroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity");
    AdlsGen2CloudStorageV1Parameters adlsGen2Backup = new AdlsGen2CloudStorageV1Parameters();
    adlsGen2Backup.setManagedIdentity("/subscriptions/id/resourceGroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity");
    when(stack.getTelemetry()).thenReturn(telemetry);
    when(telemetry.getLogging()).thenReturn(logging);
    when(stack.getBackup()).thenReturn(backup);
    when(backup.getAdlsGen2()).thenReturn(adlsGen2Logging);
    when(logging.getAdlsGen2()).thenReturn(adlsGen2Backup);
    Optional<CloudFileSystemView> fileSystemView = underTest.buildFileSystemView(stack);
    assertEquals(Optional.empty(), fileSystemView);
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) AdlsGen2CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters) Backup(com.sequenceiq.freeipa.api.model.Backup) CloudFileSystemView(com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.Test)

Example 33 with Telemetry

use of com.sequenceiq.common.api.telemetry.model.Telemetry 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"));
}
Also used : VmLog(com.sequenceiq.common.api.telemetry.model.VmLog) TelemetryComponentUpgradeConfiguration(com.sequenceiq.cloudbreak.telemetry.TelemetryComponentUpgradeConfiguration) HashMap(java.util.HashMap) TelemetryClusterDetails(com.sequenceiq.cloudbreak.telemetry.TelemetryClusterDetails) ArrayList(java.util.ArrayList) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.Test)

Example 34 with Telemetry

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

the class FluentConfigServiceTest method testCreateFluentConfigWithoutScheme.

@Test
public void testCreateFluentConfigWithoutScheme() {
    // GIVEN
    Logging logging = new Logging();
    logging.setStorageLocation("mycontainer/cluster-logs/datahub/cl1@myaccount.dfs.core.windows.net");
    AdlsGen2CloudStorageV1Parameters parameters = new AdlsGen2CloudStorageV1Parameters();
    parameters.setAccountKey("myAccountKey");
    logging.setAdlsGen2(parameters);
    Telemetry telemetry = new Telemetry();
    telemetry.setLogging(logging);
    // WHEN
    FluentConfigView result = underTest.createFluentConfigs(DEFAULT_FLUENT_CLUSTER_DETAILS, false, false, REGION_SAMPLE, telemetry);
    // THEN
    assertTrue(result.isEnabled());
    assertEquals("myAccountKey", result.getAzureStorageAccessKey());
    assertEquals("/cluster-logs/datahub/cl1", result.getLogFolderName());
    assertEquals("mycontainer", result.getAzureContainer());
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) AdlsGen2CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.Test)

Example 35 with Telemetry

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

the class FluentConfigServiceTest method testCreateFluentConfigWithoutLocation.

@Test(expected = CloudbreakServiceException.class)
public void testCreateFluentConfigWithoutLocation() {
    // GIVEN
    Logging logging = new Logging();
    logging.setStorageLocation(null);
    logging.setAdlsGen2(new AdlsGen2CloudStorageV1Parameters());
    Telemetry telemetry = new Telemetry();
    telemetry.setLogging(logging);
    // WHEN
    underTest.createFluentConfigs(DEFAULT_FLUENT_CLUSTER_DETAILS, false, false, REGION_SAMPLE, telemetry);
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) AdlsGen2CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) 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