use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class IpPoolSelectionTest method testIpPoolSelection.
@Test
@Parameters({ "credentialName", "region", "availabilityZone", "poolName" })
public void testIpPoolSelection(@Optional("") String credentialName, @Optional("") String region, @Optional("") String availabilityZone, String poolName) {
// GIVEN
IntegrationTestContext itContext = getItContext();
credentialName = StringUtils.hasText(credentialName) ? credentialName : itContext.getContextParam(CloudbreakV2Constants.CREDENTIAL_NAME);
region = StringUtils.hasText(region) ? region : itContext.getContextParam(CloudbreakV2Constants.REGION);
availabilityZone = StringUtils.hasText(availabilityZone) ? availabilityZone : itContext.getContextParam(CloudbreakV2Constants.AVAILABILTYZONE);
PlatformResourceRequestJson resourceRequestJson = new PlatformResourceRequestJson();
resourceRequestJson.setCredentialName(credentialName);
resourceRequestJson.setRegion(region);
resourceRequestJson.setAvailabilityZone(availabilityZone);
// WHEN
PlatformIpPoolsResponse response = getCloudbreakClient().connectorV1Endpoint().getIpPoolsCredentialId(resourceRequestJson);
// THEN
Set<IpPoolJson> ipPools = response.getIppools().get(availabilityZone);
Assert.assertNotNull(ipPools, "ippools cannot be null for " + region);
java.util.Optional<IpPoolJson> selected = ipPools.stream().filter(rk -> rk.getName().equals(poolName)).findFirst();
Assert.assertTrue(selected.isPresent(), "the ippool list doesn't contain [" + poolName + ']');
getItContext().putContextParam(CloudbreakV2Constants.OPENSTACK_FLOATING_POOL, selected.get().getId());
}
use of com.sequenceiq.it.IntegrationTestContext 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);
}
}
use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class StackStartV2Test method setContextParameters.
@BeforeMethod
public void setContextParameters() {
IntegrationTestContext itContext = getItContext();
Assert.assertNotNull(itContext.getContextParam(CloudbreakV2Constants.STACK_NAME), "Stack name is mandatory.");
Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.STACK_ID), "Stack id is mandatory.");
Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.AMBARI_USER_ID), "Ambari user id is mandatory.");
Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PASSWORD_ID), "Ambari password id is mandatory.");
Assert.assertNotNull(itContext.getContextParam(CloudbreakITContextConstants.AMBARI_PORT_ID), "Ambari port id is mandatory.");
}
use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class StackStartV2Test method testStackStart.
@Test
public void testStackStart() {
// 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);
// WHEN
Response response = getCloudbreakClient().stackV2Endpoint().putStart(stackName);
// THEN
CloudbreakUtil.checkResponse("StartStackV2", response);
Map<String, String> desiredStatuses = new HashMap<>();
desiredStatuses.put("status", "AVAILABLE");
desiredStatuses.put("clusterStatus", "AVAILABLE");
CloudbreakUtil.waitAndCheckStatuses(getCloudbreakClient(), stackId, desiredStatuses);
CloudbreakUtil.checkClusterAvailability(getCloudbreakClient().stackV2Endpoint(), ambariPort, stackId, ambariUser, ambariPassword, true);
}
use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class MockScalingTest method setContextParameters.
@BeforeMethod
public void setContextParameters() {
super.setContextParameters();
IntegrationTestContext itContext = getItContext();
Assert.assertNotNull(itContext.getContextParam(CloudbreakV2Constants.STACK_CREATION_REQUEST, StackV2Request.class), "StackCreationRequest is mandatory.");
}
Aggregations