]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tasks: move wait_for_health up into CephFSTestCase
authorJohn Spray <john.spray@redhat.com>
Tue, 15 Dec 2015 11:40:31 +0000 (11:40 +0000)
committerJohn Spray <john.spray@redhat.com>
Thu, 3 Mar 2016 21:56:47 +0000 (21:56 +0000)
...so that TestDamage can use it too.

Signed-off-by: John Spray <john.spray@redhat.com>
tasks/cephfs/cephfs_test_case.py
tasks/cephfs/test_client_limits.py

index 3d28a930918e367927ddc29dfb53d984a9938836..ed63921a3ded00039280ee6af5dcfce9863a499f 100644 (file)
@@ -352,3 +352,20 @@ class CephFSTestCase(unittest.TestCase):
                     raise AssertionError("Expected log message not found: '{0}'".format(expected_pattern))
 
         return ContextManager()
+
+    def wait_for_health(self, pattern, timeout):
+        """
+        Wait until 'ceph health' contains a single message matching the pattern
+        """
+        def seen_health_warning():
+            health = self.fs.mon_manager.get_mon_health()
+            summary_strings = [s['summary'] for s in health['summary']]
+            if len(summary_strings) == 0:
+                log.debug("Not expected number of summary strings ({0})".format(summary_strings))
+                return False
+            elif len(summary_strings) == 1 and pattern in summary_strings[0]:
+                return True
+            else:
+                raise RuntimeError("Unexpected health messages: {0}".format(summary_strings))
+
+        self.wait_until_true(seen_health_warning, timeout)
index 9a14d0224bfb58a1aa53423943ac4a4a80f20f6b..ad96c5e29f2d84e7d42a6512dd92359c92024b7c 100644 (file)
@@ -11,7 +11,6 @@ from teuthology.orchestra.run import CommandFailedError
 from tasks.cephfs.cephfs_test_case import CephFSTestCase, needs_trimming
 from tasks.cephfs.fuse_mount import FuseMount
 import os
-import time
 
 
 log = logging.getLogger(__name__)
@@ -30,23 +29,6 @@ class TestClientLimits(CephFSTestCase):
     REQUIRE_KCLIENT_REMOTE = True
     CLIENTS_REQUIRED = 2
 
-    def wait_for_health(self, pattern, timeout):
-        """
-        Wait until 'ceph health' contains a single message matching the pattern
-        """
-        def seen_health_warning():
-            health = self.fs.mon_manager.get_mon_health()
-            summary_strings = [s['summary'] for s in health['summary']]
-            if len(summary_strings) == 0:
-                log.debug("Not expected number of summary strings ({0})".format(summary_strings))
-                return False
-            elif len(summary_strings) == 1 and pattern in summary_strings[0]:
-                return True
-            else:
-                raise RuntimeError("Unexpected health messages: {0}".format(summary_strings))
-
-        self.wait_until_true(seen_health_warning, timeout)
-
     def _test_client_pin(self, use_subdir):
         """
         When a client pins an inode in its cache, for example because the file is held open,