use of com.sequenceiq.it.cloudbreak.FreeIpaClient 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.FreeIpaClient in project cloudbreak by hortonworks.
the class TestContext method as.
public TestContext as(CloudbreakUser cloudbreakUser) {
checkShutdown();
LOGGER.info(" Acting user as: \ndisplay name: {} \naccess key: {} \nsecret key: {} \ncrn: {} \nadmin: {} ", cloudbreakUser.getDisplayName(), cloudbreakUser.getAccessKey(), cloudbreakUser.getSecretKey(), cloudbreakUser.getCrn(), cloudbreakUser.getAdmin());
Log.as(LOGGER, cloudbreakUser.toString());
setActingUser(cloudbreakUser);
if (clients.get(cloudbreakUser.getAccessKey()) == null) {
CloudbreakClient cloudbreakClient = CloudbreakClient.createProxyCloudbreakClient(testParameter, cloudbreakUser, regionAwareInternalCrnGeneratorFactory.iam());
FreeIpaClient freeIpaClient = FreeIpaClient.createProxyFreeIpaClient(testParameter, cloudbreakUser, regionAwareInternalCrnGeneratorFactory.iam());
EnvironmentClient environmentClient = EnvironmentClient.createProxyEnvironmentClient(testParameter, cloudbreakUser, regionAwareInternalCrnGeneratorFactory.iam());
SdxClient sdxClient = SdxClient.createProxySdxClient(testParameter, cloudbreakUser);
UmsClient umsClient = UmsClient.createProxyUmsClient(tracer, umsHost);
SdxSaasItClient sdxSaasItClient = SdxSaasItClient.createProxySdxSaasClient(tracer, umsHost, regionAwareInternalCrnGeneratorFactory);
RedbeamsClient redbeamsClient = RedbeamsClient.createProxyRedbeamsClient(testParameter, cloudbreakUser);
Map<Class<? extends MicroserviceClient>, MicroserviceClient> clientMap = Map.of(CloudbreakClient.class, cloudbreakClient, FreeIpaClient.class, freeIpaClient, EnvironmentClient.class, environmentClient, SdxClient.class, sdxClient, RedbeamsClient.class, redbeamsClient, UmsClient.class, umsClient, SdxSaasItClient.class, sdxSaasItClient);
clients.put(cloudbreakUser.getAccessKey(), clientMap);
cloudbreakClient.setWorkspaceId(0L);
}
return this;
}
use of com.sequenceiq.it.cloudbreak.FreeIpaClient in project cloudbreak by hortonworks.
the class FreeIpaTestDto method deleteForCleanup.
@Override
public void deleteForCleanup() {
try {
FreeIpaClient client = getClientForCleanup();
client.getDefaultClient().getFreeIpaV1Endpoint().delete(getResponse().getEnvironmentCrn(), false);
getTestContext().awaitWithClient(this, Map.of("status", DELETE_COMPLETED), client);
} catch (NotFoundException nfe) {
LOGGER.info("resource not found, thus cleanup not needed.");
}
}
use of com.sequenceiq.it.cloudbreak.FreeIpaClient in project cloudbreak by hortonworks.
the class TestContext method initMicroserviceClientsForUMSAccountAdmin.
private void initMicroserviceClientsForUMSAccountAdmin(CloudbreakUser accountAdmin) {
if (clients.get(accountAdmin.getAccessKey()) == null) {
CloudbreakClient cloudbreakClient = CloudbreakClient.createProxyCloudbreakClient(testParameter, accountAdmin, regionAwareInternalCrnGeneratorFactory.iam());
FreeIpaClient freeIpaClient = FreeIpaClient.createProxyFreeIpaClient(testParameter, accountAdmin, regionAwareInternalCrnGeneratorFactory.iam());
EnvironmentClient environmentClient = EnvironmentClient.createProxyEnvironmentClient(testParameter, accountAdmin, regionAwareInternalCrnGeneratorFactory.iam());
SdxClient sdxClient = SdxClient.createProxySdxClient(testParameter, accountAdmin);
UmsClient umsClient = UmsClient.createProxyUmsClient(tracer, umsHost);
SdxSaasItClient sdxSaasItClient = SdxSaasItClient.createProxySdxSaasClient(tracer, umsHost, regionAwareInternalCrnGeneratorFactory);
RedbeamsClient redbeamsClient = RedbeamsClient.createProxyRedbeamsClient(testParameter, accountAdmin);
Map<Class<? extends MicroserviceClient>, MicroserviceClient> clientMap = Map.of(CloudbreakClient.class, cloudbreakClient, FreeIpaClient.class, freeIpaClient, EnvironmentClient.class, environmentClient, SdxClient.class, sdxClient, RedbeamsClient.class, redbeamsClient, UmsClient.class, umsClient, SdxSaasItClient.class, sdxSaasItClient);
clients.put(accountAdmin.getAccessKey(), clientMap);
}
LOGGER.info(" Microservice clients have been initialized successfully for UMS account admin:: \nDisplay name: {} \nAccess key: {} \nSecret key: {} " + "\nCrn: {} ", accountAdmin.getDisplayName(), accountAdmin.getAccessKey(), accountAdmin.getSecretKey(), accountAdmin.getCrn());
}
Aggregations