use of com.sequenceiq.cloudbreak.telemetry.TelemetryComponentUpgradeConfiguration in project cloudbreak by hortonworks.
the class TelemetryUpgradeServiceTest method testUpdateTelemetryComponent.
@Test
public void testUpdateTelemetryComponent() throws Exception {
// GIVEN
given(orchestratorMetadataProvider.getOrchestratorMetadata(STACK_ID)).willReturn(metadata);
TelemetryComponentUpgradeConfiguration telemetryConfig = new TelemetryComponentUpgradeConfiguration();
telemetryConfig.setDesiredVersion("0.1.0");
given(telemetryUpgradeConfiguration.getCdpTelemetry()).willReturn(telemetryConfig);
doNothing().when(telemetryOrchestrator).updateTelemetryComponent(anyList(), anySet(), any(), anyMap());
// WHEN
underTest.upgradeTelemetryComponent(STACK_ID, TelemetryComponentType.CDP_TELEMETRY, null);
// THEN
verify(telemetryUpgradeConfiguration, times(1)).getCdpTelemetry();
verify(orchestratorMetadataProvider, times(1)).getOrchestratorMetadata(STACK_ID);
verify(telemetryOrchestrator, times(1)).updateTelemetryComponent(anyList(), anySet(), any(), anyMap());
}
use of com.sequenceiq.cloudbreak.telemetry.TelemetryComponentUpgradeConfiguration 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.cloudbreak.telemetry.TelemetryComponentUpgradeConfiguration in project cloudbreak by hortonworks.
the class MeteringConfigServiceTest method setUp.
@Before
public void setUp() {
MeteringConfiguration meteringConfiguration = new MeteringConfiguration(true, "app", "stream");
TelemetryComponentUpgradeConfiguration meteringAgentConfig = new TelemetryComponentUpgradeConfiguration();
meteringAgentConfig.setDesiredDate("2021-01-01");
TelemetryUpgradeConfiguration upgradeConfigs = new TelemetryUpgradeConfiguration();
upgradeConfigs.setEnabled(true);
upgradeConfigs.setMeteringAgent(meteringAgentConfig);
underTest = new MeteringConfigService(meteringConfiguration, upgradeConfigs);
}
use of com.sequenceiq.cloudbreak.telemetry.TelemetryComponentUpgradeConfiguration in project cloudbreak by hortonworks.
the class TelemetryUpgradeServiceTest method testUpdateMeteringComponent.
@Test
public void testUpdateMeteringComponent() throws Exception {
// GIVEN
given(orchestratorMetadataProvider.getOrchestratorMetadata(STACK_ID)).willReturn(metadata);
TelemetryComponentUpgradeConfiguration meteringAgentConfig = new TelemetryComponentUpgradeConfiguration();
meteringAgentConfig.setDesiredDate("2000-01-01");
given(telemetryUpgradeConfiguration.getMeteringAgent()).willReturn(meteringAgentConfig);
doNothing().when(telemetryOrchestrator).upgradeMetering(anyList(), anySet(), any(), anyString(), isNull());
// WHEN
underTest.upgradeTelemetryComponent(STACK_ID, TelemetryComponentType.METERING, null);
// THEN
verify(telemetryUpgradeConfiguration, times(1)).getMeteringAgent();
verify(orchestratorMetadataProvider, times(1)).getOrchestratorMetadata(STACK_ID);
verify(telemetryOrchestrator, times(1)).upgradeMetering(anyList(), anySet(), any(), anyString(), isNull());
}
use of com.sequenceiq.cloudbreak.telemetry.TelemetryComponentUpgradeConfiguration in project cloudbreak by hortonworks.
the class TelemetryUpgradeServiceTest method testUpdateLoggingAgentComponent.
@Test
public void testUpdateLoggingAgentComponent() throws Exception {
// GIVEN
given(orchestratorMetadataProvider.getOrchestratorMetadata(STACK_ID)).willReturn(metadata);
TelemetryComponentUpgradeConfiguration loggingAgentConfig = new TelemetryComponentUpgradeConfiguration();
loggingAgentConfig.setDesiredVersion("0.1.0");
given(telemetryUpgradeConfiguration.getCdpLoggingAgent()).willReturn(loggingAgentConfig);
doNothing().when(telemetryOrchestrator).updateTelemetryComponent(anyList(), anySet(), any(), anyMap());
// WHEN
underTest.upgradeTelemetryComponent(STACK_ID, TelemetryComponentType.CDP_LOGGING_AGENT, null);
// THEN
verify(telemetryUpgradeConfiguration, times(1)).getCdpLoggingAgent();
verify(orchestratorMetadataProvider, times(1)).getOrchestratorMetadata(STACK_ID);
verify(telemetryOrchestrator, times(1)).updateTelemetryComponent(anyList(), anySet(), any(), anyMap());
}
Aggregations