sathvikaragi commented on code in PR #14750:
URL: https://github.com/apache/cloudstack/pull/14750#discussion_r4755054297


##########
server/src/test/java/com/cloud/storage/VolumeApiServiceImplTest.java:
##########
@@ -2504,4 +2504,82 @@ public void 
testResizeVolumeInternal_VMware_VMRunning_ShouldThrowStateGuardError
                     e.getMessage() != null && e.getMessage().contains("VM 
should be in"));
         }
     }
+
+    private void setupSameCustomDiskOfferingChange(long volumeSizeInBytes) {
+        when(volumeVoMock.getSize()).thenReturn(volumeSizeInBytes);
+        when(diskOfferingMock.getId()).thenReturn(diskOfferingMockId);
+        when(diskOfferingMock.getRemoved()).thenReturn(null);
+        when(diskOfferingMock.getDiskSize()).thenReturn(0L);
+        when(diskOfferingMock.isComputeOnly()).thenReturn(false);
+        when(diskOfferingMock.isCustomized()).thenReturn(true);
+        when(diskOfferingMock.getDiskSizeStrictness()).thenReturn(false);
+        Mockito.lenient().when(diskOfferingMock.getTagsArray()).thenReturn(new 
String[0]);
+        
Mockito.lenient().when(volumeVoMock.getVolumeType()).thenReturn(Type.DATADISK);
+    }
+
+    @Test

Review Comment:
   You could add a test case for isCustomized = false case since that's part of 
this fix. Beyond that, adding tests for the other cases in 
validateVolumeResizeWithNewDiskOfferingAndLoad(removed offerings, 
diskSizeStrictness, invalid newSize, etc.) would be great! 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to