Search in sources :

Example 6 with DistroXAutoscaleClusterResponse

use of com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterResponse in project cloudbreak by hortonworks.

the class DistroXAutoScaleClusterV1EndpointTest method testDeleteAlertByClusterNameForTimeAlerts.

@Test
public void testDeleteAlertByClusterNameForTimeAlerts() {
    List<TimeAlertRequest> timeAlertRequests = getTimeAlertRequests(2, List.of("compute", "compute"));
    DistroXAutoscaleClusterRequest distroXAutoscaleClusterRequest = new DistroXAutoscaleClusterRequest();
    distroXAutoscaleClusterRequest.setTimeAlertRequests(timeAlertRequests);
    distroXAutoscaleClusterRequest.setEnableAutoscaling(true);
    DistroXAutoscaleClusterResponse xAutoscaleClusterResponse = distroXAutoScaleClusterV1Endpoint.updateAutoscaleConfigByClusterName(TEST_CLUSTER_NAME, distroXAutoscaleClusterRequest);
    assertEquals("Retrieved Alerts Size Should Match", 2, xAutoscaleClusterResponse.getTimeAlerts().size());
    distroXAutoScaleClusterV1Endpoint.deleteAlertsForClusterName(TEST_CLUSTER_NAME);
    xAutoscaleClusterResponse = distroXAutoScaleClusterV1Endpoint.getClusterByName(TEST_CLUSTER_NAME);
    assertEquals("Retrieved Alerts Size Should Match", 0, xAutoscaleClusterResponse.getTimeAlerts().size());
}
Also used : TimeAlertRequest(com.sequenceiq.periscope.api.model.TimeAlertRequest) DistroXAutoscaleClusterResponse(com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterResponse) DistroXAutoscaleClusterRequest(com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterRequest) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 7 with DistroXAutoscaleClusterResponse

use of com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterResponse in project cloudbreak by hortonworks.

the class DistroXAutoScaleClusterV1EndpointTest method testUpdateAutoscaleConfigByClusterCrnForEnableDisableStopStartScaling.

@Test
public void testUpdateAutoscaleConfigByClusterCrnForEnableDisableStopStartScaling() {
    DistroXAutoscaleClusterRequest clusterRequest = new DistroXAutoscaleClusterRequest();
    clusterRequest.setEnableAutoscaling(true);
    clusterRequest.setUseStopStartMechanism(null);
    DistroXAutoscaleClusterResponse clusterResponse = distroXAutoScaleClusterV1Endpoint.updateAutoscaleConfigByClusterCrn(TEST_CLUSTER_CRN, clusterRequest);
    assertFalse("StopStart scaling should be disabled if not specified in reuqest", clusterResponse.isStopStartScalingEnabled());
    clusterRequest.setUseStopStartMechanism(true);
    clusterResponse = distroXAutoScaleClusterV1Endpoint.updateAutoscaleConfigByClusterCrn(TEST_CLUSTER_CRN, clusterRequest);
    assertTrue("StopStart scaling should be enabled", clusterResponse.isStopStartScalingEnabled());
    clusterRequest.setUseStopStartMechanism(false);
    clusterResponse = distroXAutoScaleClusterV1Endpoint.updateAutoscaleConfigByClusterCrn(TEST_CLUSTER_CRN, clusterRequest);
    assertFalse("StopStart scaling should be disabled", clusterResponse.isStopStartScalingEnabled());
}
Also used : DistroXAutoscaleClusterResponse(com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterResponse) DistroXAutoscaleClusterRequest(com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterRequest) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 8 with DistroXAutoscaleClusterResponse

use of com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterResponse in project cloudbreak by hortonworks.

the class DistroXAutoScaleClusterV1EndpointTest method testDeleteAlertByClusterCrnForLoadAlerts.

