Only set oslo_messaging_notifications.driver if using RPCFixture

nova.tests.unit.test_rpc.TestRPC does not use the RPCFixture which
means the base test class setup can fail to set the test notification
driver if the oslo.messaging options, configured via the RPCFixture,
are not set, which results in:

  oslo_config.cfg.NoSuchGroupError: no such group [oslo_messaging_notifications]

This change fixes the issue by only setting that option if using
the RPCFixture.

Change-Id: I960638acd14b17ffbb8db3b1dd765b26de4e93f7
Closes-Bug: #1825535
This commit is contained in:
Matt Riedemann 2019-04-19 10:52:57 -04:00
parent b7a018f126
commit 3c5095d05f
1 changed files with 5 additions and 5 deletions

View File

@ -231,11 +231,11 @@ class TestCase(testtools.TestCase):
if self.STUB_RPC:
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')
# 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