]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/tasks: add exception in do_thrash()
authorJos Collin <jcollin@redhat.com>
Tue, 16 Jul 2019 23:11:49 +0000 (04:41 +0530)
committerJos Collin <jcollin@redhat.com>
Fri, 19 Jul 2019 00:42:09 +0000 (06:12 +0530)
Fixes the bug during DaemonWatchdog testing:

Traceback (most recent call last):
  File "/home/teuthworker/src/github.com_ceph_ceph-c_wip-daemonwatchdog-testing13/qa/tasks/daemonwatchdog.py", line 38, in _run
    self.watch()
  File "/home/teuthworker/src/github.com_ceph_ceph-c_wip-daemonwatchdog-testing13/qa/tasks/daemonwatchdog.py", line 112, in watch
    if thrasher.e is not None:
AttributeError: MonitorThrasher instance has no attribute 'e'

Signed-off-by: Jos Collin <jcollin@redhat.com>
qa/tasks/mon_thrash.py

index d264e8bcf8aed803fa296304485a05ef5f4488ec..dc1866a2c6adb1213261a882ab60913cec3f4d6f 100644 (file)
@@ -89,6 +89,7 @@ class MonitorThrasher:
         self.manager = manager
         self.manager.wait_for_clean()
 
+        self.e = None
         self.stopping = False
         self.logger = logger
         self.config = config
@@ -220,6 +221,19 @@ class MonitorThrasher:
             return m
 
     def do_thrash(self):
+        """
+        _do_thrash() wrapper.
+        """
+        try:
+            self._do_thrash()
+        except Exception as e:
+            # See _run exception comment for MDSThrasher
+            self.e = e
+            self.logger.exception("exception:")
+            # Allow successful completion so gevent doesn't see an exception.
+            # The DaemonWatchdog will observe the error and tear down the test.
+
+    def _do_thrash(self):
         """
         Continuously loop and thrash the monitors.
         """