use of com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances in project cloudbreak by hortonworks.
the class DistroXRepairTests method testDistroXMasterRepairWithTerminatedEC2Instances.
@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running Cloudbreak, and an environment with SDX and DistroX cluster in available state", when = "recovery called on the MASTER host group of DistroX cluster, where the EC2 instance had been terminated", then = "DistroX recovery should be successful, the cluster should be up and running")
public void testDistroXMasterRepairWithTerminatedEC2Instances(TestContext testContext) {
String distrox = resourcePropertyProvider().getName();
List<String> actualVolumeIds = new ArrayList<>();
List<String> expectedVolumeIds = new ArrayList<>();
testContext.given(distrox, DistroXTestDto.class).withPreferredSubnetsForInstanceNetworkIfMultiAzEnabledOrJustFirst().when(distroXTestClient.create(), key(distrox)).await(STACK_AVAILABLE).awaitForHealthyInstances().then(new AwsAvailabilityZoneAssertion()).then((tc, testDto, client) -> {
CloudFunctionality cloudFunctionality = tc.getCloudProvider().getCloudFunctionality();
List<String> instancesToDelete = distroxUtil.getInstanceIds(testDto, client, MASTER.getName());
expectedVolumeIds.addAll(cloudFunctionality.listInstanceVolumeIds(testDto.getName(), instancesToDelete));
cloudFunctionality.deleteInstances(testDto.getName(), instancesToDelete);
return testDto;
}).awaitForHostGroup(MASTER.getName(), InstanceStatus.DELETED_ON_PROVIDER_SIDE).when(distroXTestClient.repair(MASTER), key(distrox)).await(STACK_AVAILABLE, key(distrox)).awaitForHealthyInstances().then(new AwsAvailabilityZoneAssertion()).then((tc, testDto, client) -> {
CloudFunctionality cloudFunctionality = tc.getCloudProvider().getCloudFunctionality();
List<String> instanceIds = distroxUtil.getInstanceIds(testDto, client, MASTER.getName());
actualVolumeIds.addAll(cloudFunctionality.listInstanceVolumeIds(testDto.getName(), instanceIds));
return testDto;
}).then((tc, testDto, client) -> VolumeUtils.compareVolumeIdsAfterRepair(testDto, actualVolumeIds, expectedVolumeIds)).validate();
}
use of com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances in project cloudbreak by hortonworks.
the class DistroXRepairTests method testEphemeralDistroXMasterRepairWithTerminatedInstances.
@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running environment with FreeIPA and SDX in available state", when = "a new DistroX should be created", and = "MASTER host group should be recovered, where the instance had been terminated", then = "DistroX recovery should be successful, the cluster should be up and running with same volumes")
public void testEphemeralDistroXMasterRepairWithTerminatedInstances(TestContext testContext) {
String distrox = resourcePropertyProvider().getName();
List<String> actualVolumeIds = new ArrayList<>();
List<String> expectedVolumeIds = new ArrayList<>();
String userCrn = testContext.getActingUserCrn().toString();
String workloadUsername = testContext.given(UmsTestDto.class).assignTarget(EnvironmentTestDto.class.getSimpleName()).when(umsTestClient.getUserDetails(userCrn, regionAwareInternalCrnGeneratorFactory)).getResponse().getWorkloadUsername();
testContext.given(FreeIpaTestDto.class).when(freeIpaTestClient.describe()).given(FreeIpaUserSyncTestDto.class).when(freeIpaTestClient.getLastSyncOperationStatus()).await(OperationState.COMPLETED).given(UmsTestDto.class).assignTarget(EnvironmentTestDto.class.getSimpleName()).when(umsTestClient.setWorkloadPassword(workloadPassword, regionAwareInternalCrnGeneratorFactory)).given(FreeIpaUserSyncTestDto.class).when(freeIpaTestClient.syncAll()).await(OperationState.COMPLETED).given(FreeIpaTestDto.class).when(freeIpaTestClient.describe()).validate();
testContext.given(DistroXTestDto.class).when(distroXTestClient.get()).then(this::verifyMountedDisks).then((tc, testDto, client) -> {
List<InstanceGroupV4Response> instanceGroups = testDto.getResponse().getInstanceGroups();
return sshJUtil.checkMeteringStatus(testDto, instanceGroups, List.of(MASTER.getName()));
}).then((tc, testDto, client) -> {
CloudFunctionality cloudFunctionality = tc.getCloudProvider().getCloudFunctionality();
List<String> instancesToDelete = distroxUtil.getInstanceIds(testDto, client, MASTER.getName());
expectedVolumeIds.addAll(cloudFunctionality.listInstanceVolumeIds(testDto.getName(), instancesToDelete));
cloudFunctionality.deleteInstances(testDto.getName(), instancesToDelete);
return testDto;
}).awaitForHostGroup(MASTER.getName(), InstanceStatus.DELETED_ON_PROVIDER_SIDE).when(distroXTestClient.repair(MASTER), key(distrox)).await(STACK_AVAILABLE, key(distrox)).awaitForHealthyInstances().then(this::verifyMountedDisks).then((tc, testDto, client) -> clouderaManagerUtil.checkClouderaManagerYarnNodemanagerRoleConfigGroups(testDto, workloadUsername, workloadPassword)).then((tc, testDto, client) -> {
CloudFunctionality cloudFunctionality = tc.getCloudProvider().getCloudFunctionality();
List<String> instanceIds = distroxUtil.getInstanceIds(testDto, client, MASTER.getName());
actualVolumeIds.addAll(cloudFunctionality.listInstanceVolumeIds(testDto.getName(), instanceIds));
return testDto;
}).then((tc, testDto, client) -> VolumeUtils.compareVolumeIdsAfterRepair(testDto, actualVolumeIds, expectedVolumeIds)).validate();
}
use of com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances in project cloudbreak by hortonworks.
the class InternalSdxTest method testCreateInternalSdx.
@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "an SDX internal request", when = "a SDX internal create request is sent", then = "SDX is created")
public void testCreateInternalSdx(TestContext testContext) {
SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
testContext.given(SdxInternalTestDto.class).withDatabase(sdxDatabaseRequest).withCloudStorage(getCloudStorageRequest(testContext)).when(sdxTestClient.createInternal()).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().when(sdxTestClient.describeInternal()).validate();
}
use of com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances in project cloudbreak by hortonworks.
the class SdxCloudStorageTest method testSDXWithDataLakeAndFreeIpaStorageCanBeCreatedSuccessfully.
@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running Cloudbreak", when = "a basic SDX create request with FreeIPA and DataLake Cloud Storage has been sent", then = "SDX should be available along with the created Cloud storage objects")
public void testSDXWithDataLakeAndFreeIpaStorageCanBeCreatedSuccessfully(TestContext testContext) {
String sdx = resourcePropertyProvider().getName();
SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
DescribeFreeIpaResponse describeFreeIpaResponse = testContext.given(FreeIpaTestDto.class).when(freeIpaTestClient.describe()).getResponse();
testContext.given(sdx, SdxTestDto.class).withCloudStorage().withExternalDatabase(sdxDatabaseRequest).when(sdxTestClient.create(), key(sdx)).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().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();
}
use of com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances in project cloudbreak by hortonworks.
the class SdxImagesTests method testSDXWithPrewarmedImageCanBeCreatedSuccessfully.
@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running Cloudbreak", when = "a basic SDX create request is sent", then = "SDX should be available AND deletable")
public void testSDXWithPrewarmedImageCanBeCreatedSuccessfully(TestContext testContext) {
String sdx = resourcePropertyProvider().getName();
SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NON_HA);
testContext.given(sdx, SdxTestDto.class).withCloudStorage().withExternalDatabase(sdxDatabaseRequest).when(sdxTestClient.create(), key(sdx)).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().validate();
}
Aggregations