use of com.sequenceiq.it.cloudbreak.cloud.HostGroupType.IDBROKER in project cloudbreak by hortonworks.
the class AwsYcloudHybridCloudTest method testCreateSdxOnChildEnvironment.
@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running cloudbreak with parent-child environments ", when = "a valid SDX create request is sent to the child environment ", then = "SDX is created and instances are accessible via ssh by valid username and password ", and = "instances are not accessible via ssh by invalid username and password")
public void testCreateSdxOnChildEnvironment(TestContext testContext) {
String sdxInternal = resourcePropertyProvider().getName(CHILD_CLOUD_PLATFORM);
String clouderaManager = resourcePropertyProvider().getName(CHILD_CLOUD_PLATFORM);
String cluster = resourcePropertyProvider().getName(CHILD_CLOUD_PLATFORM);
String cmProduct = resourcePropertyProvider().getName(CHILD_CLOUD_PLATFORM);
String stack = resourcePropertyProvider().getName(CHILD_CLOUD_PLATFORM);
AtomicReference<String> cdhVersion = new AtomicReference<>();
AtomicReference<String> cdhParcel = new AtomicReference<>();
String runtimeVersion = commonClusterManagerProperties().getRuntimeVersion();
testContext.given(StackMatrixTestDto.class, CHILD_CLOUD_PLATFORM).when(utilTestClient.stackMatrixV4()).then((tc, dto, client) -> {
ClouderaManagerStackDescriptorV4Response response = dto.getResponse().getCdh().get(runtimeVersion);
cdhVersion.set(response.getVersion());
cdhParcel.set(response.getRepository().getStack().get(REDHAT7));
return dto;
}).validate();
testContext.given("telemetry", TelemetryTestDto.class).withLogging(CHILD_CLOUD_PLATFORM).withReportClusterLogs().given(cmProduct, ClouderaManagerProductTestDto.class, CHILD_CLOUD_PLATFORM).withName(CDH).withVersion(cdhVersion.get()).withParcel(cdhParcel.get()).given(clouderaManager, ClouderaManagerTestDto.class, CHILD_CLOUD_PLATFORM).withClouderaManagerProduct(cmProduct).given(cluster, ClusterTestDto.class, CHILD_CLOUD_PLATFORM).withBlueprintName(getDefaultSDXBlueprintName()).withValidateBlueprint(Boolean.FALSE).withClouderaManager(clouderaManager).given(MASTER_INSTANCE_GROUP, InstanceGroupTestDto.class, CHILD_CLOUD_PLATFORM).withHostGroup(MASTER).withNodeCount(1).given(IDBROKER_INSTANCE_GROUP, InstanceGroupTestDto.class, CHILD_CLOUD_PLATFORM).withHostGroup(IDBROKER).withNodeCount(1).given(STACK_AUTHENTICATION, StackAuthenticationTestDto.class, CHILD_CLOUD_PLATFORM).given(stack, StackTestDto.class, CHILD_CLOUD_PLATFORM).withCluster(cluster).withInstanceGroups(MASTER_INSTANCE_GROUP, IDBROKER_INSTANCE_GROUP).withStackAuthentication(STACK_AUTHENTICATION).withTelemetry("telemetry").given(sdxInternal, SdxInternalTestDto.class, CHILD_CLOUD_PLATFORM).withStackRequest(key(cluster), key(stack)).withEnvironmentKey(RunningParameter.key(CHILD_ENVIRONMENT_KEY)).when(sdxTestClient.createInternal(), key(sdxInternal)).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().then((tc, dto, client) -> {
String environmentCrn = dto.getResponse().getEnvironmentCrn();
com.sequenceiq.freeipa.api.client.FreeIpaClient freeIpaClient = tc.getMicroserviceClient(FreeIpaClient.class).getDefaultClient();
checkUserSyncState(environmentCrn, freeIpaClient);
String username = testContext.getActingUserCrn().getResource();
String sanitizedUserName = SanitizerUtil.sanitizeWorkloadUsername(username);
for (InstanceGroupV4Response ig : dto.getResponse().getStackV4Response().getInstanceGroups()) {
for (InstanceMetaDataV4Response i : ig.getMetadata()) {
String ip = i.getPublicIp();
LOGGER.info("Trying to ssh with user {} into instance: {}", sanitizedUserName, OBJECT_MAPPER.writeValueAsString(i));
testShhAuthenticationSuccessful(sanitizedUserName, ip);
testShhAuthenticationFailure(sanitizedUserName, ip);
}
}
return dto;
}).given(CHILD_ENVIRONMENT_KEY, EnvironmentTestDto.class, CHILD_CLOUD_PLATFORM).when(environmentTestClient.cascadingDelete(), RunningParameter.key(CHILD_ENVIRONMENT_KEY)).await(EnvironmentStatus.ARCHIVED, RunningParameter.key(CHILD_ENVIRONMENT_KEY)).validate();
}
use of com.sequenceiq.it.cloudbreak.cloud.HostGroupType.IDBROKER in project cloudbreak by hortonworks.
the class SdxImagesTests method testSDXWithBaseImageCanBeCreatedSuccessfully.
@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running Cloudbreak", when = "a valid SDX create request is sent (latest Base Image)", then = "SDX should be available AND deletable")
public void testSDXWithBaseImageCanBeCreatedSuccessfully(TestContext testContext) {
String sdxInternal = resourcePropertyProvider().getName();
String cluster = resourcePropertyProvider().getName();
String clouderaManager = resourcePropertyProvider().getName();
String imageSettings = resourcePropertyProvider().getName();
String imageCatalog = resourcePropertyProvider().getName();
String stack = resourcePropertyProvider().getName();
String masterInstanceGroup = "master";
String idbrokerInstanceGroup = "idbroker";
AtomicReference<String> selectedImageID = new AtomicReference<>();
SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
testContext.given(imageCatalog, ImageCatalogTestDto.class).when((tc, dto, client) -> {
selectedImageID.set(testContext.getCloudProvider().getLatestBaseImageID(tc, dto, client));
return dto;
}).given(imageSettings, ImageSettingsTestDto.class).given(clouderaManager, ClouderaManagerTestDto.class).given(cluster, ClusterTestDto.class).withBlueprintName(getDefaultSDXBlueprintName()).withValidateBlueprint(Boolean.FALSE).withClouderaManager(clouderaManager).given(masterInstanceGroup, InstanceGroupTestDto.class).withHostGroup(MASTER).withNodeCount(1).given(idbrokerInstanceGroup, InstanceGroupTestDto.class).withHostGroup(IDBROKER).withNodeCount(1).given(stack, StackTestDto.class).withCluster(cluster).withImageSettings(imageSettings).withInstanceGroups(masterInstanceGroup, idbrokerInstanceGroup).given(sdxInternal, SdxInternalTestDto.class).withDatabase(sdxDatabaseRequest).withCloudStorage(getCloudStorageRequest(testContext)).withStackRequest(key(cluster), key(stack)).when(sdxTestClient.createInternal(), key(sdxInternal)).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().then((tc, dto, client) -> {
Log.log(LOGGER, format(" Image Catalog Name: %s ", dto.getResponse().getStackV4Response().getImage().getCatalogName()));
Log.log(LOGGER, format(" Image Catalog URL: %s ", dto.getResponse().getStackV4Response().getImage().getCatalogUrl()));
Log.log(LOGGER, format(" Image ID: %s ", dto.getResponse().getStackV4Response().getImage().getId()));
if (!dto.getResponse().getStackV4Response().getImage().getId().equals(selectedImageID.get())) {
throw new TestFailException(" The selected image ID is: " + dto.getResponse().getStackV4Response().getImage().getId() + " instead of: " + selectedImageID.get());
}
return dto;
}).validate();
}
use of com.sequenceiq.it.cloudbreak.cloud.HostGroupType.IDBROKER in project cloudbreak by hortonworks.
the class InternalSdxRepairWithRecipeTest method testSDXMultiRepairIDBRokerAndMasterWithRecipeFile.
@Test(dataProvider = TEST_CONTEXT)
@Description(given = "there is a running Cloudbreak, and an SDX cluster in available state", when = "recovery called on the IDBROKER and MASTER host group, where the EC2 instance had been stopped", then = "SDX recovery should be successful, the cluster should be up and running")
public void testSDXMultiRepairIDBRokerAndMasterWithRecipeFile(TestContext testContext) throws IOException {
String sdxInternal = resourcePropertyProvider().getName();
String cluster = resourcePropertyProvider().getName();
String clouderaManager = resourcePropertyProvider().getName();
String recipeName = resourcePropertyProvider().getName();
String stack = resourcePropertyProvider().getName();
String filePath = "/post-install";
String fileName = "post-install";
String masterInstanceGroup = "master";
String idbrokerInstanceGroup = "idbroker";
SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
testContext.given(clouderaManager, ClouderaManagerTestDto.class).given(cluster, ClusterTestDto.class).withBlueprintName(getDefaultSDXBlueprintName()).withValidateBlueprint(Boolean.FALSE).withClouderaManager(clouderaManager).given(RecipeTestDto.class).withName(recipeName).withContent(generateRecipeContent()).withRecipeType(POST_CLOUDERA_MANAGER_START).when(recipeTestClient.createV4()).given(masterInstanceGroup, InstanceGroupTestDto.class).withHostGroup(MASTER).withNodeCount(1).withRecipes(recipeName).given(idbrokerInstanceGroup, InstanceGroupTestDto.class).withHostGroup(IDBROKER).withNodeCount(1).withRecipes(recipeName).given(stack, StackTestDto.class).withCluster(cluster).withInstanceGroups(masterInstanceGroup, idbrokerInstanceGroup).given(sdxInternal, SdxInternalTestDto.class).withCloudStorage(getCloudStorageRequest(testContext)).withDatabase(sdxDatabaseRequest).withStackRequest(key(cluster), key(stack)).when(sdxTestClient.createInternal(), key(sdxInternal)).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().then((tc, testDto, client) -> {
return sshJUtil.checkFilesOnHostByNameAndPath(testDto, getInstanceGroups(testDto, client), List.of(MASTER.getName(), IDBROKER.getName()), filePath, fileName, 1, null, null);
}).then((tc, testDto, client) -> {
List<String> instanceIdsToStop = sdxUtil.getInstanceIds(testDto, client, MASTER.getName());
instanceIdsToStop.addAll(sdxUtil.getInstanceIds(testDto, client, IDBROKER.getName()));
getCloudFunctionality(tc).stopInstances(testDto.getName(), instanceIdsToStop);
return testDto;
}).awaitForStoppedInstances().when(sdxTestClient.repairInternal(MASTER.getName(), IDBROKER.getName()), key(sdxInternal)).await(SdxClusterStatusResponse.REPAIR_IN_PROGRESS, key(sdxInternal).withWaitForFlow(Boolean.FALSE)).await(SdxClusterStatusResponse.RUNNING, key(sdxInternal)).awaitForHealthyInstances().then((tc, testDto, client) -> {
return sshJUtil.checkFilesOnHostByNameAndPath(testDto, getInstanceGroups(testDto, client), List.of(MASTER.getName(), IDBROKER.getName()), filePath, fileName, 1, null, null);
}).validate();
}
use of com.sequenceiq.it.cloudbreak.cloud.HostGroupType.IDBROKER in project cloudbreak by hortonworks.
the class SdxRepairTests method testSDXRepairMasterAndIDBRokerWithStoppedEC2Instance.
@Test(dataProvider = TEST_CONTEXT)
@Description(given = "there is a running Cloudbreak, and an SDX cluster in available state", when = "recovery called on the MASTER and then the IDBROKER host group, where the EC2 instance had been stopped", then = "SDX recovery should be successful, the cluster should be up and running")
public void testSDXRepairMasterAndIDBRokerWithStoppedEC2Instance(TestContext testContext) {
String sdx = resourcePropertyProvider().getName();
DescribeFreeIpaResponse describeFreeIpaResponse = testContext.given(FreeIpaTestDto.class).when(freeIpaTestClient.describe()).getResponse();
SdxTestDto sdxTestDto = testContext.given(sdx, SdxTestDto.class).withCloudStorage(getCloudStorageRequest(testContext)).when(sdxTestClient.create(), key(sdx)).await(SdxClusterStatusResponse.RUNNING, key(sdx)).awaitForHealthyInstances();
repair(sdxTestDto, sdx, MASTER.getName(), Set.of(SdxClusterStatusResponse.CLUSTER_UNREACHABLE));
repair(sdxTestDto, sdx, IDBROKER.getName(), Set.of(SdxClusterStatusResponse.NODE_FAILURE));
sdxTestDto.then((tc, testDto, client) -> {
getCloudFunctionality(tc).cloudStorageListContainerDataLake(getBaseLocation(testDto), testDto.getResponse().getName(), testDto.getResponse().getStackCrn());
return testDto;
}).then((tc, testDto, client) -> {
getCloudFunctionality(tc).cloudStorageListContainerFreeIpa(getBaseLocation(testDto), describeFreeIpaResponse.getName(), describeFreeIpaResponse.getCrn());
return testDto;
}).validate();
}
Aggregations