From 7d09c5a6fe0ae93684d7234cb9d5fc79816c64e7 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Thu, 6 Aug 2020 10:53:58 -0700 Subject: [PATCH] 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) --- qa/tasks/ceph_test_case.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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) -- 2.39.5