Search in sources :

Example 1 with TelemetryComponentUpgradeConfiguration

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());
}
Also used : TelemetryComponentUpgradeConfiguration(com.sequenceiq.cloudbreak.telemetry.TelemetryComponentUpgradeConfiguration) Test(org.junit.jupiter.api.Test)

Example 2 with TelemetryComponentUpgradeConfiguration

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"));
}
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 3 with TelemetryComponentUpgradeConfiguration

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);
}
Also used : TelemetryComponentUpgradeConfiguration(com.sequenceiq.cloudbreak.telemetry.TelemetryComponentUpgradeConfiguration) TelemetryUpgradeConfiguration(com.sequenceiq.cloudbreak.telemetry.TelemetryUpgradeConfiguration) Before(org.junit.Before)

Example 4 with TelemetryComponentUpgradeConfiguration

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());
}
Also used : TelemetryComponentUpgradeConfiguration(com.sequenceiq.cloudbreak.telemetry.TelemetryComponentUpgradeConfiguration) Test(org.junit.jupiter.api.Test)

Example 5 with TelemetryComponentUpgradeConfiguration

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());
}
Also used : TelemetryComponentUpgradeConfiguration(com.sequenceiq.cloudbreak.telemetry.TelemetryComponentUpgradeConfiguration) Test(org.junit.jupiter.api.Test)

Aggregations

TelemetryComponentUpgradeConfiguration (com.sequenceiq.cloudbreak.telemetry.TelemetryComponentUpgradeConfiguration)5 Test (org.junit.jupiter.api.Test)3 TelemetryClusterDetails (com.sequenceiq.cloudbreak.telemetry.TelemetryClusterDetails)1 TelemetryUpgradeConfiguration (com.sequenceiq.cloudbreak.telemetry.TelemetryUpgradeConfiguration)1 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)1 VmLog (com.sequenceiq.common.api.telemetry.model.VmLog)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Before (org.junit.Before)1 Test (org.junit.Test)1