Skip to content

Commit 9c63c61

Browse files
CSTACKEX-18_2: junit fixes with recent refactor
1 parent 672d7a4 commit 9c63c61

File tree

3 files changed

+15
-23
lines changed

3 files changed

+15
-23
lines changed

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/UnifiedSANStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public void deleteCloudStackVolume(CloudStackVolume cloudstackVolume) {
139139

140140
@Override
141141
public void copyCloudStackVolume(CloudStackVolume cloudstackVolume) {
142-
142+
// TODO: Implement LUN clone operation
143143
}
144144

145145
@Override

plugins/storage/volume/ontap/src/test/java/org/apache/cloudstack/storage/service/StorageStrategyTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ public CloudStackVolume snapshotCloudStackVolume(CloudStackVolume cloudstackVolu
152152
return null;
153153
}
154154

155+
@Override
156+
public JobResponse revertSnapshotForCloudStackVolume(String snapshotName, String flexVolUuid, String snapshotUuid, String volumePath, String lunUuid, String flexVolName) {
157+
return null;
158+
}
159+
155160
@Override
156161
public AccessGroup createAccessGroup(
157162
org.apache.cloudstack.storage.service.model.AccessGroup accessGroup) {

plugins/storage/volume/ontap/src/test/java/org/apache/cloudstack/storage/service/UnifiedSANStrategyTest.java

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import org.apache.cloudstack.storage.feign.model.Lun;
3131
import org.apache.cloudstack.storage.feign.model.LunMap;
3232
import org.apache.cloudstack.storage.feign.model.OntapStorage;
33-
import org.apache.cloudstack.storage.feign.model.Svm;
3433
import org.apache.cloudstack.storage.feign.model.response.OntapResponse;
3534
import org.apache.cloudstack.storage.service.model.AccessGroup;
3635
import org.apache.cloudstack.storage.service.model.CloudStackVolume;
@@ -788,41 +787,29 @@ void testValidateInitiatorInAccessGroup_IgroupNotFound_ReturnsFalse() {
788787
}
789788

790789
@Test
791-
void testCopyCloudStackVolume_NullRequest_ThrowsException() {
792-
assertThrows(CloudRuntimeException.class,
793-
() -> unifiedSANStrategy.copyCloudStackVolume(null));
790+
void testCopyCloudStackVolume_NullRequest_DoesNotThrow() {
791+
// copyCloudStackVolume is not yet implemented (no-op), so it should not throw
792+
assertDoesNotThrow(() -> unifiedSANStrategy.copyCloudStackVolume(null));
794793
}
795794

796795
@Test
797-
void testCopyCloudStackVolume_NullLun_ThrowsException() {
796+
void testCopyCloudStackVolume_NullLun_DoesNotThrow() {
797+
// copyCloudStackVolume is not yet implemented (no-op), so it should not throw
798798
CloudStackVolume request = new CloudStackVolume();
799799
request.setLun(null);
800800

801-
assertThrows(CloudRuntimeException.class,
802-
() -> unifiedSANStrategy.copyCloudStackVolume(request));
801+
assertDoesNotThrow(() -> unifiedSANStrategy.copyCloudStackVolume(request));
803802
}
804803

805804
@Test
806-
void testCopyCloudStackVolume_FeignException_ThrowsCloudRuntimeException() {
805+
void testCopyCloudStackVolume_ValidRequest_DoesNotThrow() {
806+
// copyCloudStackVolume is not yet implemented (no-op), so it should not throw
807807
Lun lun = new Lun();
808808
lun.setName("/vol/vol1/lun1");
809809
CloudStackVolume request = new CloudStackVolume();
810810
request.setLun(lun);
811811

812-
FeignException feignException = mock(FeignException.class);
813-
when(feignException.status()).thenReturn(500);
814-
when(feignException.getMessage()).thenReturn("Internal server error");
815-
816-
try (MockedStatic<Utility> utilityMock = mockStatic(Utility.class)) {
817-
utilityMock.when(() -> Utility.generateAuthHeader("admin", "password"))
818-
.thenReturn(authHeader);
819-
820-
when(sanFeignClient.createLun(eq(authHeader), eq(true), any(Lun.class)))
821-
.thenThrow(feignException);
822-
823-
assertThrows(CloudRuntimeException.class,
824-
() -> unifiedSANStrategy.copyCloudStackVolume(request));
825-
}
812+
assertDoesNotThrow(() -> unifiedSANStrategy.copyCloudStackVolume(request));
826813
}
827814

828815
@Test

0 commit comments

Comments
 (0)