diff options
Diffstat (limited to 'src/test/java/org')
-rw-r--r-- | src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemuTest.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemuTest.java b/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemuTest.java index f8347f4..04dc118 100644 --- a/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemuTest.java +++ b/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationQemuTest.java @@ -476,4 +476,26 @@ public class VirtualizationConfigurationQemuTest assertDoesNotThrow( () -> vmConfig.validate() ); } + + @ParameterizedTest + @DisplayName( "Remove any USB redirect devices" ) + @ValueSource( strings = { "qemu-kvm_default-archlinux-vm.xml" } ) + public void testQemuMetaDataDisableUsb( String xmlFileName ) + throws VirtualizationConfigurationException, NoSuchFieldException, SecurityException, + IllegalArgumentException, IllegalAccessException + { + File file = LibvirtXmlTestResources.getLibvirtXmlFile( xmlFileName ); + VirtualizationConfigurationQemu vmConfig = new VirtualizationConfigurationQemu( null, file ); + + final Domain vmLibvirtDomainConfig = VirtualizationConfigurationQemuTest + .getPrivateDomainFromQemuMetaData( vmConfig ); + + assertEquals( vmLibvirtDomainConfig.getRedirectDevices().size(), 2 ); + + vmConfig.disableUsb(); + + assertEquals( vmLibvirtDomainConfig.getRedirectDevices().size(), 0 ); + + assertDoesNotThrow( () -> vmConfig.validate() ); + } } |