Skip to content

Commit f2f2c7b

Browse files
unit test fix
1 parent 57126b7 commit f2f2c7b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

engine/storage/snapshot/src/test/java/org/apache/cloudstack/storage/vmsnapshot/VMSnapshotStrategyKVMTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotStrategy;
3838
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotStrategy.SnapshotOperation;
3939
import org.apache.cloudstack.engine.subsystem.api.storage.StorageStrategyFactory;
40+
import org.apache.cloudstack.engine.subsystem.api.storage.VMSnapshotOptions;
4041
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
4142
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
4243
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
@@ -151,7 +152,7 @@ public void setUp() throws Exception {
151152

152153
@Test
153154
public void testCreateDiskSnapshotBasedOnStrategy() throws Exception {
154-
VMSnapshot vmSnapshot = Mockito.mock(VMSnapshot.class);
155+
VMSnapshotVO vmSnapshot = Mockito.mock(VMSnapshotVO.class);
155156
List<SnapshotInfo> forRollback = new ArrayList<>();
156157
VolumeInfo vol = Mockito.mock(VolumeInfo.class);
157158
SnapshotInfo snapshotInfo = Mockito.mock(SnapshotInfo.class);
@@ -162,6 +163,7 @@ public void testCreateDiskSnapshotBasedOnStrategy() throws Exception {
162163
SnapshotVO snapshot = new SnapshotVO(vol.getDataCenterId(), vol.getAccountId(), vol.getDomainId(),
163164
vol.getId(),vol.getDiskOfferingId(), vmUuid + "_" + volUuid,(short) SnapshotVO.MANUAL_POLICY_ID,
164165
"MANUAL",vol.getSize(),vol.getMinIops(),vol.getMaxIops(), Hypervisor.HypervisorType.KVM, null);
166+
when(vmSnapshot.getOptions()).thenReturn(new VMSnapshotOptions(true));
165167
when(vmSnapshot.getUuid()).thenReturn(vmUuid);
166168
when(vol.getUuid()).thenReturn(volUuid);
167169
when(_snapshotDao.persist(any())).thenReturn(snapshot);

0 commit comments

Comments
 (0)