[virt-tools-list] [PATCH 03/10] uitests: Don't fail when running on older libvirt versions
Povilas Kanapickas
povilas at radix.lt
Sat Sep 1 22:21:27 UTC 2018
Instead of completely failing test when older libvirt is used, we can
verify the error message instead.
Signed-off-by: Povilas Kanapickas <povilas at radix.lt>
---
tests/uitests/addhardware.py | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/tests/uitests/addhardware.py b/tests/uitests/addhardware.py
index ae5e1153..541752bf 100644
--- a/tests/uitests/addhardware.py
+++ b/tests/uitests/addhardware.py
@@ -27,6 +27,19 @@ class AddHardware(uiutils.UITestCase):
uiutils.check_in_loop(lambda: tab.showing)
return tab
+ def _cancel_hw_change_if_config_unsupported(self, addhw_window, alert_msg):
+ try:
+ alert = self.app.root.find("vmm dialog", "alert")
+ except Exception:
+ return # no alert, ignore
+
+ # Verify that the found alert is the actual alert we expected
+ alert.find_fuzzy("Error adding device", "label")
+ alert.find_fuzzy(alert_msg, "label")
+ alert.find("Close", "push button").click()
+ uiutils.check_in_loop(lambda: alert.dead)
+
+ addhw_window.find("Cancel", "push button").click()
##############
# Test cases #
@@ -533,6 +546,8 @@ class AddHardware(uiutils.UITestCase):
tab.find("Passthrough", "menu item").click()
tab.find("Device Path:", "text").text = "/tmp/foo"
finish.click()
+ self._cancel_hw_change_if_config_unsupported(addhw,
+ 'Unknown TPM frontend model') # TPM supported since libvirt 4.5
uiutils.check_in_loop(lambda: details.active)
# Add RNG
--
2.17.1
More information about the virt-tools-list
mailing list