]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tasks: fix intermittent failure in TestFlush
authorJohn Spray <jspray@redhat.com>
Mon, 23 Feb 2015 13:43:13 +0000 (13:43 +0000)
committerJohn Spray <jspray@redhat.com>
Mon, 2 Mar 2015 12:53:01 +0000 (12:53 +0000)
This was an overly strict success condition: the
flush operation doesn't promise to leave you an empty
journal, it promises that anything in the journal
before the flush will be flushed.

Fixes: #10712
Signed-off-by: John Spray <john.spray@redhat.com>
tasks/mds_flush.py

index 6035cd4de858235cf95bad6c81265cd36f30feb9..458de83aefa7a504d4f5514e6c350328a70bb70b 100644 (file)
@@ -44,14 +44,42 @@ class TestFlush(CephFSTestCase):
 
         # ...and the journal is truncated to just a single subtreemap from the
         # newly created segment
-        self.assertEqual(self.fs.journal_tool(["event", "get", "summary"]),
-                         dedent(
-                             """
-                             Events by type:
-                               SUBTREEMAP: 1
-                             Errors: 0
-                             """
-                         ).strip())
+        summary_output = self.fs.journal_tool(["event", "get", "summary"])
+        try:
+            self.assertEqual(summary_output,
+                             dedent(
+                                 """
+                                 Events by type:
+                                   SUBTREEMAP: 1
+                                 Errors: 0
+                                 """
+                             ).strip())
+        except AssertionError:
+            # In some states, flushing the journal will leave you
+            # an extra event from locks a client held.   This is
+            # correct behaviour: the MDS is flushing the journal,
+            # it's just that new events are getting added too.
+            # In this case, we should nevertheless see a fully
+            # empty journal after a second flush.
+            self.assertEqual(summary_output,
+                             dedent(
+                                 """
+                                 Events by type:
+                                   SUBTREEMAP: 1
+                                   UPDATE: 1
+                                 Errors: 0
+                                 """
+                             ).strip())
+            flush_data = self.fs.mds_asok(["flush", "journal"])
+            self.assertEqual(flush_data['return_code'], 0)
+            self.assertEqual(self.fs.journal_tool(["event", "get", "summary"]),
+                             dedent(
+                                 """
+                                 Events by type:
+                                   SUBTREEMAP: 1
+                                 Errors: 0
+                                 """
+                             ).strip())
 
         # Now for deletion!
         self.mount_a.mount()