Merge "Fix pika functional tests"

This commit is contained in:
Jenkins 2016-08-01 12:50:53 +00:00 committed by Gerrit Code Review
commit 3a87803db9
2 changed files with 14 additions and 4 deletions

View File

@ -34,11 +34,15 @@ class ConnectedPortMatcher(object):
class RabbitMQFailoverTests(test_utils.BaseTestCase):
DRIVERS = [
"rabbit",
]
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
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")
# NOTE(sileht): Allow only one response at a time, to
@ -51,7 +55,6 @@ class RabbitMQFailoverTests(test_utils.BaseTestCase):
rabbit_retry_backoff=0,
group='oslo_messaging_rabbit')
# 
self.pifpaf = self.useFixture(rabbitmq.RabbitMQDriver(cluster=True,
port=5692))
@ -60,6 +63,10 @@ class RabbitMQFailoverTests(test_utils.BaseTestCase):
self.n2 = self.pifpaf.env["PIFPAF_RABBITMQ_NODENAME2"]
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
self.pifpaf.stop_node(self.n2)
self.pifpaf.stop_node(self.n3)
@ -118,7 +125,7 @@ class RabbitMQFailoverTests(test_utils.BaseTestCase):
rpc_server = self.servers.servers[0].server
# FIXME(sileht): Check other connections
connections = [
rpc_server.listener._poll_style_listener._connection
rpc_server.listener._connection
]
for conn in connections:
self.assertEqual(

View File

@ -39,6 +39,9 @@ class BaseTestCase(base.BaseTestCase):
self.messaging_conf.transport_driver = 'fake'
self.conf = self.messaging_conf.conf
self.conf.project = 'project'
self.conf.prog = 'prog'
moxfixture = self.useFixture(moxstubout.MoxStubout())
self.mox = moxfixture.mox
self.stubs = moxfixture.stubs