Search in sources :

Example 1 with DistroXTestDto

use of com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto in project cloudbreak by hortonworks.

the class DistroXClusterStopStartTest method testCreateNewRegularDistroXClusterScaleStartStop.

// CB-7294
@Ignore
@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there is a running DistroX cluster", when = "a scale, start stop called many times", then = "the cluster should be available")
public void testCreateNewRegularDistroXClusterScaleStartStop(MockedTestContext testContext, ITestContext testNgContext) {
    DistroXStartStopTestParameters params = new DistroXStartStopTestParameters(testNgContext.getCurrentXmlTest().getAllParameters());
    String stack = resourcePropertyProvider().getName();
    int step = params.getStep();
    int current = step;
    DistroXTestDto currentContext = testContext.given(DIX_NET_KEY, DistroXNetworkTestDto.class).given(DIX_IMG_KEY, DistroXImageTestDto.class).withImageCatalog().withImageId(IMAGE_CATALOG_ID).given(CM_FOR_DISTRO_X, DistroXClouderaManagerTestDto.class).given(CLUSTER_KEY, DistroXClusterTestDto.class).withValidateBlueprint(false).withClouderaManager(CM_FOR_DISTRO_X).given(stack, DistroXTestDto.class).withCluster(CLUSTER_KEY).withName(stack).withImageSettings(DIX_IMG_KEY).withNetwork(DIX_NET_KEY).when(distroXClient.create(), key(stack)).await(STACK_AVAILABLE, key(stack));
    for (int i = 0; i < params.getTimes(); i++, current += step) {
        currentContext = currentContext.when(distroXClient.stop(), key(stack)).await(STACK_STOPPED, key(stack)).then(auditGrpcServiceAssertion::stop).when(distroXClient.start(), key(stack)).await(STACK_AVAILABLE, key(stack)).then(auditGrpcServiceAssertion::start).when(distroXClient.scale(params.getHostgroup(), current)).await(STACK_AVAILABLE, key(stack).withPollingInterval(POLLING_INTERVAL));
    }
    currentContext.validate();
}
Also used : DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) DistroXImageTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.image.DistroXImageTestDto) DistroXClusterTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.cluster.DistroXClusterTestDto) Ignore(org.testng.annotations.Ignore) Description(com.sequenceiq.it.cloudbreak.context.Description) AbstractClouderaManagerTest(com.sequenceiq.it.cloudbreak.testcase.mock.clouderamanager.AbstractClouderaManagerTest) Test(org.testng.annotations.Test)

Example 2 with DistroXTestDto

use of com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto in project cloudbreak by hortonworks.

the class DataHubListFilteringTest method testDataHubListFiltering.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there are datahubs", when = "users share with each other", then = "they see the other's datahub in the list")
public void testDataHubListFiltering(TestContext testContext) {
    useRealUmsUser(testContext, AuthUserKeys.USER_ENV_CREATOR_A);
    resourceCreator.createDefaultCredential(testContext);
    EnvironmentTestDto environment = resourceCreator.createDefaultEnvironment(testContext);
    resourceCreator.createNewFreeIpa(testContext, environment);
    resourceCreator.createDefaultDataLake(testContext);
    DistroXTestDto datahubA = resourceCreator.createDefaultDataHubAndWaitAs(testContext, Optional.of(AuthUserKeys.USER_ACCOUNT_ADMIN));
    testContext.given(UmsTestDto.class).assignTarget(EnvironmentTestDto.class.getSimpleName()).withDatahubCreator().when(umsTestClient.assignResourceRole(AuthUserKeys.USER_ENV_CREATOR_B, regionAwareInternalCrnGeneratorFactory)).withEnvironmentUser().when(umsTestClient.assignResourceRole(AuthUserKeys.USER_ENV_CREATOR_B, regionAwareInternalCrnGeneratorFactory)).validate();
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, datahubA.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, datahubA.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, datahubA.getName());
    useRealUmsUser(testContext, AuthUserKeys.USER_ENV_CREATOR_B);
    DistroXTestDto dataHubB = resourceCreator.createNewDataHubAndWaitAs(testContext, Optional.of(AuthUserKeys.USER_ACCOUNT_ADMIN));
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, datahubA.getName(), dataHubB.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, datahubA.getName(), dataHubB.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, datahubA.getName(), dataHubB.getName());
    testContext.given(UmsTestDto.class).assignTarget(DistroXTestDto.class.getSimpleName()).withDatahubAdmin().when(umsTestClient.assignResourceRole(AuthUserKeys.USER_ENV_CREATOR_B, regionAwareInternalCrnGeneratorFactory)).validate();
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_A, datahubA.getName(), dataHubB.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN, datahubA.getName(), dataHubB.getName());
    assertUserSeesAll(testContext, AuthUserKeys.USER_ENV_CREATOR_B, datahubA.getName(), dataHubB.getName());
    useRealUmsUser(testContext, AuthUserKeys.USER_ACCOUNT_ADMIN);
}
Also used : EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) AbstractIntegrationTest(com.sequenceiq.it.cloudbreak.testcase.AbstractIntegrationTest)

