@Test public void refuseSoundDeviceOnPPC() { AddVmCommand<AddVmParameters> cmd = setupCanAddPpcTest(); cmd.getParameters().setSoundDeviceEnabled(true); when(osRepository.isSoundDeviceEnabled( cmd.getParameters().getVm().getVmOsId(), cmd.getCluster().getCompatibilityVersion())) .thenReturn(false); ValidateTestUtils.runAndAssertValidateFailure( cmd, EngineMessage.SOUND_DEVICE_REQUESTED_ON_NOT_SUPPORTED_ARCH); }
@Test public void isVirtioScsiEnabledDefaultedToTrue() { AddVmCommand<AddVmParameters> cmd = setupCanAddVmTests(0); Cluster cluster = createCluster(); doReturn(cluster).when(cmd).getCluster(); cmd.getParameters().getVm().setClusterId(cluster.getId()); cmd.initEffectiveCompatibilityVersion(); when(osRepository.getDiskInterfaces(any(Integer.class), any(Version.class))) .thenReturn(new ArrayList<>(Collections.singletonList("VirtIO_SCSI"))); assertTrue( "isVirtioScsiEnabled hasn't been defaulted to true on cluster >= 3.3.", cmd.isVirtioScsiEnabled()); }
private AddVmCommand<AddVmParameters> setupCanAddPpcTest() { final int domainSizeGB = 20; AddVmCommand<AddVmParameters> cmd = setupCanAddVmTests(domainSizeGB); doReturn(true).when(cmd).validateSpaceRequirements(); doReturn(true).when(cmd).buildAndCheckDestStorageDomains(); cmd.getParameters().getVm().setClusterArch(ArchitectureType.ppc64); Cluster cluster = new Cluster(); cluster.setArchitecture(ArchitectureType.ppc64); cluster.setCompatibilityVersion(Version.getLast()); doReturn(cluster).when(cmd).getCluster(); return cmd; }
@Test public void testPatternBasedNameFails() { AddVmCommand<AddVmParameters> cmd = createCommand(initializeMock(1)); cmd.getParameters().getVm().setName("aa-??bb"); assertFalse("Pattern-based name should not be supported for VM", cmd.validateInputs()); }