]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: add exception for test timeouts
authorPatrick Donnelly <pdonnell@redhat.com>
Thu, 6 Aug 2020 17:53:58 +0000 (10:53 -0700)
committerPatrick Donnelly <pdonnell@redhat.com>
Fri, 7 Aug 2020 05:15:12 +0000 (22:15 -0700)
To make this easier to catch. It is still a RuntimeError so it should
not affect current tests by default.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit dbc44e5e342605c16e1213120bec0bfec1c0091d)

qa/tasks/ceph_test_case.py

index a1ce69549642a330e58ba911dc037d165a9b307e..9e26439edf4239911e1b303f54982600e35c3e90 100644 (file)
@@ -7,6 +7,8 @@ from teuthology.orchestra.run import CommandFailedError
 
 log = logging.getLogger(__name__)
 
+class TestTimeoutError(RuntimeError):
+    pass
 
 class CephTestCase(unittest.TestCase):
     """
@@ -173,7 +175,7 @@ class CephTestCase(unittest.TestCase):
                 raise RuntimeError("wait_until_equal: forbidden value {0} seen".format(val))
             else:
                 if elapsed >= timeout:
-                    raise RuntimeError("Timed out after {0} seconds waiting for {1} (currently {2})".format(
+                    raise TestTimeoutError("Timed out after {0} seconds waiting for {1} (currently {2})".format(
                         elapsed, expect_val, val
                     ))
                 else:
@@ -192,7 +194,7 @@ class CephTestCase(unittest.TestCase):
                 return
             else:
                 if elapsed >= timeout:
-                    raise RuntimeError("Timed out after {0}s".format(elapsed))
+                    raise TestTimeoutError("Timed out after {0}s".format(elapsed))
                 else:
                     log.debug("wait_until_true: waiting...")
                 time.sleep(period)