use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class StackStopTest method setContextParameters.
@BeforeMethod
public void setContextParameters() {
IntegrationTestContext itContext = getItContext();
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 TagsTest method testTagTest.
@Test
@Parameters("tags")
public void testTagTest(String tags) throws Exception {
// GIVEN
IntegrationTestContext itContext = getItContext();
String stackId = itContext.getContextParam(CloudbreakITContextConstants.STACK_ID);
Map<String, String> cloudProviderParams = itContext.getContextParam(CloudbreakITContextConstants.CLOUDPROVIDER_PARAMETERS, Map.class);
StackV1Endpoint stackV1Endpoint = itContext.getContextParam(CloudbreakITContextConstants.CLOUDBREAK_CLIENT, CloudbreakClient.class).stackV1Endpoint();
StackResponse stackResponse = stackV1Endpoint.get(Long.valueOf(stackId), new HashSet<>());
Map<String, String> userDefinedTagsStack = TagsUtil.checkTagsStack(stackResponse);
Map<String, String> tagsToCheckMap = TagsUtil.getTagsToCheck(tags);
// WHEN: The cluster was created with user-defined tags
// THEN
TagsUtil.checkTags(tagsToCheckMap, userDefinedTagsStack);
List<String> instanceIdList = TagsUtil.getInstancesList(stackResponse);
TagsUtil.checkTagsWithProvider(stackResponse.getName(), cloudProviderParams, applicationContext, instanceIdList, tagsToCheckMap);
}
use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class ImageSelectionTest method testImageSelection.
@Test
public void testImageSelection() throws Exception {
// GIVEN
IntegrationTestContext itContext = getItContext();
// WHEN
ImagesResponse imagesResponse = getCloudbreakClient().imageCatalogEndpoint().getImagesByProvider(itContext.getContextParam(CloudbreakITContextConstants.CLOUDPROVIDER));
// THEN
Assert.assertFalse(imagesResponse.getBaseImages().isEmpty());
itContext.putContextParam(CloudbreakV2Constants.IMAGEID, imagesResponse.getBaseImages().get(0).getUuid());
}
use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class MockClusterCreationWithSaltFailTest method testClusterCreation.
@Test
@Parameters({ "clusterName", "ambariPort", "ambariUser", "ambariPassword", "emailNeeded", "enableSecurity", "kerberosMasterKey", "kerberosAdmin", "kerberosPassword", "runRecipesOnHosts", "checkAmbari", "mockPort" })
public void testClusterCreation(@Optional("it-cluster") String clusterName, @Optional("8080") String ambariPort, @Optional("admin") String ambariUser, @Optional("admin123!@#") String ambariPassword, @Optional("false") boolean emailNeeded, @Optional("false") boolean enableSecurity, @Optional String kerberosMasterKey, @Optional String kerberosAdmin, @Optional String kerberosPassword, @Optional("") String runRecipesOnHosts, @Optional("true") boolean checkAmbari, @Optional("9443") int mockPort) throws Exception {
// GIVEN
IntegrationTestContext itContext = getItContext();
String stackIdStr = itContext.getContextParam(CloudbreakITContextConstants.STACK_ID);
Integer stackId = Integer.valueOf(stackIdStr);
Integer blueprintId = Integer.valueOf(itContext.getContextParam(CloudbreakITContextConstants.BLUEPRINT_ID));
List<HostGroup> hostgroups = itContext.getContextParam(CloudbreakITContextConstants.HOSTGROUP_ID, List.class);
Set<HostGroupRequest> hostGroupJsons1 = convertHostGroups(hostgroups, runRecipesOnHosts);
itContext.putContextParam(CloudbreakITContextConstants.AMBARI_USER_ID, ambariUser);
itContext.putContextParam(CloudbreakITContextConstants.AMBARI_PASSWORD_ID, ambariPassword);
// WHEN
ClusterRequest clusterRequest = new ClusterRequest();
clusterRequest.setName(clusterName);
clusterRequest.setDescription("Cluster for integration test");
clusterRequest.setEnableSecurity(enableSecurity);
clusterRequest.setPassword(ambariPassword);
clusterRequest.setUserName(ambariUser);
clusterRequest.setBlueprintId(Long.valueOf(blueprintId));
clusterRequest.setHostGroups(hostGroupJsons1);
KerberosRequest kerberosRequest = new KerberosRequest();
kerberosRequest.setAdmin(kerberosAdmin);
kerberosRequest.setPassword(kerberosPassword);
kerberosRequest.setMasterKey(kerberosMasterKey);
clusterRequest.setKerberos(kerberosRequest);
initSpark();
Map<String, CloudVmMetaDataStatus> instanceMap = itContext.getContextParam(CloudbreakITContextConstants.MOCK_INSTANCE_MAP, Map.class);
addSaltMappings(instanceMap);
addAmbariMappings(instanceMap);
ClusterV1Endpoint clusterV1Endpoint = getCloudbreakClient().clusterEndpoint();
Long clusterId = clusterV1Endpoint.post(Long.valueOf(stackId), clusterRequest).getId();
// THEN
Assert.assertNotNull(clusterId);
CloudbreakUtil.waitAndCheckStackStatus(getCloudbreakClient(), stackIdStr, "AVAILABLE");
String failMessage = "Source file salt://ambari/scripts/ambari-server-initttt.sh not found | " + "Service ambari-server is already enabled, and is dead | " + "Package haveged is already installed.";
CloudbreakUtil.checkClusterFailed(getCloudbreakClient().stackV1Endpoint(), stackIdStr, failMessage);
}
use of com.sequenceiq.it.IntegrationTestContext in project cloudbreak by hortonworks.
the class MockClusterCreationWithSaltSuccessTest method configMockServer.
@BeforeClass
@Parameters({ "clusterName", "mockPort", "sshPort" })
public void configMockServer(String clusterName, @Optional("9443") int mockPort, @Optional("2020") int sshPort) {
IntegrationTestContext itContext = getItContext();
Map<String, CloudVmMetaDataStatus> instanceMap = itContext.getContextParam(CloudbreakITContextConstants.MOCK_INSTANCE_MAP, Map.class);
if (instanceMap == null || instanceMap.isEmpty()) {
throw new IllegalStateException("instance map should not be empty!");
}
StackCreationMock stackCreationMock = (StackCreationMock) applicationContext.getBean(StackCreationMock.NAME, mockPort, sshPort, instanceMap);
stackCreationMock.addSaltMappings();
stackCreationMock.addAmbariMappings(clusterName);
itContext.putContextParam(CloudbreakV2Constants.MOCK_SERVER, stackCreationMock);
}
Aggregations