use of com.sequenceiq.cloudbreak.api.model.StackScaleRequestV2 in project cloudbreak by hortonworks.
the class StackScalingV2Test method testStackScaling.
@Test
@Parameters({ "hostGroup", "desiredCount", "checkAmbari" })
public void testStackScaling(String hostGroup, int desiredCount, @Optional("true") boolean checkAmbari) throws Exception {
// GIVEN
IntegrationTestContext itContext = getItContext();
String stackName = itContext.getContextParam(CloudbreakV2Constants.STACK_NAME);
String stackId = itContext.getContextParam(CloudbreakITContextConstants.STACK_ID);
String ambariUser = itContext.getContextParam(CloudbreakITContextConstants.AMBARI_USER_ID);
String ambariPassword = itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PASSWORD_ID);
String ambariPort = itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PORT_ID);
StackScaleRequestV2 stackScaleRequestV2 = new StackScaleRequestV2();
stackScaleRequestV2.setGroup(hostGroup);
stackScaleRequestV2.setDesiredCount(desiredCount);
// WHEN
Response response = getCloudbreakClient().stackV2Endpoint().putScaling(stackName, stackScaleRequestV2);
// THEN
CloudbreakUtil.checkResponse("ScalingStackV2", response);
Map<String, String> desiredStatuses = new HashMap<>();
desiredStatuses.put("status", "AVAILABLE");
desiredStatuses.put("clusterStatus", "AVAILABLE");
CloudbreakUtil.waitAndCheckStatuses(getCloudbreakClient(), stackId, desiredStatuses);
ScalingUtil.checkStackScaled(getCloudbreakClient().stackV2Endpoint(), stackId, hostGroup, desiredCount);
if (checkAmbari) {
int nodeCount = ScalingUtil.getNodeCountStack(getCloudbreakClient().stackV2Endpoint(), stackId);
ScalingUtil.checkClusterScaled(getCloudbreakClient().stackV2Endpoint(), ambariPort, stackId, ambariUser, ambariPassword, nodeCount, itContext);
}
}
Aggregations