Short circuit notifications when not enabled

Wasting time on generating the payload of the notifications is
unnecessary if the notification will not be emitted due to
configuration.

This patch depends on an oslo messaging improvement that adds
a way to check if a Notifier will emit the notification or not.

Depends-On: Ib992f5c20fef85224fb00823e1d8d9c6cff19bec
Depends-On: I979fb3385671aba6f4162ef991da8f0febe0068a

Change-Id: I3e6741d59df49e1e58409314008c2ed609fdedc1
This commit is contained in:
Balazs Gibizer 2017-02-02 17:49:58 +01:00 committed by melanie witt
parent 512d980f6f
commit 90271b2dea

View File

@ -223,6 +223,12 @@ class TestCase(testtools.TestCase):
self.useFixture(conf_fixture.ConfFixture(CONF))
self.useFixture(nova_fixtures.RPCFixture('nova.test'))
# we cannot set this in the ConfFixture as oslo only registers the
# notification opts at the first instantiation of a Notifier that
# happens only in the RPCFixture
CONF.set_default('driver', ['test'],
group='oslo_messaging_notifications')
# NOTE(danms): Make sure to reset us back to non-remote objects
# for each test to avoid interactions. Also, backup the object
# registry.