Merge "Make TestRPC inherit from the base nova TestCase" into stable/pike

This commit is contained in:
Zuul 2017-12-13 04:30:58 +00:00 committed by Gerrit Code Review
commit c236fe5853
2 changed files with 11 additions and 5 deletions

View File

@ -209,6 +209,9 @@ class TestCase(testtools.TestCase):
USES_DB_SELF = False
REQUIRES_LOCKING = False
# Setting to True makes the test use the RPCFixture.
STUB_RPC = True
# The number of non-cell0 cells to create. This is only used in the
# base class when USES_DB is True.
NUMBER_OF_CELLS = 1
@ -250,7 +253,9 @@ class TestCase(testtools.TestCase):
group='oslo_concurrency')
self.useFixture(conf_fixture.ConfFixture(CONF))
self.useFixture(nova_fixtures.RPCFixture('nova.test'))
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

View File

@ -18,7 +18,6 @@ import mock
import oslo_messaging as messaging
from oslo_messaging.rpc import dispatcher
from oslo_serialization import jsonutils
import testtools
from nova import context
from nova import rpc
@ -45,9 +44,11 @@ class RPCResetFixture(fixtures.Fixture):
rpc.CONF = self.conf
# We can't import nova.test.TestCase because that sets up an RPCFixture
# that pretty much nullifies all of this testing
class TestRPC(testtools.TestCase):
class TestRPC(test.NoDBTestCase):
# We're testing the rpc code so we can't use the RPCFixture.
STUB_RPC = False
def setUp(self):
super(TestRPC, self).setUp()
self.useFixture(RPCResetFixture())