|
37 | 37 | import java.util.Collections; |
38 | 38 | import java.util.List; |
39 | 39 |
|
| 40 | +import org.apache.cloudstack.backup.InternalBackupService; |
40 | 41 | import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory; |
41 | 42 | import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; |
42 | 43 | import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; |
@@ -121,6 +122,7 @@ public void setup() { |
121 | 122 | strategy.vmInstanceDetailsDao = mock(VMInstanceDetailsDao.class); |
122 | 123 | strategy.hostDetailsDao = hostDetailsDao; |
123 | 124 | strategy.alertManager = mock(AlertManager.class); |
| 125 | + strategy.internalBackupService = mock(InternalBackupService.class); |
124 | 126 | doNothing().when(strategy).publishUsageEvent(anyString(), any(VMSnapshot.class), any(UserVm.class), anyLong(), anyLong()); |
125 | 127 | doNothing().when(strategy).publishUsageEvent(anyString(), any(VMSnapshot.class), any(UserVm.class), any(VolumeObjectTO.class)); |
126 | 128 | } |
@@ -343,12 +345,10 @@ public void testGetPrimaryDataStoreForNvramCleanupPrefersRootSnapshotPrimaryData |
343 | 345 | SnapshotInfo rootSnapshotInfo = mock(SnapshotInfo.class); |
344 | 346 | SnapshotObjectTO rootSnapshotObjectTo = mock(SnapshotObjectTO.class); |
345 | 347 | VolumeObjectTO rootSnapshotVolume = mock(VolumeObjectTO.class); |
346 | | - VMSnapshotDetailsVO volumeSnapshotDetail = new VMSnapshotDetailsVO(vmSnapshotId, "kvmFileBasedStorageSnapshot", String.valueOf(rootSnapshotId), true); |
347 | 348 |
|
348 | 349 | when(vmSnapshot.getId()).thenReturn(vmSnapshotId); |
349 | 350 | when(vmSnapshot.getUuid()).thenReturn("vm-snapshot"); |
350 | | - when(vmSnapshotDetailsDao.findDetails(vmSnapshotId, "kvmFileBasedStorageSnapshot")).thenReturn(List.of(volumeSnapshotDetail)); |
351 | | - when(snapshotDataStoreDao.findOneBySnapshotAndDatastoreRole(rootSnapshotId, DataStoreRole.Primary)).thenReturn(rootSnapshotDataStore); |
| 351 | + when(vmSnapshotHelper.getVolumeSnapshotsAssociatedWithKvmDiskOnlyVmSnapshot(vmSnapshotId)).thenReturn(List.of(rootSnapshotDataStore)); |
352 | 352 | when(rootSnapshotDataStore.getSnapshotId()).thenReturn(rootSnapshotId); |
353 | 353 | when(rootSnapshotDataStore.getDataStoreId()).thenReturn(dataStoreId); |
354 | 354 | when(strategy.snapshotDataFactory.getSnapshot(rootSnapshotId, dataStoreId, DataStoreRole.Primary)).thenReturn(rootSnapshotInfo); |
|
0 commit comments