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);
}
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);
}
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);
}
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;
}
Aggregations