Search in sources :

Example 26 with InternalUpgradeSettings

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.InternalUpgradeSettings in project cloudbreak by hortonworks.

the class UpgradePermissionProviderTest method testPermitStackUpgradeShouldReturnFalseWhenTheVersionsAreEqualAndTheBuildNumberIsLower.

@Test
public void testPermitStackUpgradeShouldReturnFalseWhenTheVersionsAreEqualAndTheBuildNumberIsLower() {
    String componentVersion = "7.2.1";
    Image currentImage = createImage(componentVersion, "2002");
    Image candidateImage = createImage(componentVersion, "2001");
    ImageFilterParams imageFilterParams = new ImageFilterParams(currentImage, true, Map.of(), DATALAKE_STACK_TYPE, null, STACK_ID, new InternalUpgradeSettings(false, true, true), imageCatalogPlatform(CLOUD_PLATFORM));
    when(componentBuildNumberComparator.compare(currentImage, candidateImage, ImagePackageVersion.CDH_BUILD_NUMBER.getKey())).thenReturn(false);
    when(supportedRuntimes.isSupported("7.2.1")).thenReturn(true);
    boolean actual = underTest.permitStackUpgrade(imageFilterParams, candidateImage);
    assertFalse(actual);
    verify(componentBuildNumberComparator).compare(currentImage, candidateImage, ImagePackageVersion.CDH_BUILD_NUMBER.getKey());
    verifyNoInteractions(upgradeMatrixService, componentVersionComparator);
}
Also used : ImageFilterParams(com.sequenceiq.cloudbreak.service.upgrade.image.ImageFilterParams) InternalUpgradeSettings(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.InternalUpgradeSettings) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) Test(org.junit.Test)

Example 27 with InternalUpgradeSettings

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.InternalUpgradeSettings in project cloudbreak by hortonworks.

the class UpgradePermissionProviderTest method testPermitStackUpgradeShouldReturnTrueWhenTheVersionsAreEqualAndTheBuildNumberIsGreater.

@Test
public void testPermitStackUpgradeShouldReturnTrueWhenTheVersionsAreEqualAndTheBuildNumberIsGreater() {
    String componentVersion = "7.2.1";
    Image currentImage = createImage(componentVersion, "2000");
    Image candidateImage = createImage(componentVersion, "2001");
    ImageFilterParams imageFilterParams = new ImageFilterParams(currentImage, true, Map.of(), DATALAKE_STACK_TYPE, null, STACK_ID, new InternalUpgradeSettings(false, true, true), imageCatalogPlatform(CLOUD_PLATFORM));
    when(componentBuildNumberComparator.compare(currentImage, candidateImage, ImagePackageVersion.CDH_BUILD_NUMBER.getKey())).thenReturn(true);
    when(supportedRuntimes.isSupported("7.2.1")).thenReturn(true);
    boolean actual = underTest.permitStackUpgrade(imageFilterParams, candidateImage);
    assertTrue(actual);
    verify(componentBuildNumberComparator).compare(currentImage, candidateImage, ImagePackageVersion.CDH_BUILD_NUMBER.getKey());
    verifyNoInteractions(upgradeMatrixService, componentVersionComparator);
}
Also used : ImageFilterParams(com.sequenceiq.cloudbreak.service.upgrade.image.ImageFilterParams) InternalUpgradeSettings(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.InternalUpgradeSettings) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) Test(org.junit.Test)

Example 28 with InternalUpgradeSettings

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.InternalUpgradeSettings in project cloudbreak by hortonworks.

the class UpgradePermissionProviderTest method testPermitStackUpgradeShouldReturnfalseWhenTheCandidateCdhVersionIsNotSupported.

@Test
public void testPermitStackUpgradeShouldReturnfalseWhenTheCandidateCdhVersionIsNotSupported() {
    String currentVersion = "7.2.1";
    String targetVersion = "7.2.10";
    Image currentImage = createImage(currentVersion, "2002");
    Image candidateImage = createImage(targetVersion, "2010");
    ImageFilterParams imageFilterParams = new ImageFilterParams(currentImage, true, Map.of(), DATALAKE_STACK_TYPE, null, STACK_ID, new InternalUpgradeSettings(false, true, true), imageCatalogPlatform(CLOUD_PLATFORM));
    when(supportedRuntimes.isSupported("7.2.10")).thenReturn(false);
    boolean actual = underTest.permitStackUpgrade(imageFilterParams, candidateImage);
    assertFalse(actual);
    verify(supportedRuntimes).isSupported("7.2.10");
    verifyNoInteractions(componentBuildNumberComparator, componentVersionComparator, upgradeMatrixService);
}
Also used : ImageFilterParams(com.sequenceiq.cloudbreak.service.upgrade.image.ImageFilterParams) InternalUpgradeSettings(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.InternalUpgradeSettings) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) Test(org.junit.Test)

Example 29 with InternalUpgradeSettings

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.InternalUpgradeSettings in project cloudbreak by hortonworks.

the class DistroXUpgradeServiceTest method createRequest.

private UpgradeV4Request createRequest(boolean osUpgradeEnabled) {
    UpgradeV4Request request = new UpgradeV4Request();
    request.setInternalUpgradeSettings(new InternalUpgradeSettings(true, true, osUpgradeEnabled));
    return request;
}
Also used : InternalUpgradeSettings(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.InternalUpgradeSettings) UpgradeV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.tags.upgrade.UpgradeV4Request)

Aggregations

InternalUpgradeSettings (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.InternalUpgradeSettings)25 Image (com.sequenceiq.cloudbreak.cloud.model.catalog.Image)13 ImageFilterParams (com.sequenceiq.cloudbreak.service.upgrade.image.ImageFilterParams)12 Test (org.junit.Test)12 UpgradeV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.tags.upgrade.UpgradeV4Request)11 UpgradeV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.upgrade.UpgradeV4Response)7 DistroXUpgradeV1Request (com.sequenceiq.distrox.api.v1.distrox.model.upgrade.DistroXUpgradeV1Request)7 Test (org.junit.jupiter.api.Test)7 DistroXUpgradeV1Response (com.sequenceiq.distrox.api.v1.distrox.model.upgrade.DistroXUpgradeV1Response)4 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)3 ClusterComponent (com.sequenceiq.cloudbreak.domain.stack.cluster.ClusterComponent)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)3 InternalOnly (com.sequenceiq.authorization.annotation.InternalOnly)2 NameOrCrn (com.sequenceiq.cloudbreak.api.endpoint.v4.dto.NameOrCrn)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 ClouderaManagerProduct (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct)1 CloudbreakImageCatalogV3 (com.sequenceiq.cloudbreak.cloud.model.catalog.CloudbreakImageCatalogV3)1 NotFoundException (com.sequenceiq.cloudbreak.common.exception.NotFoundException)1 CloudbreakImageCatalogException (com.sequenceiq.cloudbreak.core.CloudbreakImageCatalogException)1 CloudbreakImageNotFoundException (com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException)1