use of com.sequenceiq.it.cloudbreak.cloud.HostGroupType in project cloudbreak by hortonworks.
the class MockSdxRepairTests method testRepair.
public void testRepair(MockedTestContext testContext, List<HostGroupType> hostGroups, Consumer<String> actionOnNode, SdxClusterStatusResponse stateBeforeRepair) {
String sdxInternal = resourcePropertyProvider().getName();
String networkKey = "someOtherNetwork";
SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NON_HA);
CustomDomainSettingsV4Request customDomain = new CustomDomainSettingsV4Request();
customDomain.setDomainName("dummydomainname");
customDomain.setHostname("dummyhostname");
customDomain.setClusterNameAsSubdomain(true);
customDomain.setHostgroupNameAsHostname(true);
testContext.given(networkKey, EnvironmentNetworkTestDto.class).withMock(new EnvironmentNetworkMockParams()).given(EnvironmentTestDto.class).withNetwork(networkKey).withCreateFreeIpa(Boolean.TRUE).withName(resourcePropertyProvider().getEnvironmentName()).when(getEnvironmentTestClient().create()).await(EnvironmentStatus.AVAILABLE).given(FreeIpaTestDto.class).when(freeIpaTestClient.create()).await(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.Status.AVAILABLE).given(sdxInternal, SdxInternalTestDto.class).withDatabase(sdxDatabaseRequest).withCustomDomain(customDomain).when(sdxTestClient.createInternal(), key(sdxInternal)).await(SdxClusterStatusResponse.RUNNING, key(sdxInternal)).then((tc, testDto, client) -> {
List<String> instancesToDelete = new ArrayList<>();
for (HostGroupType hostGroupType : hostGroups) {
instancesToDelete.addAll(sdxUtil.getInstanceIds(testDto, client, hostGroupType.getName()));
}
instancesToDelete.forEach(instanceId -> actionOnNode.accept("/" + testDto.getCrn() + "/spi/" + instanceId));
return testDto;
}).await(stateBeforeRepair, pollingInterval(Duration.ofSeconds(POLLING_INTERVAL_FOR_REPAIR_SECONDS))).when(sdxTestClient.repairInternal(hostGroups.stream().map(HostGroupType::getName).toArray(String[]::new)), key(sdxInternal)).await(SdxClusterStatusResponse.RUNNING, key(sdxInternal)).validate();
}
use of com.sequenceiq.it.cloudbreak.cloud.HostGroupType in project cloudbreak by hortonworks.
the class RecipeClusterTest method testDeletedRecipeCannotBeAssignedToCluster.
@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "a deleted recipe", when = "starting cluster with deleted recipe", then = "badrequest exception is received")
public void testDeletedRecipeCannotBeAssignedToCluster(MockedTestContext testContext) {
LOGGER.info("testing recipe execution for type: {}", PRE_CLOUDERA_MANAGER_START.name());
String recipeName = resourcePropertyProvider().getName();
String stackName = resourcePropertyProvider().getName();
String instanceGroupName = resourcePropertyProvider().getName();
HostGroupType hostGroupTypeForRecipe = HostGroupType.WORKER;
testContext.given(recipeName, RecipeTestDto.class).withName(recipeName).withContent(RECIPE_CONTENT).withRecipeType(PRE_CLOUDERA_MANAGER_START).when(recipeTestClient.createV4(), RunningParameter.key(recipeName)).when(recipeTestClient.deleteV4(), RunningParameter.key(recipeName)).given(instanceGroupName, InstanceGroupTestDto.class).withHostGroup(hostGroupTypeForRecipe).withNodeCount(NODE_COUNT).withRecipes(recipeName).given(stackName, StackTestDto.class).replaceInstanceGroups(instanceGroupName).whenException(stackTestClient.createV4(), BadRequestException.class, expectedMessage(String.format("The given recipe does not exist" + " for the instance group \"%s\": %s", hostGroupTypeForRecipe.getName(), recipeName))).validate();
}
Aggregations