Make TestRPC inherit from the base nova TestCase
By not inheriting from the base nova test case, we
lose things like timeouts.
This makes the TestRPC test class inherit from the
base test case and still avoid using the RPCFixture.
Change-Id: Id65e15a57175bbdd9c84851b1b6716e6a1f2cfb8
Related-Bug: #1685333
(cherry picked from commit 0534872abb
)
This commit is contained in:
parent
e162f6c7ab
commit
d873550d3c
|
@ -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
|
||||
|
|
|
@ -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())
|
||||
|
|
Loading…
Reference in New Issue