Fix wrong transport warnings in functional tests

Change-Id: Ie6726ecd566d965a94343bde7a518e986b434346
Closes-Bug: #1718691
This commit is contained in:
Rajath Agasthya 2017-09-22 17:10:29 -07:00
parent c2338ee325
commit 6efa86a8d5
2 changed files with 28 additions and 8 deletions

View File

@ -113,7 +113,7 @@ class CallTestCase(utils.SkipIfNoTransportURL):
def test_timeout(self):
transport = self.useFixture(
utils.TransportFixture(self.conf, self.url)
utils.RPCTransportFixture(self.conf, self.url)
)
target = oslo_messaging.Target(topic="no_such_topic")
c = utils.ClientStub(transport.transport, target, timeout=1)
@ -130,7 +130,7 @@ class CallTestCase(utils.SkipIfNoTransportURL):
def test_timeout_with_concurrently_queues(self):
transport = self.useFixture(
utils.TransportFixture(self.conf, self.url)
utils.RPCTransportFixture(self.conf, self.url)
)
target = oslo_messaging.Target(topic="topic_" + str(uuid.uuid4()),
server="server_" + str(uuid.uuid4()))
@ -167,7 +167,7 @@ class CallTestCase(utils.SkipIfNoTransportURL):
return echo
transport = self.useFixture(
utils.TransportFixture(self.conf, self.url)
utils.RPCTransportFixture(self.conf, self.url)
)
self.useFixture(
utils.RpcServerFixture(self.conf, self.url, target,
@ -209,7 +209,7 @@ class CallTestCase(utils.SkipIfNoTransportURL):
target = oslo_messaging.Target(topic="topic_" + str(uuid.uuid4()),
server="server_" + str(uuid.uuid4()))
transport = self.useFixture(
utils.TransportFixture(self.conf, self.url)
utils.RPCTransportFixture(self.conf, self.url)
)
self.assertRaises(TypeError,
oslo_messaging.get_rpc_server,

View File

@ -74,6 +74,24 @@ class TransportFixture(fixtures.Fixture):
time.sleep(0.5)
class RPCTransportFixture(TransportFixture):
"""Fixture defined to setup RPC transport."""
def setUp(self):
super(RPCTransportFixture, self).setUp()
self.transport = oslo_messaging.get_rpc_transport(self.conf,
url=self.url)
class NotificationTransportFixture(TransportFixture):
"""Fixture defined to setup notification transport."""
def setUp(self):
super(NotificationTransportFixture, self).setUp()
self.transport = oslo_messaging.get_notification_transport(
self.conf, url=self.url)
class RpcServerFixture(fixtures.Fixture):
"""Fixture to setup the TestServerEndpoint."""
@ -91,7 +109,7 @@ class RpcServerFixture(fixtures.Fixture):
def setUp(self):
super(RpcServerFixture, self).setUp()
endpoints = [self.endpoint, self]
transport = self.useFixture(TransportFixture(self.conf, self.url))
transport = self.useFixture(RPCTransportFixture(self.conf, self.url))
self.server = oslo_messaging.get_rpc_server(
transport=transport.transport,
target=self.target,
@ -168,7 +186,7 @@ class RpcServerGroupFixture(fixtures.Fixture):
else:
raise ValueError("Invalid value for server: %r" % server)
transport = self.useFixture(TransportFixture(self.conf, self.url))
transport = self.useFixture(RPCTransportFixture(self.conf, self.url))
client = ClientStub(transport.transport, target, cast=cast,
timeout=5)
transport.wait()
@ -345,7 +363,8 @@ class NotificationFixture(fixtures.Fixture):
targets = [oslo_messaging.Target(topic=t) for t in self.topics]
# add a special topic for internal notifications
targets.append(oslo_messaging.Target(topic=self.name))
transport = self.useFixture(TransportFixture(self.conf, self.url))
transport = self.useFixture(NotificationTransportFixture(self.conf,
self.url))
self.server = self._get_server(transport, targets)
self._ctrl = self.notifier('internal', topics=[self.name])
self._start()
@ -372,7 +391,8 @@ class NotificationFixture(fixtures.Fixture):
raise Exception("Server did not shutdown properly")
def notifier(self, publisher, topics=None):
transport = self.useFixture(TransportFixture(self.conf, self.url))
transport = self.useFixture(NotificationTransportFixture(self.conf,
self.url))
n = notifier.Notifier(transport.transport,
publisher,
driver='messaging',