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);
}
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);
}
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"));
}
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());
}
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);
}
Aggregations