Search in sources :

Example 41 with Description

use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.

the class EnvironmentEditTest method authenticationEditWhenSetExistingKeyAndDeleteManagedSuccessfully.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there is a running cloudbreak managed ssh key", when = "change managed ssh key to existing one", then = "delete managed ssh key but not create new one")
public void authenticationEditWhenSetExistingKeyAndDeleteManagedSuccessfully(MockedTestContext testContext) {
    String randomPublicKeyId = UUID.randomUUID().toString();
    testContext.given(HttpMock.class).mockSpi().getPublicKey().get().pathVariable("publicKeyId", randomPublicKeyId).thenReturn(Map.of("publicKeyId", randomPublicKeyId, "publicKey", "asd")).given(EnvironmentTestDto.class).withCreateFreeIpa(false).when(environmentTestClient.create()).await(EnvironmentStatus.AVAILABLE).given(EnvironmentAuthenticationTestDto.class).withPublicKeyId(randomPublicKeyId).withPublicKey(null).given(EnvironmentTestDto.class).when(environmentTestClient.changeAuthentication()).when(environmentTestClient.describe()).then((tc, t, c) -> {
        String publicKeyId = t.getResponse().getAuthentication().getPublicKeyId();
        String publicKey = t.getResponse().getAuthentication().getPublicKey();
        if (!randomPublicKeyId.equals(publicKeyId)) {
            throw new TestFailException("The auth public key id was not changed, but it should be changed");
        }
        if (publicKey != null) {
            throw new TestFailException("The auth public key should be null");
        }
        return t;
    }).validate();
}
Also used : MockedTestContext(com.sequenceiq.it.cloudbreak.context.MockedTestContext) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) Test(org.testng.annotations.Test) HttpMock(com.sequenceiq.it.cloudbreak.dto.mock.HttpMock) UUID(java.util.UUID) EnvironmentSecurityAccessTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentSecurityAccessTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Inject(javax.inject.Inject) EnvironmentAuthenticationTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentAuthenticationTestDto) EnvironmentTestClient(com.sequenceiq.it.cloudbreak.client.EnvironmentTestClient) EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) Map(java.util.Map) EnvironmentStatus(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentStatus) BadRequestException(javax.ws.rs.BadRequestException) RunningParameter.expectedMessage(com.sequenceiq.it.cloudbreak.context.RunningParameter.expectedMessage) EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) EnvironmentAuthenticationTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentAuthenticationTestDto) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) HttpMock(com.sequenceiq.it.cloudbreak.dto.mock.HttpMock) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test)

Example 42 with Description

use of com.sequenceiq.it.cloudbreak.context.Description 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();
}
Also used : Logger(org.slf4j.Logger) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) LoggerFactory(org.slf4j.LoggerFactory) Log(com.sequenceiq.it.cloudbreak.log.Log) Test(org.testng.annotations.Test) SdxTestClient(com.sequenceiq.it.cloudbreak.client.SdxTestClient) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances) StringUtils(org.apache.commons.lang3.StringUtils) String.format(java.lang.String.format) Description(com.sequenceiq.it.cloudbreak.context.Description) SdxRestoreStatusResponse(com.sequenceiq.sdx.api.model.SdxRestoreStatusResponse) Inject(javax.inject.Inject) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) PreconditionSdxE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.sdx.PreconditionSdxE2ETest) SdxBackupStatusResponse(com.sequenceiq.sdx.api.model.SdxBackupStatusResponse) List(java.util.List) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) SdxClient(com.sequenceiq.it.cloudbreak.SdxClient) SdxClusterStatusResponse(com.sequenceiq.sdx.api.model.SdxClusterStatusResponse) Collections(java.util.Collections) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test) PreconditionSdxE2ETest(com.sequenceiq.it.cloudbreak.testcase.e2e.sdx.PreconditionSdxE2ETest) UseSpotInstances(com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances)

Example 43 with Description

use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.

the class InternalSdxRepairWithRecipeTest method testSDXMultiRepairIDBRokerAndMasterWithRecipeFile.

