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
This commit is contained in:
Matt Riedemann 2019-02-08 10:16:34 -05:00 committed by Balazs Gibizer
parent 6b844af57e
commit 102679a1cf
1 changed files with 2 additions and 12 deletions

View File

@ -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')