use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class DiagnosticsCollectionValidatorTest method testValidateWithValidEngDestination.
@Test
void testValidateWithValidEngDestination() {
BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
request.setDestination(DiagnosticsDestination.ENG);
Telemetry telemetry = new Telemetry();
Features features = new Features();
FeatureSetting clusterLogsCollection = new FeatureSetting();
clusterLogsCollection.setEnabled(true);
features.setClusterLogsCollection(clusterLogsCollection);
telemetry.setFeatures(features);
underTest.validate(request, createStack(), telemetry);
}
use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class DiagnosticsCollectionValidatorTest method testValidateWithCloudStorageWithEmptyTelemetryLoggingSetting.
@Test
void testValidateWithCloudStorageWithEmptyTelemetryLoggingSetting() {
BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
request.setDestination(DiagnosticsDestination.CLOUD_STORAGE);
Telemetry telemetry = new Telemetry();
telemetry.setLogging(new Logging());
BadRequestException thrown = assertThrows(BadRequestException.class, () -> underTest.validate(request, createStack(), telemetry));
assertTrue(thrown.getMessage().contains("S3, ABFS or GCS cloud storage logging setting should be enabled for Data Hub"));
}
use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class TelemetryServiceTest method testCreateTelemetryConfigsWithEmptyJson.
@Test
public void testCreateTelemetryConfigsWithEmptyJson() {
// GIVEN
given(stackService.getById(STACK_ID)).willReturn(stack(null));
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());
}
use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class FluentConfigServiceTest method testCreateFluentConfig.
@Test
public void testCreateFluentConfig() {
// GIVEN
Logging logging = new Logging();
logging.setStorageLocation("mybucket/cluster-logs/datahub/cl1");
logging.setS3(new S3CloudStorageV1Parameters());
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());
assertTrue(result.isCloudStorageLoggingEnabled());
assertEquals("cluster-logs/datahub/cl1", result.getLogFolderName());
assertEquals("mybucket", result.getS3LogArchiveBucketName());
assertEquals(Crn.Region.EU_1.getName(), result.toMap().get("environmentRegion"));
}
use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class FluentConfigServiceTest method testCreateFluentConfigWithFullAdlsGen2Path.
@Test
public void testCreateFluentConfigWithFullAdlsGen2Path() {
// GIVEN
Logging logging = new Logging();
logging.setStorageLocation("abfs://mycontainer@myaccount.dfs.core.windows.net/my/custom/path");
AdlsGen2CloudStorageV1Parameters parameters = new AdlsGen2CloudStorageV1Parameters();
parameters.setAccountKey("myAccountKey");
parameters.setAccountName("myAccount");
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("myaccount", result.getAzureStorageAccount());
assertEquals("/my/custom/path", result.getLogFolderName());
assertEquals("mycontainer", result.getAzureContainer());
}
Aggregations