From d20d9238cd59bca002d682cbcdc444e15e856de1 Mon Sep 17 00:00:00 2001 From: John Spray Date: Mon, 23 Feb 2015 13:43:13 +0000 Subject: [PATCH] tasks: fix intermittent failure in TestFlush 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 --- tasks/mds_flush.py | 44 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/tasks/mds_flush.py b/tasks/mds_flush.py index 6035cd4de858..458de83aefa7 100644 --- a/tasks/mds_flush.py +++ b/tasks/mds_flush.py @@ -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() -- 2.47.3