@Test(dataProvider = TEST_CONTEXT)
@Description(given = "there is a running Cloudbreak, and an SDX cluster in available state", when = "recovery called on the IDBROKER and MASTER host group, where the EC2 instance had been stopped", then = "SDX recovery should be successful, the cluster should be up and running")
public void testSDXMultiRepairIDBRokerAndMasterWithRecipeFile(TestContext testContext) throws IOException {
    String sdxInternal = resourcePropertyProvider().getName();
    String cluster = resourcePropertyProvider().getName();
    String clouderaManager = resourcePropertyProvider().getName();
    String recipeName = resourcePropertyProvider().getName();
    String stack = resourcePropertyProvider().getName();
    String filePath = "/post-install";
    String fileName = "post-install";
    String masterInstanceGroup = "master";
    String idbrokerInstanceGroup = "idbroker";
    SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
    sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
    testContext.given(clouderaManager, ClouderaManagerTestDto.class).given(cluster, ClusterTestDto.class).withBlueprintName(getDefaultSDXBlueprintName()).withValidateBlueprint(Boolean.FALSE).withClouderaManager(clouderaManager).given(RecipeTestDto.class).withName(recipeName).withContent(generateRecipeContent()).withRecipeType(POST_CLOUDERA_MANAGER_START).when(recipeTestClient.createV4()).given(masterInstanceGroup, InstanceGroupTestDto.class).withHostGroup(MASTER).withNodeCount(1).withRecipes(recipeName).given(idbrokerInstanceGroup, InstanceGroupTestDto.class).withHostGroup(IDBROKER).withNodeCount(1).withRecipes(recipeName).given(stack, StackTestDto.class).withCluster(cluster).withInstanceGroups(masterInstanceGroup, idbrokerInstanceGroup).given(sdxInternal, SdxInternalTestDto.class).withCloudStorage(getCloudStorageRequest(testContext)).withDatabase(sdxDatabaseRequest).withStackRequest(key(cluster), key(stack)).when(sdxTestClient.createInternal(), key(sdxInternal)).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().then((tc, testDto, client) -> {
        return sshJUtil.checkFilesOnHostByNameAndPath(testDto, getInstanceGroups(testDto, client), List.of(MASTER.getName(), IDBROKER.getName()), filePath, fileName, 1, null, null);
    }).then((tc, testDto, client) -> {
        List<String> instanceIdsToStop = sdxUtil.getInstanceIds(testDto, client, MASTER.getName());
        instanceIdsToStop.addAll(sdxUtil.getInstanceIds(testDto, client, IDBROKER.getName()));
        getCloudFunctionality(tc).stopInstances(testDto.getName(), instanceIdsToStop);
        return testDto;
    }).awaitForStoppedInstances().when(sdxTestClient.repairInternal(MASTER.getName(), IDBROKER.getName()), key(sdxInternal)).await(SdxClusterStatusResponse.REPAIR_IN_PROGRESS, key(sdxInternal).withWaitForFlow(Boolean.FALSE)).await(SdxClusterStatusResponse.RUNNING, key(sdxInternal)).awaitForHealthyInstances().then((tc, testDto, client) -> {
        return sshJUtil.checkFilesOnHostByNameAndPath(testDto, getInstanceGroups(testDto, client), List.of(MASTER.getName(), IDBROKER.getName()), filePath, fileName, 1, null, null);
    }).validate();
}
Also used : ClusterTestDto(com.sequenceiq.it.cloudbreak.dto.ClusterTestDto) SdxDatabaseAvailabilityType(com.sequenceiq.sdx.api.model.SdxDatabaseAvailabilityType) POST_CLOUDERA_MANAGER_START(com.sequenceiq.cloudbreak.api.endpoint.v4.recipes.requests.RecipeV4Type.POST_CLOUDERA_MANAGER_START) RecipeTestDto(com.sequenceiq.it.cloudbreak.dto.recipe.RecipeTestDto) RunningParameter.key(com.sequenceiq.it.cloudbreak.context.RunningParameter.key) Test(org.testng.annotations.Test) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) Base64(org.apache.commons.codec.binary.Base64) Description(com.sequenceiq.it.cloudbreak.context.Description) Inject(javax.inject.Inject) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) InstanceGroupTestDto(com.sequenceiq.it.cloudbreak.dto.InstanceGroupTestDto) ResourceUtil(com.sequenceiq.it.util.ResourceUtil) StackTestDto(com.sequenceiq.it.cloudbreak.dto.stack.StackTestDto) SdxUtil(com.sequenceiq.it.cloudbreak.util.SdxUtil) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) ClouderaManagerTestDto(com.sequenceiq.it.cloudbreak.dto.ClouderaManagerTestDto) MASTER(com.sequenceiq.it.cloudbreak.cloud.HostGroupType.MASTER) IDBROKER(com.sequenceiq.it.cloudbreak.cloud.HostGroupType.IDBROKER) IOException(java.io.IOException) SdxTestClient(com.sequenceiq.it.cloudbreak.client.SdxTestClient) StackTestClient(com.sequenceiq.it.cloudbreak.client.StackTestClient) SshJUtil(com.sequenceiq.it.cloudbreak.util.ssh.SshJUtil) List(java.util.List) SdxClusterStatusResponse(com.sequenceiq.sdx.api.model.SdxClusterStatusResponse) RecipeTestClient(com.sequenceiq.it.cloudbreak.client.RecipeTestClient) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) ClusterTestDto(com.sequenceiq.it.cloudbreak.dto.ClusterTestDto) RecipeTestDto(com.sequenceiq.it.cloudbreak.dto.recipe.RecipeTestDto) List(java.util.List) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test)

