From 90271b2dea1688d06474acfbe97dc6d32406595b Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Thu, 2 Feb 2017 17:49:58 +0100 Subject: [PATCH] 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 --- nova/test.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nova/test.py b/nova/test.py index c8050e30d..dc71ccae1 100644 --- a/nova/test.py +++ b/nova/test.py @@ -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.