@Test
public void testDeleteAlertByClusterCrnForLoadAlerts() {
    List<LoadAlertRequest> loadAlertRequests = getLoadAlertRequests(1, List.of("compute"));
    DistroXAutoscaleClusterRequest distroXAutoscaleClusterRequest = new DistroXAutoscaleClusterRequest();
    distroXAutoscaleClusterRequest.setLoadAlertRequests(loadAlertRequests);
    distroXAutoscaleClusterRequest.setEnableAutoscaling(true);
    DistroXAutoscaleClusterResponse xAutoscaleClusterResponse = distroXAutoScaleClusterV1Endpoint.updateAutoscaleConfigByClusterCrn(TEST_CLUSTER_CRN, distroXAutoscaleClusterRequest);
    assertEquals("Retrieved Alerts Size Should Match", 1, xAutoscaleClusterResponse.getLoadAlerts().size());
    distroXAutoScaleClusterV1Endpoint.deleteAlertsForClusterCrn(TEST_CLUSTER_CRN);
    xAutoscaleClusterResponse = distroXAutoScaleClusterV1Endpoint.getClusterByCrn(TEST_CLUSTER_CRN);
    assertEquals("Retrieved Alerts Size Should Match", 0, xAutoscaleClusterResponse.getLoadAlerts().size());
}
Also used : DistroXAutoscaleClusterResponse(com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterResponse) LoadAlertRequest(com.sequenceiq.periscope.api.model.LoadAlertRequest) DistroXAutoscaleClusterRequest(com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterRequest) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 9 with DistroXAutoscaleClusterResponse

use of com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterResponse in project cloudbreak by hortonworks.

the class DistroXAutoScaleClusterV1EndpointTest method testEnableAutoscaleForClusterName.

@Test
public void testEnableAutoscaleForClusterName() {
    DistroXAutoscaleClusterResponse xAutoscaleClusterResponse = distroXAutoScaleClusterV1Endpoint.enableAutoscaleForClusterName(TEST_CLUSTER_NAME, AutoscaleClusterState.enable());
    assertTrue("Autoscaling should be enabled", xAutoscaleClusterResponse.isAutoscalingEnabled());
    xAutoscaleClusterResponse = distroXAutoScaleClusterV1Endpoint.enableAutoscaleForClusterName(TEST_CLUSTER_NAME, AutoscaleClusterState.disable());
    assertFalse("Autoscaling should be disabled", xAutoscaleClusterResponse.isAutoscalingEnabled());
}
Also used : DistroXAutoscaleClusterResponse(com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterResponse) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 10 with DistroXAutoscaleClusterResponse

use of com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterResponse in project cloudbreak by hortonworks.

the class DistroXAutoScaleClusterV1EndpointTest method testUpdateAutoscaleConfigByClusterCrnForEnableDisableAutoscaling.

@Test
public void testUpdateAutoscaleConfigByClusterCrnForEnableDisableAutoscaling() {
    DistroXAutoscaleClusterRequest distroXAutoscaleClusterRequest = new DistroXAutoscaleClusterRequest();
    distroXAutoscaleClusterRequest.setEnableAutoscaling(true);
    DistroXAutoscaleClusterResponse xAutoscaleClusterResponse = distroXAutoScaleClusterV1Endpoint.updateAutoscaleConfigByClusterCrn(TEST_CLUSTER_CRN, distroXAutoscaleClusterRequest);
    assertTrue("Autoscaling should be enabled", xAutoscaleClusterResponse.isAutoscalingEnabled());
    distroXAutoscaleClusterRequest.setEnableAutoscaling(false);
    xAutoscaleClusterResponse = distroXAutoScaleClusterV1Endpoint.updateAutoscaleConfigByClusterCrn(TEST_CLUSTER_CRN, distroXAutoscaleClusterRequest);
    assertFalse("Autoscaling should be disabled", xAutoscaleClusterResponse.isAutoscalingEnabled());
}
Also used : DistroXAutoscaleClusterResponse(com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterResponse) DistroXAutoscaleClusterRequest(com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterRequest) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Aggregations

DistroXAutoscaleClusterResponse (com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterResponse)14 Test (org.junit.Test)12 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)12 DistroXAutoscaleClusterRequest (com.sequenceiq.periscope.api.model.DistroXAutoscaleClusterRequest)8 LoadAlertRequest (com.sequenceiq.periscope.api.model.LoadAlertRequest)3 TimeAlertRequest (com.sequenceiq.periscope.api.model.TimeAlertRequest)3 LoadAlertResponse (com.sequenceiq.periscope.api.model.LoadAlertResponse)1 TimeAlertResponse (com.sequenceiq.periscope.api.model.TimeAlertResponse)1