diff --git a/oslo_messaging/_drivers/impl_rabbit.py b/oslo_messaging/_drivers/impl_rabbit.py index 2f3fb7146..73a2c80ea 100644 --- a/oslo_messaging/_drivers/impl_rabbit.py +++ b/oslo_messaging/_drivers/impl_rabbit.py @@ -136,7 +136,7 @@ rabbit_opts = [ 'If you change this option, you must wipe the ' 'RabbitMQ database.'), cfg.IntOpt('heartbeat_timeout_threshold', - default=0, + default=60, help="Number of seconds after which the Rabbit broker is " "considered down if heartbeat's keep-alive fails " "(0 disable the heartbeat). EXPERIMENTAL"), diff --git a/oslo_messaging/tests/drivers/test_impl_rabbit.py b/oslo_messaging/tests/drivers/test_impl_rabbit.py index 8add8193e..c432c5890 100644 --- a/oslo_messaging/tests/drivers/test_impl_rabbit.py +++ b/oslo_messaging/tests/drivers/test_impl_rabbit.py @@ -58,12 +58,6 @@ class TestDeprecatedRabbitDriverLoad(test_utils.BaseTestCase): class TestHeartbeat(test_utils.BaseTestCase): - def setUp(self): - super(TestHeartbeat, self).setUp( - conf=cfg.ConfigOpts()) - self.config(heartbeat_timeout_threshold=60, - group='oslo_messaging_rabbit') - @mock.patch('oslo_messaging._drivers.impl_rabbit.LOG') @mock.patch('kombu.connection.Connection.heartbeat_check') @mock.patch('oslo_messaging._drivers.impl_rabbit.Connection.' @@ -128,7 +122,7 @@ class TestRabbitDriverLoad(test_utils.BaseTestCase): @mock.patch('oslo_messaging._drivers.impl_rabbit.Connection.ensure') @mock.patch('oslo_messaging._drivers.impl_rabbit.Connection.reset') def test_driver_load(self, fake_ensure, fake_reset): - self.config(heartbeat_timeout_threshold=0, + self.config(heartbeat_timeout_threshold=60, group='oslo_messaging_rabbit') self.messaging_conf.transport_driver = self.transport_driver transport = oslo_messaging.get_transport(self.conf) @@ -173,7 +167,7 @@ class TestRabbitDriverLoadSSL(test_utils.BaseTestCase): 'on_blocked': mock.ANY, 'on_unblocked': mock.ANY}, ssl=self.expected, login_method='AMQPLAIN', - heartbeat=0, failover_strategy="shuffle") + heartbeat=60, failover_strategy="shuffle") class TestRabbitPublisher(test_utils.BaseTestCase): diff --git a/oslo_messaging/tests/functional/test_functional.py b/oslo_messaging/tests/functional/test_functional.py index 32cc0190c..c381e5bd9 100644 --- a/oslo_messaging/tests/functional/test_functional.py +++ b/oslo_messaging/tests/functional/test_functional.py @@ -15,6 +15,7 @@ import time import uuid import concurrent.futures +from oslo_config import cfg from testtools import matchers import oslo_messaging @@ -22,6 +23,13 @@ from oslo_messaging.tests.functional import utils class CallTestCase(utils.SkipIfNoTransportURL): + + def setUp(self): + super(CallTestCase, self).setUp(conf=cfg.ConfigOpts()) + + self.config(heartbeat_timeout_threshold=0, + group='oslo_messaging_rabbit') + def test_specific_server(self): group = self.useFixture(utils.RpcServerGroupFixture(self.url)) client = group.client(1) diff --git a/oslo_messaging/tests/functional/utils.py b/oslo_messaging/tests/functional/utils.py index 8ac087bc4..7c82939e8 100644 --- a/oslo_messaging/tests/functional/utils.py +++ b/oslo_messaging/tests/functional/utils.py @@ -61,7 +61,10 @@ class TransportFixture(fixtures.Fixture): self.transport = oslo_messaging.get_transport(cfg.CONF, url=self.url) def cleanUp(self): - self.transport.cleanup() + try: + self.transport.cleanup() + except fixtures.TimeoutException: + pass super(TransportFixture, self).cleanUp() def wait(self): @@ -271,8 +274,8 @@ class IsValidDistributionOf(object): class SkipIfNoTransportURL(test_utils.BaseTestCase): - def setUp(self): - super(SkipIfNoTransportURL, self).setUp() + def setUp(self, conf=cfg.CONF): + super(SkipIfNoTransportURL, self).setUp(conf=conf) self.url = os.environ.get('TRANSPORT_URL') if not self.url: self.skipTest("No transport url configured")