[PATCH 03/10] uitests: Don't fail when running on older libvirt versions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Instead of completely failing test when older libvirt is used, we can
verify the error message instead.

Signed-off-by: Povilas Kanapickas <povilas@xxxxxxxx>
---
 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


_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux