use of com.sequenceiq.cloudbreak.service.upgrade.image.ImageFilterParams in project cloudbreak by hortonworks.
the class UpgradePermissionProviderTest method testPermitStackUpgradeShouldReturnTrueWhenTheUpgradeNotPermittedByTheUpgradeMatrixButUpgradeMatrixCheckSkippedInImageFilterParams.
@Test
public void testPermitStackUpgradeShouldReturnTrueWhenTheUpgradeNotPermittedByTheUpgradeMatrixButUpgradeMatrixCheckSkippedInImageFilterParams() {
String currentVersion = "7.2.1";
String targetVersion = "7.2.2";
Image currentImage = createImage(currentVersion, "2002");
Image candidateImage = createImage(targetVersion, "2001");
ImageFilterParams imageFilterParams = new ImageFilterParams(currentImage, true, Map.of(), StackType.WORKLOAD, null, STACK_ID, new InternalUpgradeSettings(false, true, true), imageCatalogPlatform(CLOUD_PLATFORM));
when(componentVersionComparator.permitCmAndStackUpgradeByComponentVersion(currentVersion, targetVersion)).thenReturn(true);
when(supportedRuntimes.isSupported("7.2.2")).thenReturn(true);
boolean actual = underTest.permitStackUpgrade(imageFilterParams, candidateImage);
assertTrue(actual);
verify(componentVersionComparator).permitCmAndStackUpgradeByComponentVersion(currentVersion, targetVersion);
verify(upgradeMatrixService, never()).permitByUpgradeMatrix(currentVersion, targetVersion);
verifyNoInteractions(componentBuildNumberComparator);
}
use of com.sequenceiq.cloudbreak.service.upgrade.image.ImageFilterParams in project cloudbreak by hortonworks.
the class UpgradePermissionProviderTest method testPermitCmUpgradeShouldReturnTrueWhenTheUpgradeNotPermittedByTheUpgradeMatrix.
@Test
public void testPermitCmUpgradeShouldReturnTrueWhenTheUpgradeNotPermittedByTheUpgradeMatrix() {
String currentVersion = "7.2.1";
String targetVersion = "7.2.2";
Image currentImage = createImage(currentVersion, "2002");
Image candidateImage = createImage(targetVersion, "2001");
ImageFilterParams imageFilterParams = new ImageFilterParams(currentImage, true, Map.of(), DATALAKE_STACK_TYPE, null, STACK_ID, new InternalUpgradeSettings(false, true, true), imageCatalogPlatform(CLOUD_PLATFORM));
when(componentVersionComparator.permitCmAndStackUpgradeByComponentVersion(currentVersion, targetVersion)).thenReturn(true);
boolean actual = underTest.permitCmUpgrade(imageFilterParams, candidateImage);
assertTrue(actual);
verify(componentVersionComparator).permitCmAndStackUpgradeByComponentVersion(currentVersion, targetVersion);
verify(upgradeMatrixService, never()).permitByUpgradeMatrix(currentVersion, targetVersion);
verifyNoInteractions(componentBuildNumberComparator);
}
use of com.sequenceiq.cloudbreak.service.upgrade.image.ImageFilterParams in project cloudbreak by hortonworks.
the class UpgradePermissionProviderTest method testPermitStackUpgradeShouldReturnFalseWhenTheCandidateCmVersionIsLower.
@Test
public void testPermitStackUpgradeShouldReturnFalseWhenTheCandidateCmVersionIsLower() {
String currentVersion = "7.2.1";
String targetVersion = "7.1.2";
Image currentImage = createImage(currentVersion, "2002");
Image candidateImage = createImage(targetVersion, "2001");
ImageFilterParams imageFilterParams = new ImageFilterParams(currentImage, true, Map.of(), DATALAKE_STACK_TYPE, null, STACK_ID, new InternalUpgradeSettings(false, true, true), imageCatalogPlatform(CLOUD_PLATFORM));
when(componentVersionComparator.permitCmAndStackUpgradeByComponentVersion(currentVersion, targetVersion)).thenReturn(false);
when(supportedRuntimes.isSupported("7.1.2")).thenReturn(true);
boolean actual = underTest.permitStackUpgrade(imageFilterParams, candidateImage);
assertFalse(actual);
verify(componentVersionComparator).permitCmAndStackUpgradeByComponentVersion(currentVersion, targetVersion);
verifyNoInteractions(componentBuildNumberComparator, upgradeMatrixService);
}
use of com.sequenceiq.cloudbreak.service.upgrade.image.ImageFilterParams in project cloudbreak by hortonworks.
the class UpgradePermissionProviderTest method testPermitStackUpgradeShouldReturnFalseWhenTheCmBuildNumberIsNotAvailable.
@Test
public void testPermitStackUpgradeShouldReturnFalseWhenTheCmBuildNumberIsNotAvailable() {
Image currentImage = createImage("7.2.1", "2002");
Image candidateImage = createImage("7.2.1", null);
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.service.upgrade.image.ImageFilterParams in project cloudbreak by hortonworks.
the class CmAndStackVersionUpgradeImageFilterTest method testFilterShouldReturnTrueWhenNotLockedAndCMAndStackPermitcheckIsTrue.
@Test
public void testFilterShouldReturnTrueWhenNotLockedAndCMAndStackPermitcheckIsTrue() {
ImageFilterParams imageFilterParams = createImageFilterParams(false);
when(upgradePermissionProvider.permitStackUpgrade(imageFilterParams, candidateImage)).thenReturn(Boolean.TRUE);
when(upgradePermissionProvider.permitCmUpgrade(imageFilterParams, candidateImage)).thenReturn(Boolean.TRUE);
ImageFilterResult actual = underTest.filter(new ImageFilterResult(List.of(candidateImage)), imageFilterParams);
assertFalse(actual.getImages().isEmpty());
assertTrue(actual.getReason().isEmpty());
}
Aggregations