uitests: Add connection tick failure testing

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson
2020-09-02 12:54:53 -04:00
parent 14232e1aa7
commit 306c6be12f
2 changed files with 15 additions and 0 deletions

View File

@@ -38,3 +38,12 @@ class UITestConnection(uiutils.UITestCase):
self.sleep(.5)
uiutils.check(
lambda: "test-many-devices" not in self.app.topwin.fmt_nodes())
def testConnectionConnCrash(self):
self.app.open(
extra_opts=["--test-options=conn-crash"])
manager = self.app.topwin
self.sleep(1)
manager.find(r"^test testdriver.xml - Not Connected", "table cell")
uiutils.check(lambda: manager.active)

View File

@@ -1205,6 +1205,12 @@ class vmmConnection(vmmGObject):
elif obj.is_nodedev() and not pollnodedev:
continue
if self.config.CLITestOptions.conn_crash:
self._backend.close()
e = libvirt.libvirtError("fake error")
e.err = [libvirt.VIR_ERR_SYSTEM_ERROR]
raise e
obj.tick(stats_update=stats_update)
except Exception as e:
log.exception("Tick for %s failed", obj)