File tree Expand file tree Collapse file tree
plugins/storage/volume/ontap/src
main/java/org/apache/cloudstack/storage/service
test/java/org/apache/cloudstack/storage/service Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919
2020package org .apache .cloudstack .storage .service ;
2121
22- import java .util .ArrayList ;
2322import java .util .HashMap ;
2423import java .util .List ;
2524import java .util .Map ;
Original file line number Diff line number Diff line change @@ -643,6 +643,25 @@ public void testDeleteStorageVolume_feignException() {
643643 assertTrue (ex .getMessage ().contains ("Failed to delete volume" ));
644644 }
645645
646+ @ Test
647+ public void testDeleteStorageVolume_notFound_404_returnsWithoutThrowing () {
648+ // Setup
649+ Volume volume = new Volume ();
650+ volume .setName ("test-volume" );
651+ volume .setUuid ("vol-uuid-1" );
652+
653+ FeignException feignEx = mock (FeignException .class );
654+ when (feignEx .status ()).thenReturn (404 );
655+ when (volumeFeignClient .deleteVolume (anyString (), eq ("vol-uuid-1" )))
656+ .thenThrow (feignEx );
657+
658+ // Execute - 404 means volume already gone on ONTAP, treated as no-op
659+ storageStrategy .deleteStorageVolume (volume );
660+
661+ // Verify the delete was attempted
662+ verify (volumeFeignClient ).deleteVolume (anyString (), eq ("vol-uuid-1" ));
663+ }
664+
646665 // ========== getStoragePath() Tests ==========
647666
648667 @ Test
You can’t perform that action at this time.
0 commit comments