Example 44 with Description

use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.

the class MockSdxRepairTests method repairTerminatedMasterAndItFailedButInstanceShouldBeDeletedOnProviderSide.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there is a running Cloudbreak", when = "terminate instances and repair an sdx cluster", then = "repair should fail and repaired instance should be in deleted on provider side")
public void repairTerminatedMasterAndItFailedButInstanceShouldBeDeletedOnProviderSide(MockedTestContext testContext) {
    String sdxInternal = resourcePropertyProvider().getName();
    String networkKey = "someOtherNetwork";
    SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
    sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NON_HA);
    CustomDomainSettingsV4Request customDomain = new CustomDomainSettingsV4Request();
    customDomain.setDomainName("dummydomainname");
    customDomain.setHostname("dummyhostname");
    customDomain.setClusterNameAsSubdomain(true);
    customDomain.setHostgroupNameAsHostname(true);
    testContext.given(networkKey, EnvironmentNetworkTestDto.class).withMock(new EnvironmentNetworkMockParams()).given(EnvironmentTestDto.class).withNetwork(networkKey).withCreateFreeIpa(Boolean.TRUE).withName(resourcePropertyProvider().getEnvironmentName()).when(getEnvironmentTestClient().create()).await(EnvironmentStatus.AVAILABLE).given(FreeIpaTestDto.class).when(freeIpaTestClient.create()).await(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.Status.AVAILABLE).given(sdxInternal, SdxInternalTestDto.class).withDatabase(sdxDatabaseRequest).withCustomDomain(customDomain).when(sdxTestClient.createInternal(), key(sdxInternal)).await(SdxClusterStatusResponse.RUNNING, key(sdxInternal)).then((tc, testDto, client) -> {
        List<String> instancesToDelete = new ArrayList<>(sdxUtil.getInstanceIds(testDto, client, MASTER.getName()));
        instancesToDelete.forEach(instanceId -> getExecuteQueryToMockInfrastructure().call("/" + testDto.getCrn() + "/spi/" + instanceId + "/terminate", w -> w));
        getExecuteQueryToMockInfrastructure().executeMethod(Method.build("POST"), "/" + testDto.getCrn() + "/spi/disable_add_instance", new HashMap<>(), null, response -> {
        }, w -> w);
        return testDto;
    }).await(SdxClusterStatusResponse.NODE_FAILURE, pollingInterval(Duration.ofSeconds(POLLING_INTERVAL_FOR_REPAIR_SECONDS))).when(sdxTestClient.repairInternal(MASTER.getName()), key(sdxInternal)).awaitForMasterDeletedOnProvider().awaitForFlowFail().then((tc, testDto, client) -> {
        getExecuteQueryToMockInfrastructure().executeMethod(Method.build("POST"), "/" + testDto.getCrn() + "/spi/enable_add_instance", new HashMap<>(), null, response -> {
        }, w -> w);
        return testDto;
    }).when(sdxTestClient.repairInternal(MASTER.getName()), key(sdxInternal)).await(SdxClusterStatusResponse.RUNNING, key(sdxInternal)).validate();
}
Also used : SdxDatabaseAvailabilityType(com.sequenceiq.sdx.api.model.SdxDatabaseAvailabilityType) EnvironmentNetworkMockParams(com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkMockParams) FreeIpaTestDto(com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto) RunningParameter.key(com.sequenceiq.it.cloudbreak.context.RunningParameter.key) HashMap(java.util.HashMap) Test(org.testng.annotations.Test) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) ArrayList(java.util.ArrayList) Description(com.sequenceiq.it.cloudbreak.context.Description) EnvironmentNetworkTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentNetworkTestDto) Inject(javax.inject.Inject) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) Duration(java.time.Duration) CustomDomainSettingsV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.customdomain.CustomDomainSettingsV4Request) SdxUtil(com.sequenceiq.it.cloudbreak.util.SdxUtil) MockedTestContext(com.sequenceiq.it.cloudbreak.context.MockedTestContext) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) Method(com.sequenceiq.it.cloudbreak.dto.mock.Method) RunningParameter.pollingInterval(com.sequenceiq.it.cloudbreak.context.RunningParameter.pollingInterval) MASTER(com.sequenceiq.it.cloudbreak.cloud.HostGroupType.MASTER) IDBROKER(com.sequenceiq.it.cloudbreak.cloud.HostGroupType.IDBROKER) SdxTestClient(com.sequenceiq.it.cloudbreak.client.SdxTestClient) Consumer(java.util.function.Consumer) FreeIpaTestClient(com.sequenceiq.it.cloudbreak.client.FreeIpaTestClient) List(java.util.List) EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) EnvironmentStatus(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentStatus) SdxClusterStatusResponse(com.sequenceiq.sdx.api.model.SdxClusterStatusResponse) HostGroupType(com.sequenceiq.it.cloudbreak.cloud.HostGroupType) SdxInternalTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto) HashMap(java.util.HashMap) CustomDomainSettingsV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.customdomain.CustomDomainSettingsV4Request) EnvironmentNetworkMockParams(com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkMockParams) ArrayList(java.util.ArrayList) SdxDatabaseRequest(com.sequenceiq.sdx.api.model.SdxDatabaseRequest) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test)

