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