Fix pika functional tests
Change-Id: I05f2cbd914857da7a75ca068e99614156797d1ed Closes-Bug: #1599777 Depends-On: Ic6acc5d006344e08c219724e488fc9222786d849
This commit is contained in:
parent
94c958ca86
commit
d946fb1862
@ -34,11 +34,15 @@ class ConnectedPortMatcher(object):
|
|||||||
|
|
||||||
|
|
||||||
class RabbitMQFailoverTests(test_utils.BaseTestCase):
|
class RabbitMQFailoverTests(test_utils.BaseTestCase):
|
||||||
|
DRIVERS = [
|
||||||
|
"rabbit",
|
||||||
|
]
|
||||||
|
|
||||||
def test_failover_scenario(self):
|
def test_failover_scenario(self):
|
||||||
# NOTE(sileht): run this test only if functionnal suite run of a driver
|
# NOTE(sileht): run this test only if functional suite run of a driver
|
||||||
# that use rabbitmq as backend
|
# that use rabbitmq as backend
|
||||||
self.driver = os.environ.get('TRANSPORT_DRIVER')
|
self.driver = os.environ.get('TRANSPORT_DRIVER')
|
||||||
if self.driver not in ["pika", "rabbit"]:
|
if self.driver not in self.DRIVERS:
|
||||||
self.skipTest("TRANSPORT_DRIVER is not set to a rabbit driver")
|
self.skipTest("TRANSPORT_DRIVER is not set to a rabbit driver")
|
||||||
|
|
||||||
# NOTE(sileht): Allow only one response at a time, to
|
# NOTE(sileht): Allow only one response at a time, to
|
||||||
@ -51,7 +55,6 @@ class RabbitMQFailoverTests(test_utils.BaseTestCase):
|
|||||||
rabbit_retry_backoff=0,
|
rabbit_retry_backoff=0,
|
||||||
group='oslo_messaging_rabbit')
|
group='oslo_messaging_rabbit')
|
||||||
|
|
||||||
#
|
|
||||||
self.pifpaf = self.useFixture(rabbitmq.RabbitMQDriver(cluster=True,
|
self.pifpaf = self.useFixture(rabbitmq.RabbitMQDriver(cluster=True,
|
||||||
port=5692))
|
port=5692))
|
||||||
|
|
||||||
@ -60,6 +63,10 @@ class RabbitMQFailoverTests(test_utils.BaseTestCase):
|
|||||||
self.n2 = self.pifpaf.env["PIFPAF_RABBITMQ_NODENAME2"]
|
self.n2 = self.pifpaf.env["PIFPAF_RABBITMQ_NODENAME2"]
|
||||||
self.n3 = self.pifpaf.env["PIFPAF_RABBITMQ_NODENAME3"]
|
self.n3 = self.pifpaf.env["PIFPAF_RABBITMQ_NODENAME3"]
|
||||||
|
|
||||||
|
# NOTE(gdavoian): additional tweak for pika driver
|
||||||
|
if self.driver == "pika":
|
||||||
|
self.url = self.url.replace("rabbit", "pika")
|
||||||
|
|
||||||
# ensure connections will be establish to the first node
|
# ensure connections will be establish to the first node
|
||||||
self.pifpaf.stop_node(self.n2)
|
self.pifpaf.stop_node(self.n2)
|
||||||
self.pifpaf.stop_node(self.n3)
|
self.pifpaf.stop_node(self.n3)
|
||||||
@ -118,7 +125,7 @@ class RabbitMQFailoverTests(test_utils.BaseTestCase):
|
|||||||
rpc_server = self.servers.servers[0].server
|
rpc_server = self.servers.servers[0].server
|
||||||
# FIXME(sileht): Check other connections
|
# FIXME(sileht): Check other connections
|
||||||
connections = [
|
connections = [
|
||||||
rpc_server.listener._poll_style_listener._connection
|
rpc_server.listener._connection
|
||||||
]
|
]
|
||||||
for conn in connections:
|
for conn in connections:
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
@ -39,6 +39,9 @@ class BaseTestCase(base.BaseTestCase):
|
|||||||
self.messaging_conf.transport_driver = 'fake'
|
self.messaging_conf.transport_driver = 'fake'
|
||||||
self.conf = self.messaging_conf.conf
|
self.conf = self.messaging_conf.conf
|
||||||
|
|
||||||
|
self.conf.project = 'project'
|
||||||
|
self.conf.prog = 'prog'
|
||||||
|
|
||||||
moxfixture = self.useFixture(moxstubout.MoxStubout())
|
moxfixture = self.useFixture(moxstubout.MoxStubout())
|
||||||
self.mox = moxfixture.mox
|
self.mox = moxfixture.mox
|
||||||
self.stubs = moxfixture.stubs
|
self.stubs = moxfixture.stubs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user