Make heartbeat the default

When heartbeat was introduced, it couldn't be enabled by default because
it depended on a minimum kombu version that we couldn't bump to at the
end of the release.

Now that Liberty is open and the minimum required version has been
bumped, I'm enabling heartbeat by default. The threshold this patch uses
is `60` which is the one gotten from tests and other deployments. Lets
make sure this is a sande default before merging the patch.

Change-Id: I21c29c328ef9936e76a215ab15962b46247dadd9
This commit is contained in:
Flavio Percoco 2015-07-07 08:51:12 +02:00 committed by Davanum Srinivas
parent a5e707c2bc
commit 168f6cc2bb
4 changed files with 17 additions and 12 deletions

View File

@ -136,7 +136,7 @@ rabbit_opts = [
'If you change this option, you must wipe the ' 'If you change this option, you must wipe the '
'RabbitMQ database.'), 'RabbitMQ database.'),
cfg.IntOpt('heartbeat_timeout_threshold', cfg.IntOpt('heartbeat_timeout_threshold',
default=0, default=60,
help="Number of seconds after which the Rabbit broker is " help="Number of seconds after which the Rabbit broker is "
"considered down if heartbeat's keep-alive fails " "considered down if heartbeat's keep-alive fails "
"(0 disable the heartbeat). EXPERIMENTAL"), "(0 disable the heartbeat). EXPERIMENTAL"),

View File

@ -58,12 +58,6 @@ class TestDeprecatedRabbitDriverLoad(test_utils.BaseTestCase):
class TestHeartbeat(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('oslo_messaging._drivers.impl_rabbit.LOG')
@mock.patch('kombu.connection.Connection.heartbeat_check') @mock.patch('kombu.connection.Connection.heartbeat_check')
@mock.patch('oslo_messaging._drivers.impl_rabbit.Connection.' @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.ensure')
@mock.patch('oslo_messaging._drivers.impl_rabbit.Connection.reset') @mock.patch('oslo_messaging._drivers.impl_rabbit.Connection.reset')
def test_driver_load(self, fake_ensure, fake_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') group='oslo_messaging_rabbit')
self.messaging_conf.transport_driver = self.transport_driver self.messaging_conf.transport_driver = self.transport_driver
transport = oslo_messaging.get_transport(self.conf) transport = oslo_messaging.get_transport(self.conf)
@ -173,7 +167,7 @@ class TestRabbitDriverLoadSSL(test_utils.BaseTestCase):
'on_blocked': mock.ANY, 'on_blocked': mock.ANY,
'on_unblocked': mock.ANY}, 'on_unblocked': mock.ANY},
ssl=self.expected, login_method='AMQPLAIN', ssl=self.expected, login_method='AMQPLAIN',
heartbeat=0, failover_strategy="shuffle") heartbeat=60, failover_strategy="shuffle")
class TestRabbitPublisher(test_utils.BaseTestCase): class TestRabbitPublisher(test_utils.BaseTestCase):

View File

@ -15,6 +15,7 @@ import time
import uuid import uuid
import concurrent.futures import concurrent.futures
from oslo_config import cfg
from testtools import matchers from testtools import matchers
import oslo_messaging import oslo_messaging
@ -22,6 +23,13 @@ from oslo_messaging.tests.functional import utils
class CallTestCase(utils.SkipIfNoTransportURL): 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): def test_specific_server(self):
group = self.useFixture(utils.RpcServerGroupFixture(self.url)) group = self.useFixture(utils.RpcServerGroupFixture(self.url))
client = group.client(1) client = group.client(1)

View File

@ -61,7 +61,10 @@ class TransportFixture(fixtures.Fixture):
self.transport = oslo_messaging.get_transport(cfg.CONF, url=self.url) self.transport = oslo_messaging.get_transport(cfg.CONF, url=self.url)
def cleanUp(self): def cleanUp(self):
try:
self.transport.cleanup() self.transport.cleanup()
except fixtures.TimeoutException:
pass
super(TransportFixture, self).cleanUp() super(TransportFixture, self).cleanUp()
def wait(self): def wait(self):
@ -271,8 +274,8 @@ class IsValidDistributionOf(object):
class SkipIfNoTransportURL(test_utils.BaseTestCase): class SkipIfNoTransportURL(test_utils.BaseTestCase):
def setUp(self): def setUp(self, conf=cfg.CONF):
super(SkipIfNoTransportURL, self).setUp() super(SkipIfNoTransportURL, self).setUp(conf=conf)
self.url = os.environ.get('TRANSPORT_URL') self.url = os.environ.get('TRANSPORT_URL')
if not self.url: if not self.url:
self.skipTest("No transport url configured") self.skipTest("No transport url configured")