use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class InstanceGroupV2PreparationTest method createTemplateRequest.
@BeforeMethod(dependsOnGroups = "igRequestCreation")
@Parameters({ "group", "instanceType", "volumeType", "volumeSize", "volumeCount" })
public void createTemplateRequest(String group, String instanceType, String volumeType, int volumeSize, int volumeCount) {
TemplateV2Request templateV2Request = new TemplateV2Request();
templateV2Request.setInstanceType(instanceType);
templateV2Request.setVolumeType(volumeType);
templateV2Request.setVolumeSize(volumeSize);
templateV2Request.setVolumeCount(volumeCount);
IntegrationTestContext itContext = getItContext();
Map<String, InstanceGroupV2Request> igMap = itContext.getContextParam(CloudbreakV2Constants.INSTANCEGROUP_MAP, Map.class);
InstanceGroupV2Request instanceGroupV2Request = igMap.get(group);
instanceGroupV2Request.setTemplate(templateV2Request);
}
use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class InstanceGroupV2PreparationTest method createSecurityRequest.
@BeforeMethod(dependsOnGroups = "igRequestCreation")
@Parameters({ "group", "securityRules" })
public void createSecurityRequest(String group, String securityRules) {
IntegrationTestContext itContext = getItContext();
Map<String, InstanceGroupV2Request> igMap = itContext.getContextParam(CloudbreakV2Constants.INSTANCEGROUP_MAP, Map.class);
InstanceGroupV2Request instanceGroupV2Request = igMap.get(group);
SecurityGroupV2Request securityGroupV2Request = new SecurityGroupV2Request();
List<String[]> secRules = templateAdditionHelper.parseCommaSeparatedRows(securityRules);
List<SecurityRuleRequest> secRulesRequests = Lists.newArrayList();
for (String[] secRule : secRules) {
SecurityRuleRequest securityRuleRequest = new SecurityRuleRequest();
securityRuleRequest.setProtocol(secRule[0]);
securityRuleRequest.setSubnet(secRule[1]);
securityRuleRequest.setPorts(secRule[2]);
secRulesRequests.add(securityRuleRequest);
}
securityGroupV2Request.setSecurityRules(secRulesRequests);
instanceGroupV2Request.setSecurityGroup(securityGroupV2Request);
}
use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class InstanceGroupV2PreparationTest method createInstanceGroupRequest.
@BeforeMethod(groups = "igRequestCreation")
@Parameters({ "group", "nodeCount", "groupType", "recoveryMode" })
public void createInstanceGroupRequest(String group, int nodeCount, String groupType, @Optional("MANUAL") String recoveryMode) {
InstanceGroupV2Request instanceGroupV2Request = new InstanceGroupV2Request();
instanceGroupV2Request.setGroup(group);
instanceGroupV2Request.setNodeCount(nodeCount);
instanceGroupV2Request.setType(InstanceGroupType.valueOf(groupType));
IntegrationTestContext itContext = getItContext();
Map<String, InstanceGroupV2Request> igMap;
synchronized (itContext) {
igMap = itContext.getContextParam(CloudbreakV2Constants.INSTANCEGROUP_MAP, Map.class);
if (igMap == null) {
igMap = Maps.newConcurrentMap();
itContext.putContextParam(CloudbreakV2Constants.INSTANCEGROUP_MAP, igMap);
}
}
igMap.put(group, instanceGroupV2Request);
}
use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class ClusterAndStackDownscaleTest method testClusterAndStackDownscale.
@Test
@Parameters({ "instanceGroup", "scalingAdjustment" })
public void testClusterAndStackDownscale(@Optional("slave_1") String instanceGroup, int scalingAdjustment) {
// GIVEN
IntegrationTestContext itContext = getItContext();
String stackId = itContext.getContextParam(CloudbreakITContextConstants.STACK_ID);
int stackIntId = Integer.parseInt(stackId);
StackV1Endpoint stackV1Endpoint = itContext.getContextParam(CloudbreakITContextConstants.CLOUDBREAK_CLIENT, CloudbreakClient.class).stackV1Endpoint();
String ambariUser = itContext.getContextParam(CloudbreakITContextConstants.AMBARI_USER_ID);
String ambariPassword = itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PASSWORD_ID);
String ambariPort = itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PORT_ID);
int expectedNodeCountStack = ScalingUtil.getNodeCountStack(stackV1Endpoint, stackId) + scalingAdjustment;
int expectedNodeCountCluster = ScalingUtil.getNodeCountAmbari(stackV1Endpoint, ambariPort, stackId, ambariUser, ambariPassword, itContext) + scalingAdjustment;
// WHEN
UpdateClusterJson updateClusterJson = new UpdateClusterJson();
HostGroupAdjustmentJson hostGroupAdjustmentJson = new HostGroupAdjustmentJson();
hostGroupAdjustmentJson.setHostGroup(instanceGroup);
hostGroupAdjustmentJson.setWithStackUpdate(true);
hostGroupAdjustmentJson.setScalingAdjustment(scalingAdjustment);
updateClusterJson.setHostGroupAdjustment(hostGroupAdjustmentJson);
CloudbreakUtil.checkResponse("DownscaleCluster", getCloudbreakClient().clusterEndpoint().put((long) stackIntId, updateClusterJson));
CloudbreakUtil.waitAndCheckClusterStatus(getCloudbreakClient(), stackId, "AVAILABLE");
CloudbreakUtil.waitAndCheckStackStatus(getCloudbreakClient(), stackId, "AVAILABLE");
// THEN
ScalingUtil.checkStackScaled(stackV1Endpoint, stackId, expectedNodeCountStack);
ScalingUtil.checkClusterScaled(stackV1Endpoint, ambariPort, stackId, ambariUser, ambariPassword, expectedNodeCountCluster, itContext);
ScalingUtil.putInstanceCountToContext(itContext, stackId);
}
use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class ClusterScalingTest method testClusterScaling.
@Test
@Parameters({ "instanceGroup", "scalingAdjustment" })
public void testClusterScaling(@Optional("slave_1") String instanceGroup, int scalingAdjustment) {
// GIVEN
IntegrationTestContext itContext = getItContext();
String stackId = itContext.getContextParam(CloudbreakITContextConstants.STACK_ID);
int stackIntId = Integer.parseInt(stackId);
StackV1Endpoint stackV1Endpoint = itContext.getContextParam(CloudbreakITContextConstants.CLOUDBREAK_CLIENT, CloudbreakClient.class).stackV1Endpoint();
String ambariUser = itContext.getContextParam(CloudbreakITContextConstants.AMBARI_USER_ID);
String ambariPassword = itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PASSWORD_ID);
String ambariPort = itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PORT_ID);
int expectedNodeCount = ScalingUtil.getNodeCountAmbari(stackV1Endpoint, ambariPort, stackId, ambariUser, ambariPassword, itContext) + scalingAdjustment;
// WHEN
UpdateClusterJson updateClusterJson = new UpdateClusterJson();
HostGroupAdjustmentJson hostGroupAdjustmentJson = new HostGroupAdjustmentJson();
hostGroupAdjustmentJson.setHostGroup(instanceGroup);
hostGroupAdjustmentJson.setWithStackUpdate(false);
hostGroupAdjustmentJson.setScalingAdjustment(scalingAdjustment);
updateClusterJson.setHostGroupAdjustment(hostGroupAdjustmentJson);
CloudbreakUtil.checkResponse("ScalingCluster", getCloudbreakClient().clusterEndpoint().put((long) stackIntId, updateClusterJson));
CloudbreakUtil.waitAndCheckClusterStatus(getCloudbreakClient(), stackId, "AVAILABLE");
// THEN
ScalingUtil.checkClusterScaled(stackV1Endpoint, ambariPort, stackId, ambariUser, ambariPassword, expectedNodeCount, itContext);
}
Aggregations