From: Patrick Donnelly Date: Thu, 6 Aug 2020 17:53:58 +0000 (-0700) Subject: qa: add exception for test timeouts X-Git-Tag: v14.2.11~2^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7d09c5a6fe0ae93684d7234cb9d5fc79816c64e7;p=ceph.git qa: add exception for test timeouts 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 (cherry picked from commit dbc44e5e342605c16e1213120bec0bfec1c0091d) --- diff --git a/qa/tasks/ceph_test_case.py b/qa/tasks/ceph_test_case.py index a1ce69549642a..9e26439edf423 100644 --- a/qa/tasks/ceph_test_case.py +++ b/qa/tasks/ceph_test_case.py @@ -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)