Example 3 with DistroXTestDto

use of com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto in project cloudbreak by hortonworks.

the class RenewDistroXCertificateTestDto method valid.

@Override
public RenewDistroXCertificateTestDto valid() {
    DistroXTestDto distroXTestDto = getTestContext().get(DistroXTestDto.class);
    this.stackCrn = distroXTestDto.getCrn();
    return this;
}
Also used : DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto)

Example 4 with DistroXTestDto

use of com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto in project cloudbreak by hortonworks.

the class DistroXClusterUpscaleDownscaleTest method testScaleDownAndUp.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there is a running DistroX cluster", when = "a scale, start stop called many times", then = "the cluster should be available")
public void testScaleDownAndUp(MockedTestContext testContext, ITestContext testNgContext) {
    DistroXStartStopTestParameters params = new DistroXStartStopTestParameters(testNgContext.getCurrentXmlTest().getAllParameters());
    String stack = resourcePropertyProvider().getName();
    createDatalake(testContext);
    DistroXTestDto currentContext = testContext.given(DIX_NET_KEY, DistroXNetworkTestDto.class).given(DIX_IMG_KEY, DistroXImageTestDto.class).withImageCatalog().withImageId(IMAGE_CATALOG_ID).given(CM_FOR_DISTRO_X, DistroXClouderaManagerTestDto.class).given(CLUSTER_KEY, DistroXClusterTestDto.class).withValidateBlueprint(false).withClouderaManager(CM_FOR_DISTRO_X).given(stack, DistroXTestDto.class).withCluster(CLUSTER_KEY).withName(stack).withImageSettings(DIX_IMG_KEY).withNetwork(DIX_NET_KEY).when(distroXClient.create(), key(stack)).await(STACK_AVAILABLE, key(stack));
    for (int i = 0; i < 3; i++) {
        currentContext = currentContext.when(distroXClient.scale(params.getHostgroup(), UPPER_NODE_COUNT)).await(STACK_AVAILABLE, key(stack).withPollingInterval(POLLING_INTERVAL));
        currentContext = currentContext.when(distroXClient.scale(params.getHostgroup(), LOWER_NODE_COUNT)).await(STACK_AVAILABLE, key(stack).withPollingInterval(POLLING_INTERVAL));
    }
    currentContext.validate();
}
Also used : DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto) DistroXImageTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.image.DistroXImageTestDto) DistroXClusterTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.cluster.DistroXClusterTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) AbstractClouderaManagerTest(com.sequenceiq.it.cloudbreak.testcase.mock.clouderamanager.AbstractClouderaManagerTest) Test(org.testng.annotations.Test)

Example 5 with DistroXTestDto

use of com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto in project cloudbreak by hortonworks.

the class DistroXClusterUpscaleDownscaleTest method scalingTestWithManyNodes.

private void scalingTestWithManyNodes(MockedTestContext testContext, int workerInitialNodeCount, int workerNodeCountAfterUpscale, int workerNodeCountAfterDownscale, int scalingCycles) {
    String stack = resourcePropertyProvider().getName();
    createDatalake(testContext);
    DistroXTestDto currentContext = createDistroxDto(testContext, stack, workerInitialNodeCount).when(distroXClient.create(), key(stack)).await(STACK_AVAILABLE, key(stack));
    for (int i = 0; i < scalingCycles; i++) {
        currentContext = currentContext.when(distroXClient.scale(HostGroupType.WORKER.getName(), workerNodeCountAfterDownscale)).await(STACK_AVAILABLE, key(stack).withPollingInterval(POLLING_INTERVAL));
        currentContext = currentContext.when(distroXClient.scale(HostGroupType.WORKER.getName(), workerNodeCountAfterUpscale)).await(STACK_AVAILABLE, key(stack).withPollingInterval(POLLING_INTERVAL));
    }
    currentContext.validate();
}
Also used : DistroXTestDto(com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto)

Aggregations

DistroXTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto)16 Test (org.testng.annotations.Test)11 StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)7 MockedTestContext (com.sequenceiq.it.cloudbreak.context.MockedTestContext)7 TestContext (com.sequenceiq.it.cloudbreak.context.TestContext)7 TagsV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.tags.TagsV4Response)6 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 Description (com.sequenceiq.it.cloudbreak.context.Description)4 HashMap (java.util.HashMap)3 DistroXClusterTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.cluster.DistroXClusterTestDto)2 DistroXImageTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.image.DistroXImageTestDto)2 SdxTestDto (com.sequenceiq.it.cloudbreak.dto.sdx.SdxTestDto)2 TestFailException (com.sequenceiq.it.cloudbreak.exception.TestFailException)2 Log (com.sequenceiq.it.cloudbreak.log.Log)2 AbstractClouderaManagerTest (com.sequenceiq.it.cloudbreak.testcase.mock.clouderamanager.AbstractClouderaManagerTest)2 String.format (java.lang.String.format)2 List (java.util.List)2 Map (java.util.Map)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2