Fix wrong transport warnings in functional tests
Change-Id: Ie6726ecd566d965a94343bde7a518e986b434346 Closes-Bug: #1718691
This commit is contained in:
parent
c2338ee325
commit
6efa86a8d5
@ -113,7 +113,7 @@ class CallTestCase(utils.SkipIfNoTransportURL):
|
|||||||
|
|
||||||
def test_timeout(self):
|
def test_timeout(self):
|
||||||
transport = self.useFixture(
|
transport = self.useFixture(
|
||||||
utils.TransportFixture(self.conf, self.url)
|
utils.RPCTransportFixture(self.conf, self.url)
|
||||||
)
|
)
|
||||||
target = oslo_messaging.Target(topic="no_such_topic")
|
target = oslo_messaging.Target(topic="no_such_topic")
|
||||||
c = utils.ClientStub(transport.transport, target, timeout=1)
|
c = utils.ClientStub(transport.transport, target, timeout=1)
|
||||||
@ -130,7 +130,7 @@ class CallTestCase(utils.SkipIfNoTransportURL):
|
|||||||
|
|
||||||
def test_timeout_with_concurrently_queues(self):
|
def test_timeout_with_concurrently_queues(self):
|
||||||
transport = self.useFixture(
|
transport = self.useFixture(
|
||||||
utils.TransportFixture(self.conf, self.url)
|
utils.RPCTransportFixture(self.conf, self.url)
|
||||||
)
|
)
|
||||||
target = oslo_messaging.Target(topic="topic_" + str(uuid.uuid4()),
|
target = oslo_messaging.Target(topic="topic_" + str(uuid.uuid4()),
|
||||||
server="server_" + str(uuid.uuid4()))
|
server="server_" + str(uuid.uuid4()))
|
||||||
@ -167,7 +167,7 @@ class CallTestCase(utils.SkipIfNoTransportURL):
|
|||||||
return echo
|
return echo
|
||||||
|
|
||||||
transport = self.useFixture(
|
transport = self.useFixture(
|
||||||
utils.TransportFixture(self.conf, self.url)
|
utils.RPCTransportFixture(self.conf, self.url)
|
||||||
)
|
)
|
||||||
self.useFixture(
|
self.useFixture(
|
||||||
utils.RpcServerFixture(self.conf, self.url, target,
|
utils.RpcServerFixture(self.conf, self.url, target,
|
||||||
@ -209,7 +209,7 @@ class CallTestCase(utils.SkipIfNoTransportURL):
|
|||||||
target = oslo_messaging.Target(topic="topic_" + str(uuid.uuid4()),
|
target = oslo_messaging.Target(topic="topic_" + str(uuid.uuid4()),
|
||||||
server="server_" + str(uuid.uuid4()))
|
server="server_" + str(uuid.uuid4()))
|
||||||
transport = self.useFixture(
|
transport = self.useFixture(
|
||||||
utils.TransportFixture(self.conf, self.url)
|
utils.RPCTransportFixture(self.conf, self.url)
|
||||||
)
|
)
|
||||||
self.assertRaises(TypeError,
|
self.assertRaises(TypeError,
|
||||||
oslo_messaging.get_rpc_server,
|
oslo_messaging.get_rpc_server,
|
||||||
|
@ -74,6 +74,24 @@ class TransportFixture(fixtures.Fixture):
|
|||||||
time.sleep(0.5)
|
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):
|
class RpcServerFixture(fixtures.Fixture):
|
||||||
"""Fixture to setup the TestServerEndpoint."""
|
"""Fixture to setup the TestServerEndpoint."""
|
||||||
|
|
||||||
@ -91,7 +109,7 @@ class RpcServerFixture(fixtures.Fixture):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(RpcServerFixture, self).setUp()
|
super(RpcServerFixture, self).setUp()
|
||||||
endpoints = [self.endpoint, self]
|
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(
|
self.server = oslo_messaging.get_rpc_server(
|
||||||
transport=transport.transport,
|
transport=transport.transport,
|
||||||
target=self.target,
|
target=self.target,
|
||||||
@ -168,7 +186,7 @@ class RpcServerGroupFixture(fixtures.Fixture):
|
|||||||
else:
|
else:
|
||||||
raise ValueError("Invalid value for server: %r" % server)
|
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,
|
client = ClientStub(transport.transport, target, cast=cast,
|
||||||
timeout=5)
|
timeout=5)
|
||||||
transport.wait()
|
transport.wait()
|
||||||
@ -345,7 +363,8 @@ class NotificationFixture(fixtures.Fixture):
|
|||||||
targets = [oslo_messaging.Target(topic=t) for t in self.topics]
|
targets = [oslo_messaging.Target(topic=t) for t in self.topics]
|
||||||
# add a special topic for internal notifications
|
# add a special topic for internal notifications
|
||||||
targets.append(oslo_messaging.Target(topic=self.name))
|
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.server = self._get_server(transport, targets)
|
||||||
self._ctrl = self.notifier('internal', topics=[self.name])
|
self._ctrl = self.notifier('internal', topics=[self.name])
|
||||||
self._start()
|
self._start()
|
||||||
@ -372,7 +391,8 @@ class NotificationFixture(fixtures.Fixture):
|
|||||||
raise Exception("Server did not shutdown properly")
|
raise Exception("Server did not shutdown properly")
|
||||||
|
|
||||||
def notifier(self, publisher, topics=None):
|
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,
|
n = notifier.Notifier(transport.transport,
|
||||||
publisher,
|
publisher,
|
||||||
driver='messaging',
|
driver='messaging',
|
||||||
|
Loading…
Reference in New Issue
Block a user