uitests: handle newer libvirt test driver UpdateDevice support

Make it fail for the cases that expect it

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2024-08-07 14:24:33 -04:00
parent 2e1bacfd33
commit a00c090022
4 changed files with 8 additions and 1 deletions

View File

@ -674,6 +674,7 @@ def testDetailsMiscEdits(app):
Test misc editing behavior, like checking for unapplied
changes
"""
app.open(extra_opts=["--test-options=test-update-device-fail"])
win = app.manager_open_details("test-many-devices")
hwlist = win.find("hw-list")

View File

@ -86,7 +86,8 @@ def testMediaHotplug(app):
Test in the case of a running VM
"""
vmname = "test-many-devices"
app.open(show_console=vmname)
app.open(show_console=vmname,
extra_opts=["--test-options=test-update-device-fail"])
win = app.find_details_window(vmname, click_details=True)
hw = win.find("hw-list")
entry = win.find("media-entry")

View File

@ -163,6 +163,7 @@ class CLITestOptionsClass:
managed save issues
* test-vm-run-fail: Make VM run fail, so we can test the error path
* test-update-device-fail: Make UpdateDevice API call fail
* spice-agent: Make spice-agent detection return true in viewer.py
@ -219,6 +220,7 @@ class CLITestOptionsClass:
self.enable_libguestfs = _get("enable-libguestfs")
self.test_managed_save = _get("test-managed-save")
self.test_vm_run_fail = _get("test-vm-run-fail")
self.test_update_device_fail = _get("test-update-device-fail")
self.spice_agent = _get("spice-agent")
self.firstrun_uri = _get_value("firstrun-uri")
self.fake_vnc_username = _get("fake-vnc-username")

View File

@ -1083,6 +1083,9 @@ class vmmDomain(vmmLibvirtObject):
xml = devobj.get_xml()
log.debug("update_device with xml=\n%s", xml)
if self.config.CLITestOptions.test_update_device_fail:
raise RuntimeError("fake update device failure")
self._backend.updateDeviceFlags(xml, flags)
def hotplug(self, memory=_SENTINEL, maxmem=_SENTINEL,