Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix HeuristicRuleHelper tests
  • Loading branch information
winterhazel committed Jan 25, 2026
commit 6c819d0c141d167766e00e953a25c1d6cc6d9f06
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
// under the License.
package org.apache.cloudstack.storage.heuristics;

import com.cloud.hypervisor.Hypervisor;
import com.cloud.storage.Storage;
import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.VolumeVO;
import com.cloud.utils.exception.CloudRuntimeException;
Expand All @@ -29,6 +31,7 @@
import org.apache.cloudstack.utils.jsinterpreter.JsInterpreter;
import org.apache.logging.log4j.Logger;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
Expand Down Expand Up @@ -68,6 +71,19 @@ public class HeuristicRuleHelperTest {
@InjectMocks
HeuristicRuleHelper heuristicRuleHelperSpy = new HeuristicRuleHelper();

@Before
public void setUp() {
Mockito.doReturn("template-name").when(vmTemplateVOMock).getName();
Mockito.doReturn(Storage.ImageFormat.QCOW2).when(vmTemplateVOMock).getFormat();
Mockito.doReturn(Hypervisor.HypervisorType.KVM).when(vmTemplateVOMock).getHypervisorType();
Mockito.doReturn("snapshot-name").when(snapshotInfoMock).getName();
Mockito.doReturn(1024L).when(snapshotInfoMock).getSize();
Mockito.doReturn(Hypervisor.HypervisorType.VMware).when(snapshotInfoMock).getHypervisorType();
Mockito.doReturn("volume-name").when(volumeVOMock).getName();
Mockito.doReturn(Storage.ImageFormat.RAW).when(volumeVOMock).getFormat();
Mockito.doReturn(2048L).when(volumeVOMock).getSize();
}

@Test
public void getImageStoreIfThereIsHeuristicRuleTestZoneDoesNotHaveHeuristicRuleShouldReturnNull() {
Long zoneId = 1L;
Expand Down
Loading