Merge "Make heartbeat the default"
This commit is contained in:
commit
9eef14f1c0
@ -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"),
|
||||||
|
@ -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):
|
||||||
|
@ -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)
|
||||||
|
@ -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")
|
||||||
|
Loading…
Reference in New Issue
Block a user