use of com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances in project cloudbreak by hortonworks.
the class NewNetworkWithNoInternetEnvironmentTests method testCreateNewEnvironmentWithNewNetworkAndNoInternet.
@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running cloudbreak", when = "create an Environment with new network which CIDR is 10.0.0.0/16, outbound internet traffic is disabled with FreeIPA and SDX", then = "should create new Subnets and the number depends on the provider and should create instances without internet access.")
public void testCreateNewEnvironmentWithNewNetworkAndNoInternet(TestContext testContext) {
String networkKey = "someOtherNetwork";
String sdx = resourcePropertyProvider().getName();
SdxDatabaseRequest database = new SdxDatabaseRequest();
database.setCreate(false);
testContext.given(CredentialTestDto.class).when(credentialTestClient.create()).given("telemetry", TelemetryTestDto.class).withLogging().withReportClusterLogs().given(EnvironmentTestDto.class).given(networkKey, EnvironmentNetworkTestDto.class).withNetworkCIDR("10.0.0.0/16").withPrivateSubnets().withNoOutboundInternetTraffic().withServiceEndpoints().given(EnvironmentTestDto.class).withNetwork(networkKey).withTelemetry("telemetry").withCreateFreeIpa(Boolean.TRUE).when(environmentTestClient.create()).await(EnvironmentStatus.AVAILABLE).then((tc, testDto, cc) -> environmentTestClient.describe().action(tc, testDto, cc)).then(EnvironmentNetworkTestAssertion.environmentContainsNeccessaryConfigs()).init(FreeIpaTestDto.class).when(freeIpaTestClient.describe()).then((tc, testDto, client) -> sshJClientActions.checkNoOutboundInternetTraffic(testDto, client)).given(sdx, SdxTestDto.class).withExternalDatabase(database).withCloudStorage().when(sdxTestClient.create(), RunningParameter.key(sdx)).await(SdxClusterStatusResponse.RUNNING).then((tc, testDto, client) -> sshJClientActions.checkNoOutboundInternetTraffic(testDto, getInstanceGroups(testDto, client), List.of(HostGroupType.MASTER.getName()))).validate();
}
use of com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances 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.util.spot.UseSpotInstances in project cloudbreak by hortonworks.
the class DistroXRepairTests method testEphemeralDistroXMasterRepairWithTerminatedEC2Instances.
@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 testEphemeralDistroXMasterRepairWithTerminatedEC2Instances(TestContext testContext) {
String distrox = resourcePropertyProvider().getName();
List<String> actualVolumeIds = new ArrayList<>();
List<String> expectedVolumeIds = new ArrayList<>();
String username = testContext.getActingUserCrn().getResource();
String sanitizedUserName = SanitizerUtil.sanitizeWorkloadUsername(username);
testContext.given(distrox, DistroXTestDto.class).withInstanceGroupsEntity(new DistroXInstanceGroupsBuilder(testContext).defaultHostGroup().withStorageOptimizedInstancetype().build()).when(distroXTestClient.create(), key(distrox)).await(STACK_AVAILABLE).awaitForHealthyInstances().then(this::verifyMountedDisks).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, sanitizedUserName, MOCK_UMS_PASSWORD)).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 DistroXStopStartTest method testCreateDistroXWithEphemeralTemporaryStorage.
@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running cloudbreak", when = "two valid DistroX create requests are sent one with ephemeral temporary storage and one without it", then = "clusters are created, device mount point are checked, and after stopping and starting the clusters ephemeral store handling checked again")
public void testCreateDistroXWithEphemeralTemporaryStorage(TestContext testContext) {
String username = testContext.getActingUserCrn().getResource();
String sanitizedUserName = SanitizerUtil.sanitizeWorkloadUsername(username);
testContext.given("non_eph_dx", DistroXTestDto.class).withInstanceGroupsEntity(new DistroXInstanceGroupsBuilder(testContext).defaultHostGroup().build()).when(distroXTestClient.create(), RunningParameter.key("non_eph_dx")).given("eph_dx", DistroXTestDto.class).withInstanceGroupsEntity(new DistroXInstanceGroupsBuilder(testContext).defaultHostGroup().withStorageOptimizedInstancetype().build()).when(distroXTestClient.create(), RunningParameter.key("eph_dx")).given("non_eph_dx", DistroXTestDto.class).await(STACK_AVAILABLE, RunningParameter.key("non_eph_dx")).then((tc, testDto, client) -> verifyEphemeralVolumesShouldNotBeConfiguredInHdfs(tc, sanitizedUserName, testDto)).when(distroXTestClient.stop(), RunningParameter.key("non_eph_dx")).await(STACK_STOPPED, RunningParameter.key("non_eph_dx")).when(distroXTestClient.start(), RunningParameter.key("non_eph_dx")).await(STACK_AVAILABLE, RunningParameter.key("non_eph_dx")).then((tc, testDto, client) -> verifyEphemeralVolumesShouldNotBeConfiguredInHdfs(tc, sanitizedUserName, testDto)).given("eph_dx", DistroXTestDto.class).await(STACK_AVAILABLE, RunningParameter.key("eph_dx")).then(this::verifyMountedDisks).then((tc, testDto, client) -> verifyEphemeralVolumesShouldNotBeConfiguredInHdfs(tc, sanitizedUserName, testDto)).then((tc, testDto, client) -> clouderaManagerUtil.checkClouderaManagerYarnNodemanagerRoleConfigGroups(testDto, sanitizedUserName, MOCK_UMS_PASSWORD)).when(distroXTestClient.stop(), RunningParameter.key("eph_dx")).await(STACK_STOPPED, RunningParameter.key("eph_dx")).when(distroXTestClient.start(), RunningParameter.key("eph_dx")).await(STACK_AVAILABLE, RunningParameter.key("eph_dx")).then(this::verifyMountedDisks).then((tc, testDto, client) -> clouderaManagerUtil.checkClouderaManagerYarnNodemanagerRoleConfigGroups(testDto, sanitizedUserName, MOCK_UMS_PASSWORD)).validate();
}
use of com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances in project cloudbreak by hortonworks.
the class DistroXEncryptedVolumeTest method testCreateDistroXWithEncryptedVolumesInSingleRG.
@Test(dataProvider = TEST_CONTEXT, groups = { "azure_singlerg" })
@UseSpotInstances
@Description(given = "there is a valid Azure credential and a new resource group", when = "environment with freeIpa should be created in the resource group with encrypted volume", and = "SDX then distroX also with encrypted volumes should be created for environment", then = "freeIpa, sdx and distroX volumes should be encrypted with the provided key")
public void testCreateDistroXWithEncryptedVolumesInSingleRG(TestContext testContext) {
DistroXDatabaseRequest distroXDatabaseRequest = new DistroXDatabaseRequest();
List<DistroXInstanceGroupTestDto> distroXInstanceGroupTestDtos = new DistroXInstanceGroupsBuilder(testContext).defaultHostGroup().withDiskEncryption().build();
distroXDatabaseRequest.setAvailabilityType(DistroXDatabaseAvailabilityType.NON_HA);
createResourceGroupForEnvironment(testContext);
testContext.given(EnvironmentNetworkTestDto.class).withServiceEndpoints().given("telemetry", TelemetryTestDto.class).withLogging().withReportClusterLogs().given(EnvironmentTestDto.class).withNetwork().withResourceGroup(ResourceGroupTest.AZURE_RESOURCE_GROUP_USAGE_SINGLE, resourceGroupForTest).withResourceEncryption().withTelemetry("telemetry").withTunnel(Tunnel.CLUSTER_PROXY).withCreateFreeIpa(Boolean.FALSE).when(environmentTestClient.create()).then((context, dto, client) -> {
context.getCloudProviderAssertion().assertServiceEndpoint(dto);
return dto;
}).await(EnvironmentStatus.AVAILABLE).given(FreeIpaTestDto.class).withEnvironment().withTelemetry("telemetry").withCatalog(commonCloudProperties().getImageValidation().getFreeIpaImageCatalog(), commonCloudProperties().getImageValidation().getFreeIpaImageUuid()).when(freeIpaTestClient.create()).await(Status.AVAILABLE).awaitForHealthyInstances().given(FreeIpaUserSyncTestDto.class).when(freeIpaTestClient.getLastSyncOperationStatus()).await(OperationState.COMPLETED).given(EnvironmentTestDto.class).when(environmentTestClient.describe()).then(this::verifyEnvironmentResponseDiskEncryptionKey).given(FreeIpaTestDto.class).then(this::verifyFreeIpaVolumeEncryptionKey).given(SdxTestDto.class).withCloudStorage().when(sdxTestClient.create()).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().then(this::verifySdxVolumeEncryptionKey).given(DistroXTestDto.class).withInstanceGroupsEntity(distroXInstanceGroupTestDtos).withExternalDatabase(distroXDatabaseRequest).when(distroXTestClient.create()).await(STACK_AVAILABLE).awaitForHealthyInstances().then(this::verifyDistroxVolumeEncryptionKey).then(this::verifyAwsEnaDriver).then(new AwsAvailabilityZoneAssertion()).then(validateTemplateContainsExternalDatabaseHostname()).validate();
}
Aggregations