Skip to content

Commit

Permalink
Add 'heartbeat_timeout_threshold` option
Browse files Browse the repository at this point in the history
This change adds the `heartbeat_timeout_threshold` option to the
`oslo_messaging_rabbit` section.

Closes-Bug: #1918673

Signed-off-by: Nicolas Bock <[email protected]>
  • Loading branch information
nicolasbock committed Mar 12, 2021
1 parent 29c9c2c commit 1e4a327
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions charmhelpers/contrib/openstack/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,8 @@ def __call__(self):
if send_notifications_to_logs:
ctxt['send_notifications_to_logs'] = send_notifications_to_logs

ctxt['rabbit_heartbeat_timeout_threshold'] = conf.get('rabbit-heartbeat-timeout-threshold')

if not self.complete:
return {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ ssl = True
{% if rabbit_ssl_ca -%}
ssl_ca_file = {{ rabbit_ssl_ca }}
{% endif -%}
{% if rabbit_heartbeat_timeout_threshold -%}
heartbeat_timeout_threshold = {{ rabbit_heartbeat_timeout_threshold }}
{% endif -%}
12 changes: 12 additions & 0 deletions tests/contrib/openstack/test_os_contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,7 @@ def test_amqp_context_with_data(self):
result = amqp()
expected = {
'oslo_messaging_driver': 'messagingv2',
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': 'rabbithost',
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand All @@ -1309,6 +1310,7 @@ def test_amqp_context_explicit_relation_id(self):
result = amqp()
expected = {
'oslo_messaging_driver': 'messagingv2',
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': 'rabbitalthost1',
'rabbitmq_password': 'flump',
'rabbitmq_user': 'adam',
Expand All @@ -1328,6 +1330,7 @@ def test_amqp_context_with_data_altname(self):
result = amqp()
expected = {
'oslo_messaging_driver': 'messagingv2',
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': 'rabbithost',
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand All @@ -1347,6 +1350,7 @@ def test_amqp_context_with_data_ssl(self, _open):
result = amqp()
expected = {
'oslo_messaging_driver': 'messagingv2',
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': 'rabbithost',
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand All @@ -1370,6 +1374,7 @@ def test_amqp_context_with_data_ssl_noca(self):
result = amqp()
expected = {
'oslo_messaging_driver': 'messagingv2',
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': 'rabbithost',
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand All @@ -1393,6 +1398,7 @@ def test_amqp_context_with_data_clustered(self):
expected = {
'oslo_messaging_driver': 'messagingv2',
'clustered': True,
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': relation_data['vip'],
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand All @@ -1413,6 +1419,7 @@ def test_amqp_context_with_data_active_active(self):
result = amqp()
expected = {
'oslo_messaging_driver': 'messagingv2',
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': 'rabbithost1',
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand Down Expand Up @@ -1458,6 +1465,7 @@ def test_amqp_context_with_ipv6(self, format_ipv6_addr):
result = amqp()
expected = {
'oslo_messaging_driver': 'messagingv2',
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': '[2001:db8:1::1]',
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand All @@ -1477,6 +1485,7 @@ def test_amqp_context_with_oslo_messaging(self):
amqp = context.AMQPContext()
result = amqp()
expected = {
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': 'rabbithost',
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand All @@ -1502,6 +1511,7 @@ def test_amqp_context_with_notification_format(self):
result = amqp()
expected = {
'oslo_messaging_driver': 'messagingv2',
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': 'rabbithost',
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand All @@ -1522,6 +1532,7 @@ def test_amqp_context_with_notification_topics(self):
result = amqp()
expected = {
'oslo_messaging_driver': 'messagingv2',
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': 'rabbithost',
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand All @@ -1542,6 +1553,7 @@ def test_amqp_context_with_notifications_to_logs(self):
result = amqp()
expected = {
'oslo_messaging_driver': 'messagingv2',
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': 'rabbithost',
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand Down

0 comments on commit 1e4a327

Please sign in to comment.