Example 45 with Description

use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.

the class MockSdxTests method testCustomSDXCanBeCreatedThenDeletedSuccessfully.

@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "there is a running Cloudbreak", when = "a valid SDX Custom Create request is sent", then = "SDX should be available AND deletable")
public void testCustomSDXCanBeCreatedThenDeletedSuccessfully(MockedTestContext testContext) {
    String sdxCustom = resourcePropertyProvider().getName();
    String networkKey = "someNetwork";
    testContext.given(networkKey, EnvironmentNetworkTestDto.class).withMock(new EnvironmentNetworkMockParams()).given(EnvironmentTestDto.class).withNetwork(networkKey).withCreateFreeIpa(Boolean.FALSE).withName(resourcePropertyProvider().getEnvironmentName()).when(getEnvironmentTestClient().create()).await(EnvironmentStatus.AVAILABLE).given(sdxCustom, SdxCustomTestDto.class).withCustomInstanceGroup("master", "xlarge").when(sdxTestClient.createCustom(), key(sdxCustom)).await(SdxClusterStatusResponse.RUNNING, key(sdxCustom)).then(this::validateInstanceGroupInstanceTypeIsModified).then((tc, testDto, client) -> sdxTestClient.deleteCustom().action(tc, testDto, client)).await(SdxClusterStatusResponse.DELETED, key(sdxCustom)).validate();
}
Also used : EnvironmentNetworkTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentNetworkTestDto) EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) SdxCustomTestDto(com.sequenceiq.it.cloudbreak.dto.sdx.SdxCustomTestDto) EnvironmentNetworkMockParams(com.sequenceiq.environment.api.v1.environment.model.EnvironmentNetworkMockParams) Description(com.sequenceiq.it.cloudbreak.context.Description) Test(org.testng.annotations.Test)

Aggregations

Description (com.sequenceiq.it.cloudbreak.context.Description)72 Test (org.testng.annotations.Test)71 EnvironmentTestDto (com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto)30 Inject (javax.inject.Inject)30 TestContext (com.sequenceiq.it.cloudbreak.context.TestContext)29 DistroXTestDto (com.sequenceiq.it.cloudbreak.dto.distrox.DistroXTestDto)24 AbstractE2ETest (com.sequenceiq.it.cloudbreak.testcase.e2e.AbstractE2ETest)22 RunningParameter.key (com.sequenceiq.it.cloudbreak.context.RunningParameter.key)19 UseSpotInstances (com.sequenceiq.it.cloudbreak.util.spot.UseSpotInstances)19 SdxTestClient (com.sequenceiq.it.cloudbreak.client.SdxTestClient)17 SdxInternalTestDto (com.sequenceiq.it.cloudbreak.dto.sdx.SdxInternalTestDto)17 FreeIpaTestDto (com.sequenceiq.it.cloudbreak.dto.freeipa.FreeIpaTestDto)16 SdxClusterStatusResponse (com.sequenceiq.sdx.api.model.SdxClusterStatusResponse)16 SdxDatabaseRequest (com.sequenceiq.sdx.api.model.SdxDatabaseRequest)15 EnvironmentNetworkTestDto (com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentNetworkTestDto)14 List (java.util.List)14 ImageCatalogTestDto (com.sequenceiq.it.cloudbreak.dto.imagecatalog.ImageCatalogTestDto)13 TestFailException (com.sequenceiq.it.cloudbreak.exception.TestFailException)13 AbstractIntegrationTest (com.sequenceiq.it.cloudbreak.testcase.AbstractIntegrationTest)13 DistroXTestClient (com.sequenceiq.it.cloudbreak.client.DistroXTestClient)12