From 102679a1cf80d7a2191acb3ca84c815d4622a3f1 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Fri, 8 Feb 2019 10:16:34 -0500 Subject: [PATCH] Trim fake_deserialize_context in test_conductor The assertions on the user_id and project_id in the fake_deserialize_context methods do not actually cause tests to fail if they raise MismatchError because oslo.messaging just swallows the exception and logs the traceback. With enough of these getting logged it will cause subunit parser failures in the console output because the stream is too large. This removes the fake method and just changes the stub to be a lambda that returns self.context which is what fake_deserialize_context was doing minus the project_id/user_id assertions. Change-Id: I26b201b410aa1d965dc7a6635c11c8b63b457a71 Partial-Bug: #1813147 --- nova/tests/unit/conductor/test_conductor.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/nova/tests/unit/conductor/test_conductor.py b/nova/tests/unit/conductor/test_conductor.py index e6ffe7302b..85883765a2 100644 --- a/nova/tests/unit/conductor/test_conductor.py +++ b/nova/tests/unit/conductor/test_conductor.py @@ -120,13 +120,8 @@ class _BaseTestCase(object): fake_notifier.stub_notifier(self) self.addCleanup(fake_notifier.reset) - def fake_deserialize_context(serializer, ctxt_dict): - self.assertEqual(self.context.user_id, ctxt_dict['user_id']) - self.assertEqual(self.context.project_id, ctxt_dict['project_id']) - return self.context - self.stub_out('nova.rpc.RequestContextSerializer.deserialize_context', - fake_deserialize_context) + lambda *args, **kwargs: self.context) self.useFixture(fixtures.SpawnIsSynchronousFixture()) @@ -338,13 +333,8 @@ class _BaseTaskTestCase(object): fake_server_actions.stub_out_action_events(self) self.request_spec = objects.RequestSpec() - def fake_deserialize_context(serializer, ctxt_dict): - self.assertEqual(self.context.user_id, ctxt_dict['user_id']) - self.assertEqual(self.context.project_id, ctxt_dict['project_id']) - return self.context - self.stub_out('nova.rpc.RequestContextSerializer.deserialize_context', - fake_deserialize_context) + lambda *args, **kwargs: self.context) self.useFixture(fixtures.SpawnIsSynchronousFixture()) _p = mock.patch('nova.compute.utils.heal_reqspec_is_bfv')