use of com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances 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.util.spot.UseSpotInstances in project cloudbreak by hortonworks.
the class SdxSecurityTests method testSDXAutoTlsCertRotation.
@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running Cloudbreak, and an SDX cluster in available state", when = "autotls cert rotation is called on the SDX cluster", then = "host certificates' validity should be changed on all hosts, the cluster should be up and running")
public void testSDXAutoTlsCertRotation(TestContext testContext) {
String sdx = resourcePropertyProvider().getName();
List<String> originalCertValidityOutput = new ArrayList<>();
List<String> renewedCertValidityOutput = new ArrayList<>();
SdxDatabaseRequest noDatabaseRequest = new SdxDatabaseRequest();
noDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
testContext.given(sdx, SdxTestDto.class).withCloudStorage().withExternalDatabase(noDatabaseRequest).when(sdxTestClient.create(), key(sdx)).await(SdxClusterStatusResponse.RUNNING, key(sdx)).awaitForHealthyInstances().then((tc, testDto, client) -> {
Map<String, Pair<Integer, String>> certValidityCmdResultByIpsMap = sshJClientActions.executeSshCommandOnHost(getInstanceGroups(testDto, client), List.of(HostGroupType.MASTER.getName(), HostGroupType.IDBROKER.getName()), HOST_CERT_VALIDITY_CMD, false);
originalCertValidityOutput.addAll(certValidityCmdResultByIpsMap.values().stream().map(Pair::getValue).collect(Collectors.toList()));
return testDto;
}).when(sdxTestClient.rotateAutotlsCertificates(), key(sdx)).await(SdxClusterStatusResponse.CERT_ROTATION_IN_PROGRESS, key(sdx).withWaitForFlow(false)).await(SdxClusterStatusResponse.RUNNING, key(sdx)).awaitForHealthyInstances().then((tc, testDto, client) -> {
Map<String, Pair<Integer, String>> certValidityCmdResultByIpsMap = sshJClientActions.executeSshCommandOnHost(getInstanceGroups(testDto, client), List.of(HostGroupType.MASTER.getName(), HostGroupType.IDBROKER.getName()), HOST_CERT_VALIDITY_CMD, false);
renewedCertValidityOutput.addAll(certValidityCmdResultByIpsMap.entrySet().stream().map(e -> e.getValue().getValue()).collect(Collectors.toList()));
return testDto;
}).then((tc, testDto, client) -> compareCertValidityOutputs(testDto, originalCertValidityOutput, renewedCertValidityOutput)).validate();
}
use of com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances in project cloudbreak by hortonworks.
the class SdxBackupRestoreTest method testSDXBackupRestoreCanBeSuccessful.
@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running Manowar SDX cluster in available state", when = "a basic SDX backup then restore request has been sent", then = "SDX restore should be done successfully")
public void testSDXBackupRestoreCanBeSuccessful(TestContext testContext) {
SdxInternalTestDto sdxInternalTestDto = testContext.given(SdxInternalTestDto.class);
String cloudStorageBaseLocation = sdxInternalTestDto.getResponse().getCloudStorageBaseLocation();
String backupObject = "backups";
testContext.given(SdxInternalTestDto.class).when(sdxTestClient.syncInternal()).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().when(sdxTestClient.backupInternal(StringUtils.join(List.of(cloudStorageBaseLocation, backupObject), "/"), null)).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().then(this::validateDatalakeBackupStatus).then(this::validateDatalakeStatus).then((tc, testDto, client) -> {
getCloudFunctionality(tc).cloudStorageListContainer(cloudStorageBaseLocation, backupObject, true);
return testDto;
}).validate();
testContext.given(SdxInternalTestDto.class).when(sdxTestClient.restoreInternal(backupId, null)).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().then(this::validateDatalakeRestoreStatus).then(this::validateDatalakeStatus).validate();
}
use of com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances in project cloudbreak by hortonworks.
the class SdxResizeTests method testSDXResize.
@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running Cloudbreak, and an SDX cluster in available state", when = "resize called on the SDX cluster", then = "SDX resize should be successful, the cluster should be up and running")
public void testSDXResize(TestContext testContext) {
String sdx = resourcePropertyProvider().getName();
AtomicReference<String> expectedShape = new AtomicReference<>();
AtomicReference<String> expectedCrn = new AtomicReference<>();
AtomicReference<String> expectedName = new AtomicReference<>();
SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
testContext.given(sdx, SdxInternalTestDto.class).withDatabase(sdxDatabaseRequest).withCloudStorage(getCloudStorageRequest(testContext)).withClusterShape(SdxClusterShape.CUSTOM).when(sdxTestClient.createInternal(), key(sdx)).await(SdxClusterStatusResponse.RUNNING, key(sdx)).awaitForHealthyInstances().then((tc, testDto, client) -> {
expectedShape.set(sdxUtil.getShape(testDto, client));
expectedCrn.set(sdxUtil.getCrn(testDto, client));
expectedName.set(testDto.getName());
return testDto;
}).when(sdxTestClient.resize(), key(sdx)).await(SdxClusterStatusResponse.STOP_IN_PROGRESS, key(sdx).withWaitForFlow(Boolean.FALSE)).await(SdxClusterStatusResponse.STACK_CREATION_IN_PROGRESS, key(sdx).withWaitForFlow(Boolean.FALSE)).await(SdxClusterStatusResponse.RUNNING, key(sdx)).awaitForHealthyInstances().then((tc, dto, client) -> validateStackCrn(expectedCrn, dto)).then((tc, dto, client) -> validateCrn(expectedCrn, dto)).then((tc, dto, client) -> validateShape(dto)).then((tc, dto, client) -> validateClusterName(expectedName, dto)).validate();
}
use of com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances in project cloudbreak by hortonworks.
the class DistroXUpgradeTests method testDistroXUpgrades.
@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running Cloudbreak, and an environment with SDX and two DistroX clusters in " + "available state, one cluster created with deafult catalog and one cluster created with production catalog", when = "upgrade called on both DistroX clusters", then = "Both DistroX upgrade should be successful," + " the clusters should be up and running")
public void testDistroXUpgrades(TestContext testContext) {
String imageSettings = resourcePropertyProvider().getName();
String currentRuntimeVersion = commonClusterManagerProperties.getUpgrade().getDistroXUpgradeCurrentVersion();
String targetRuntimeVersion = commonClusterManagerProperties.getUpgrade().getDistroXUpgradeTargetVersion();
String currentRuntimeVersion3rdParty = commonClusterManagerProperties.getUpgrade().getDistroXUpgrade3rdPartyCurrentVersion();
String targetRuntimeVersion3rdParty = commonClusterManagerProperties.getUpgrade().getDistroXUpgrade3rdPartyTargetVersion();
String sdxName = resourcePropertyProvider().getName();
String distroXName = resourcePropertyProvider().getName();
String distroX3rdPartyName = resourcePropertyProvider().getName();
String thirdPartyCatalogName = resourcePropertyProvider().getName();
AtomicReference<String> uuid = new AtomicReference<>();
SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
testContext.given(sdxName, SdxTestDto.class).withRuntimeVersion(currentRuntimeVersion).withCloudStorage(getCloudStorageRequest(testContext)).withExternalDatabase(sdxDatabaseRequest).when(sdxTestClient.create(), key(sdxName)).await(SdxClusterStatusResponse.RUNNING, key(sdxName)).awaitForHealthyInstances().validate();
testContext.given(distroXName, DistroXTestDto.class).withTemplate(String.format(commonClusterManagerProperties.getInternalDistroXBlueprintType(), currentRuntimeVersion)).withPreferredSubnetsForInstanceNetworkIfMultiAzEnabledOrJustFirst().when(distroXTestClient.create(), key(distroXName)).validate();
createImageValidationSourceCatalog(testContext, commonClusterManagerProperties.getUpgrade().getImageCatalogUrl3rdParty(), thirdPartyCatalogName);
uuid.set(getUuid(testContext, thirdPartyCatalogName, currentRuntimeVersion3rdParty));
testContext.given(imageSettings, DistroXImageTestDto.class).withImageCatalog(thirdPartyCatalogName).withImageId(uuid.get()).given(distroX3rdPartyName, DistroXTestDto.class).withTemplate(String.format(commonClusterManagerProperties.getInternalDistroXBlueprintType(), currentRuntimeVersion3rdParty)).withPreferredSubnetsForInstanceNetworkIfMultiAzEnabledOrJustFirst().withImageSettings(imageSettings).when(distroXTestClient.create(), key(distroX3rdPartyName)).await(STACK_AVAILABLE, key(distroX3rdPartyName)).awaitForHealthyInstances().then((tc, testDto, client) -> checkImageId(testDto, uuid.get())).given(distroXName, DistroXTestDto.class).await(STACK_AVAILABLE, key(distroXName)).awaitForHealthyInstances().then(new AwsAvailabilityZoneAssertion()).validate();
testContext.given(DistroXUpgradeTestDto.class).withRuntime(targetRuntimeVersion).given(distroXName, DistroXTestDto.class).when(distroXTestClient.upgrade(), key(distroXName)).given(DistroXUpgradeTestDto.class).withRuntime(targetRuntimeVersion3rdParty).given(distroX3rdPartyName, DistroXTestDto.class).when(distroXTestClient.upgrade(), key(distroX3rdPartyName)).await(STACK_AVAILABLE, key(distroX3rdPartyName)).awaitForHealthyInstances().given(distroXName, DistroXTestDto.class).await(STACK_AVAILABLE, key(distroXName)).awaitForHealthyInstances().then(new AwsAvailabilityZoneAssertion()).validate();
}
Aggregations