From 6a5c3c1f777fe06abdc9f9b4aff3de129d110d77 Mon Sep 17 00:00:00 2001 From: Jason Lang Date: Wed, 4 Dec 2024 22:05:27 +0000 Subject: [PATCH 1/5] Issue 1029 - add quorum queue auto-reconciliation parameter support. Default undef all of them so it does nothing unless you enable. --- manifests/config.pp | 181 +++++++++++++++++----------------- manifests/init.pp | 18 ++++ templates/rabbitmq.config.epp | 15 +++ 3 files changed, 126 insertions(+), 88 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 5f7062900..4abfa78d1 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -3,94 +3,99 @@ # # @api private class rabbitmq::config { - $admin_enable = $rabbitmq::admin_enable - $management_enable = $rabbitmq::management_enable - $use_config_file_for_plugins = $rabbitmq::use_config_file_for_plugins - $plugins = $rabbitmq::plugins - $cluster_node_type = $rabbitmq::cluster_node_type - $cluster_nodes = $rabbitmq::cluster_nodes - $config = $rabbitmq::config - $config_cluster = $rabbitmq::config_cluster - $config_cowboy_opts = $rabbitmq::config_cowboy_opts - $config_path = $rabbitmq::config_path - $config_ranch = $rabbitmq::config_ranch - $config_stomp = $rabbitmq::config_stomp - $stomp_ensure = $rabbitmq::stomp_ensure - $config_shovel = $rabbitmq::config_shovel - $config_shovel_statics = $rabbitmq::config_shovel_statics - $default_user = $rabbitmq::default_user - $default_pass = $rabbitmq::default_pass - $env_config = $rabbitmq::env_config - $env_config_path = $rabbitmq::env_config_path - $erlang_cookie = $rabbitmq::erlang_cookie - $interface = $rabbitmq::interface - $management_port = $rabbitmq::management_port - $management_ssl = $rabbitmq::management_ssl - $management_hostname = $rabbitmq::management_hostname - $node_ip_address = $rabbitmq::node_ip_address - $rabbitmq_user = $rabbitmq::rabbitmq_user - $rabbitmq_group = $rabbitmq::rabbitmq_group - $rabbitmq_home = $rabbitmq::rabbitmq_home - $port = $rabbitmq::port - $tcp_keepalive = $rabbitmq::tcp_keepalive - $tcp_backlog = $rabbitmq::tcp_backlog - $tcp_sndbuf = $rabbitmq::tcp_sndbuf - $tcp_recbuf = $rabbitmq::tcp_recbuf - $heartbeat = $rabbitmq::heartbeat - $service_name = $rabbitmq::service_name - $ssl = $rabbitmq::ssl - $ssl_only = $rabbitmq::ssl_only - $ssl_cacert = $rabbitmq::ssl_cacert - $ssl_cert = $rabbitmq::ssl_cert - $ssl_key = $rabbitmq::ssl_key - $ssl_depth = $rabbitmq::ssl_depth - $ssl_cert_password = $rabbitmq::ssl_cert_password - $ssl_port = $rabbitmq::ssl_port - $ssl_interface = $rabbitmq::ssl_interface - $ssl_management_port = $rabbitmq::ssl_management_port - $ssl_management_cacert = $rabbitmq::ssl_management_cacert - $ssl_management_cert = $rabbitmq::ssl_management_cert - $ssl_management_key = $rabbitmq::ssl_management_key - $ssl_management_verify = $rabbitmq::ssl_management_verify - $ssl_management_fail_if_no_peer_cert = $rabbitmq::ssl_management_fail_if_no_peer_cert - $ssl_stomp_port = $rabbitmq::ssl_stomp_port - $ssl_verify = $rabbitmq::ssl_verify - $ssl_fail_if_no_peer_cert = $rabbitmq::ssl_fail_if_no_peer_cert - $ssl_client_renegotiation = $rabbitmq::ssl_client_renegotiation - $ssl_secure_renegotiate = $rabbitmq::ssl_secure_renegotiate - $ssl_reuse_sessions = $rabbitmq::ssl_reuse_sessions - $ssl_honor_cipher_order = $rabbitmq::ssl_honor_cipher_order - $ssl_dhfile = $rabbitmq::ssl_dhfile - $ssl_versions = $rabbitmq::ssl_versions - $ssl_ciphers = $rabbitmq::ssl_ciphers - $ssl_crl_check = $rabbitmq::ssl_crl_check - $ssl_crl_cache_hash_dir = $rabbitmq::ssl_crl_cache_hash_dir - $ssl_crl_cache_http_timeout = $rabbitmq::ssl_crl_cache_http_timeout - $stomp_port = $rabbitmq::stomp_port - $stomp_ssl_only = $rabbitmq::stomp_ssl_only - $ldap_auth = $rabbitmq::ldap_auth - $ldap_server = $rabbitmq::ldap_server - $ldap_user_dn_pattern = $rabbitmq::ldap_user_dn_pattern - $ldap_other_bind = $rabbitmq::ldap_other_bind - $ldap_use_ssl = $rabbitmq::ldap_use_ssl - $ldap_port = $rabbitmq::ldap_port - $ldap_log = $rabbitmq::ldap_log - $ldap_config_variables = $rabbitmq::ldap_config_variables - $wipe_db_on_cookie_change = $rabbitmq::wipe_db_on_cookie_change - $config_variables = $rabbitmq::config_variables - $config_kernel_variables = $rabbitmq::config_kernel_variables - $config_management_variables = $rabbitmq::config_management_variables - $config_additional_variables = $rabbitmq::config_additional_variables - $auth_backends = $rabbitmq::auth_backends - $cluster_partition_handling = $rabbitmq::cluster_partition_handling - $file_limit = $rabbitmq::file_limit - $oom_score_adj = $rabbitmq::oom_score_adj - $collect_statistics_interval = $rabbitmq::collect_statistics_interval - $ipv6 = $rabbitmq::ipv6 - $inetrc_config = $rabbitmq::inetrc_config - $inetrc_config_path = $rabbitmq::inetrc_config_path - $ssl_erl_dist = $rabbitmq::ssl_erl_dist - $loopback_users = $rabbitmq::loopback_users + $admin_enable = $rabbitmq::admin_enable + $management_enable = $rabbitmq::management_enable + $use_config_file_for_plugins = $rabbitmq::use_config_file_for_plugins + $plugins = $rabbitmq::plugins + $cluster_node_type = $rabbitmq::cluster_node_type + $cluster_nodes = $rabbitmq::cluster_nodes + $config = $rabbitmq::config + $config_cluster = $rabbitmq::config_cluster + $config_cowboy_opts = $rabbitmq::config_cowboy_opts + $config_path = $rabbitmq::config_path + $config_ranch = $rabbitmq::config_ranch + $config_stomp = $rabbitmq::config_stomp + $stomp_ensure = $rabbitmq::stomp_ensure + $config_shovel = $rabbitmq::config_shovel + $config_shovel_statics = $rabbitmq::config_shovel_statics + $default_user = $rabbitmq::default_user + $default_pass = $rabbitmq::default_pass + $env_config = $rabbitmq::env_config + $env_config_path = $rabbitmq::env_config_path + $erlang_cookie = $rabbitmq::erlang_cookie + $interface = $rabbitmq::interface + $management_port = $rabbitmq::management_port + $management_ssl = $rabbitmq::management_ssl + $management_hostname = $rabbitmq::management_hostname + $node_ip_address = $rabbitmq::node_ip_address + $quorum_membership_reconciliation_enabled = $rabbitmq::quorum_membership_reconciliation_enabled + $quorum_membership_reconciliation_auto_remove = $rabbitmq::quorum_membership_reconciliation_auto_remove + $quorum_membership_reconciliation_interval = $rabbitmq::quorum_membership_reconciliation_interval + $quorum_membership_reconciliation_trigger_interval = $rabbitmq::quorum_membership_reconciliation_trigger_interval + $quorum_membership_reconciliation_target_group_size = $rabbitmq::quorum_membership_reconciliation_target_group_size + $rabbitmq_user = $rabbitmq::rabbitmq_user + $rabbitmq_group = $rabbitmq::rabbitmq_group + $rabbitmq_home = $rabbitmq::rabbitmq_home + $port = $rabbitmq::port + $tcp_keepalive = $rabbitmq::tcp_keepalive + $tcp_backlog = $rabbitmq::tcp_backlog + $tcp_sndbuf = $rabbitmq::tcp_sndbuf + $tcp_recbuf = $rabbitmq::tcp_recbuf + $heartbeat = $rabbitmq::heartbeat + $service_name = $rabbitmq::service_name + $ssl = $rabbitmq::ssl + $ssl_only = $rabbitmq::ssl_only + $ssl_cacert = $rabbitmq::ssl_cacert + $ssl_cert = $rabbitmq::ssl_cert + $ssl_key = $rabbitmq::ssl_key + $ssl_depth = $rabbitmq::ssl_depth + $ssl_cert_password = $rabbitmq::ssl_cert_password + $ssl_port = $rabbitmq::ssl_port + $ssl_interface = $rabbitmq::ssl_interface + $ssl_management_port = $rabbitmq::ssl_management_port + $ssl_management_cacert = $rabbitmq::ssl_management_cacert + $ssl_management_cert = $rabbitmq::ssl_management_cert + $ssl_management_key = $rabbitmq::ssl_management_key + $ssl_management_verify = $rabbitmq::ssl_management_verify + $ssl_management_fail_if_no_peer_cert = $rabbitmq::ssl_management_fail_if_no_peer_cert + $ssl_stomp_port = $rabbitmq::ssl_stomp_port + $ssl_verify = $rabbitmq::ssl_verify + $ssl_fail_if_no_peer_cert = $rabbitmq::ssl_fail_if_no_peer_cert + $ssl_client_renegotiation = $rabbitmq::ssl_client_renegotiation + $ssl_secure_renegotiate = $rabbitmq::ssl_secure_renegotiate + $ssl_reuse_sessions = $rabbitmq::ssl_reuse_sessions + $ssl_honor_cipher_order = $rabbitmq::ssl_honor_cipher_order + $ssl_dhfile = $rabbitmq::ssl_dhfile + $ssl_versions = $rabbitmq::ssl_versions + $ssl_ciphers = $rabbitmq::ssl_ciphers + $ssl_crl_check = $rabbitmq::ssl_crl_check + $ssl_crl_cache_hash_dir = $rabbitmq::ssl_crl_cache_hash_dir + $ssl_crl_cache_http_timeout = $rabbitmq::ssl_crl_cache_http_timeout + $stomp_port = $rabbitmq::stomp_port + $stomp_ssl_only = $rabbitmq::stomp_ssl_only + $ldap_auth = $rabbitmq::ldap_auth + $ldap_server = $rabbitmq::ldap_server + $ldap_user_dn_pattern = $rabbitmq::ldap_user_dn_pattern + $ldap_other_bind = $rabbitmq::ldap_other_bind + $ldap_use_ssl = $rabbitmq::ldap_use_ssl + $ldap_port = $rabbitmq::ldap_port + $ldap_log = $rabbitmq::ldap_log + $ldap_config_variables = $rabbitmq::ldap_config_variables + $wipe_db_on_cookie_change = $rabbitmq::wipe_db_on_cookie_change + $config_variables = $rabbitmq::config_variables + $config_kernel_variables = $rabbitmq::config_kernel_variables + $config_management_variables = $rabbitmq::config_management_variables + $config_additional_variables = $rabbitmq::config_additional_variables + $auth_backends = $rabbitmq::auth_backends + $cluster_partition_handling = $rabbitmq::cluster_partition_handling + $file_limit = $rabbitmq::file_limit + $oom_score_adj = $rabbitmq::oom_score_adj + $collect_statistics_interval = $rabbitmq::collect_statistics_interval + $ipv6 = $rabbitmq::ipv6 + $inetrc_config = $rabbitmq::inetrc_config + $inetrc_config_path = $rabbitmq::inetrc_config_path + $ssl_erl_dist = $rabbitmq::ssl_erl_dist + $loopback_users = $rabbitmq::loopback_users if $ssl_only { $default_ssl_env_variables = {} diff --git a/manifests/init.pp b/manifests/init.pp index 5382d9d8e..7f42714b7 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -240,6 +240,19 @@ # The RabbitMQ port. # @param python_package # Name of the package required by rabbitmqadmin. +# @param quorum_membership_reconciliation_enabled +# Boolean - Enables or disables continuous membership reconciliation. Defaults Omitted +# @param quorum_membership_reconciliation_auto_remove +# Boolean - Enables or disables automatic removal of member nodes that are no longer part of the cluster, +# but still a member of the quorum queue. Defaults Omitted +# @param quorum_membership_reconciliation_interval +# Integer - The default evaluation interval in milliseconds. Defaults Omitted +# @param quorum_membership_reconciliation_trigger_interval +# Integer - The reconciliation delay in milliseconds, used when a trigger event occurs, +# for example, a node is added or removed from the cluster or an applicable policy changes. +# This delay will be applied only once, then the regular interval will be used again. Default Omitted +# @param quorum_membership_reconciliation_target_group_size +# Integer - Default Omitted # @param repos_ensure # Ensure that a repo with the official (and newer) RabbitMQ package is configured, along with its signing key. # Defaults to false (use system packages). This does not ensure that soft dependencies are present. @@ -381,6 +394,11 @@ Optional[Variant[Numeric, String[1]]] $package_apt_pin = undef, String $package_ensure = 'installed', Optional[String] $package_gpg_key = undef, + Optional[Boolean] $quorum_membership_reconciliation_enabled = undef, + Optional[Boolean] $quorum_membership_reconciliation_auto_remove = undef, + Optional[Integer] $quorum_membership_reconciliation_interval = undef, + Optional[Integer] $quorum_membership_reconciliation_trigger_interval = undef, + Optional[Integer] $quorum_membership_reconciliation_target_group_size = undef, Optional[String] $repo_gpg_key = undef, Variant[String, Array] $package_name = 'rabbitmq', Optional[String] $package_source = undef, diff --git a/templates/rabbitmq.config.epp b/templates/rabbitmq.config.epp index be71d1187..23492db7e 100644 --- a/templates/rabbitmq.config.epp +++ b/templates/rabbitmq.config.epp @@ -25,6 +25,21 @@ {cluster_nodes, {[], <%= $rabbitmq::config::cluster_node_type %>}}, <%- } -%> {cluster_partition_handling, <%= $rabbitmq::config::cluster_partition_handling %>}, +<% } -%> +<% if $rabbitmq::config::quorum_membership_reconciliation_enabled {-%> + {quorum_membership_reconciliation_enabled, <%= $rabbitmq::config::quorum_membership_reconciliation_enabled %>}, +<% } -%> +<% if $rabbitmq::config::quorum_membership_reconciliation_auto_remove {-%> + {quorum_membership_reconciliation_auto_remove, <%= $rabbitmq::config::quorum_membership_reconciliation_auto_remove %>}, +<% } -%> +<% if $rabbitmq::config::quorum_membership_reconciliation_interval {-%> + {quorum_membership_reconciliation_interval, <%= $rabbitmq::config::quorum_membership_reconciliation_interval %>}, +<% } -%> +<% if $rabbitmq::config::quorum_membership_reconciliation_trigger_interval {-%> + {quorum_membership_reconciliation_trigger_interval, <%= $rabbitmq::config::quorum_membership_reconciliation_trigger_interval %>}, +<% } -%> +<% if $rabbitmq::config::quorum_membership_reconciliation_target_group_size {-%> + {quorum_membership_reconciliation_target_group_size, <%= $rabbitmq::config::quorum_membership_reconciliation_target_group_size %>}, <% } -%> {tcp_listen_options, [ <%- unless $rabbitmq::config::config_ranch {-%> From 58680e99ebcb959af8bcccce595813b1a7ced97a Mon Sep 17 00:00:00 2001 From: Jason Lang Date: Thu, 5 Dec 2024 19:00:44 +0000 Subject: [PATCH 2/5] add needed docs, tests, and fixes. --- REFERENCE.md | 56 ++++++++++++++ manifests/init.pp | 18 +++-- spec/classes/rabbitmq_spec.rb | 137 +++++++++++++++++++++++++++++++++- templates/rabbitmq.config.epp | 10 +-- 4 files changed, 210 insertions(+), 11 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 9f9e414ae..a1615f0f3 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -254,6 +254,11 @@ The following parameters are available in the `rabbitmq` class: * [`package_name`](#-rabbitmq--package_name) * [`port`](#-rabbitmq--port) * [`python_package`](#-rabbitmq--python_package) +* [`quorum_membership_reconciliation_enabled`](#-rabbitmq--quorum_membership_reconciliation_enabled) +* [`quorum_membership_reconciliation_auto_remove`](#-rabbitmq--quorum_membership_reconciliation_auto_remove) +* [`quorum_membership_reconciliation_interval`](#-rabbitmq--quorum_membership_reconciliation_interval) +* [`quorum_membership_reconciliation_trigger_interval`](#-rabbitmq--quorum_membership_reconciliation_trigger_interval) +* [`quorum_membership_reconciliation_target_group_size`](#-rabbitmq--quorum_membership_reconciliation_target_group_size) * [`repos_ensure`](#-rabbitmq--repos_ensure) * [`service_ensure`](#-rabbitmq--service_ensure) * [`service_manage`](#-rabbitmq--service_manage) @@ -799,6 +804,57 @@ Name of the package required by rabbitmqadmin. Default value: `'python'` +##### `quorum_membership_reconciliation_enabled` + +Data type: `Optional[Boolean]` + +Boolean - Enables or disables continuous membership reconciliation. +This requires RabbitMQ 3.13 or higher. More information on this configuration +can be found here: https://www.rabbitmq.com/docs/quorum-queues + +Default value: `undef` + +##### `quorum_membership_reconciliation_auto_remove` + +Data type: `Optional[Boolean]` + +Boolean - Enables or disables automatic removal of member nodes that are no longer part of the cluster, +but still a member of the quorum queue. This requires RabbitMQ 3.13 or higher. More information on this configuration +can be found here: https://www.rabbitmq.com/docs/quorum-queues + +Default value: `undef` + +##### `quorum_membership_reconciliation_interval` + +Data type: `Optional[Integer]` + +Integer - The default evaluation interval in milliseconds. This requires RabbitMQ 3.13 or higher. More information on this configuration +can be found here: https://www.rabbitmq.com/docs/quorum-queues + +Default value: `undef` + +##### `quorum_membership_reconciliation_trigger_interval` + +Data type: `Optional[Integer]` + +Integer - The reconciliation delay in milliseconds, used when a trigger event occurs, +for example, a node is added or removed from the cluster or an applicable policy changes. +This delay will be applied only once, then the regular interval will be used again. +This requires RabbitMQ 3.13 or higher. More information on this configuration +can be found here: https://www.rabbitmq.com/docs/quorum-queues + +Default value: `undef` + +##### `quorum_membership_reconciliation_target_group_size` + +Data type: `Optional[Integer]` + +Integer - Controls the target group size for a quorum queue +This requires RabbitMQ 3.13 or higher. More information on this configuration +can be found here: https://www.rabbitmq.com/docs/quorum-queues + +Default value: `undef` + ##### `repos_ensure` Data type: `Boolean` diff --git a/manifests/init.pp b/manifests/init.pp index 7f42714b7..f9e7d601c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -241,18 +241,26 @@ # @param python_package # Name of the package required by rabbitmqadmin. # @param quorum_membership_reconciliation_enabled -# Boolean - Enables or disables continuous membership reconciliation. Defaults Omitted +# Boolean - Enables or disables continuous membership reconciliation. +# This requires RabbitMQ 3.13 or higher. More information on this configuration +# can be found here: https://www.rabbitmq.com/docs/quorum-queues # @param quorum_membership_reconciliation_auto_remove # Boolean - Enables or disables automatic removal of member nodes that are no longer part of the cluster, -# but still a member of the quorum queue. Defaults Omitted +# but still a member of the quorum queue. This requires RabbitMQ 3.13 or higher. More information on this configuration +# can be found here: https://www.rabbitmq.com/docs/quorum-queues # @param quorum_membership_reconciliation_interval -# Integer - The default evaluation interval in milliseconds. Defaults Omitted +# Integer - The default evaluation interval in milliseconds. This requires RabbitMQ 3.13 or higher. More information on this configuration +# can be found here: https://www.rabbitmq.com/docs/quorum-queues # @param quorum_membership_reconciliation_trigger_interval # Integer - The reconciliation delay in milliseconds, used when a trigger event occurs, # for example, a node is added or removed from the cluster or an applicable policy changes. -# This delay will be applied only once, then the regular interval will be used again. Default Omitted +# This delay will be applied only once, then the regular interval will be used again. +# This requires RabbitMQ 3.13 or higher. More information on this configuration +# can be found here: https://www.rabbitmq.com/docs/quorum-queues # @param quorum_membership_reconciliation_target_group_size -# Integer - Default Omitted +# Integer - Controls the target group size for a quorum queue +# This requires RabbitMQ 3.13 or higher. More information on this configuration +# can be found here: https://www.rabbitmq.com/docs/quorum-queues # @param repos_ensure # Ensure that a repo with the official (and newer) RabbitMQ package is configured, along with its signing key. # Defaults to false (use system packages). This does not ensure that soft dependencies are present. diff --git a/spec/classes/rabbitmq_spec.rb b/spec/classes/rabbitmq_spec.rb index 6479c6cd3..3264c6213 100644 --- a/spec/classes/rabbitmq_spec.rb +++ b/spec/classes/rabbitmq_spec.rb @@ -1788,12 +1788,147 @@ describe 'rabbitmq-heartbeat options' do let(:params) { { heartbeat: 60 } } - it 'sets heartbeat paramter in config file' do + it 'sets heartbeat parameter in config file' do is_expected.to contain_file('rabbitmq.config'). \ with_content(%r{\{heartbeat, 60\}}) end end + describe 'rabbitmq-quorum_membership_reconciliation_enabled undef options' do + let(:params) { { quorum_membership_reconciliation_enabled: :undef } } + + it 'sets quorum_membership_reconciliation_enabled parameter undef in config file' do + is_expected.not_to contain_file('rabbitmq.config'). \ + with_content(%r{\{quorum_membership_reconciliation_enabled, .*\}}) + end + end + + describe 'rabbitmq-quorum_membership_reconciliation_enabled false options' do + let(:params) { { quorum_membership_reconciliation_enabled: false } } + + it 'sets quorum_membership_reconciliation_enabled parameter false in config file' do + is_expected.to contain_file('rabbitmq.config'). \ + with_content(%r{\{quorum_membership_reconciliation_enabled, false\}}) + end + end + + describe 'rabbitmq-quorum_membership_reconciliation_enabled true options' do + let(:params) { { quorum_membership_reconciliation_enabled: true } } + + it 'sets quorum_membership_reconciliation_enabled parameter true in config file' do + is_expected.to contain_file('rabbitmq.config'). \ + with_content(%r{\{quorum_membership_reconciliation_enabled, true\}}) + end + end + + describe 'rabbitmq-quorum_membership_reconciliation_auto_remove undef options' do + let(:params) { { quorum_membership_reconciliation_auto_remove: :undef } } + + it 'sets quorum_membership_reconciliation_auto_remove parameter undef in config file' do + is_expected.not_to contain_file('rabbitmq.config'). \ + with_content(%r{\{quorum_membership_reconciliation_auto_remove, .*\}}) + end + end + + describe 'rabbitmq-quorum_membership_reconciliation_auto_remove false options' do + let(:params) { { quorum_membership_reconciliation_auto_remove: false } } + + it 'sets quorum_membership_reconciliation_auto_remove parameter false in config file' do + is_expected.to contain_file('rabbitmq.config'). \ + with_content(%r{\{quorum_membership_reconciliation_auto_remove, false\}}) + end + end + + describe 'rabbitmq-quorum_membership_reconciliation_auto_remove true options' do + let(:params) { { quorum_membership_reconciliation_auto_remove: true } } + + it 'sets quorum_membership_reconciliation_auto_remove parameter true in config file' do + is_expected.to contain_file('rabbitmq.config'). \ + with_content(%r{\{quorum_membership_reconciliation_auto_remove, true\}}) + end + end + + describe 'rabbitmq-quorum_membership_reconciliation_interval undef options' do + let(:params) { { quorum_membership_reconciliation_interval: :undef } } + + it 'sets quorum_membership_reconciliation_interval parameter undef in config file' do + is_expected.not_to contain_file('rabbitmq.config'). \ + with_content(%r{\{quorum_membership_reconciliation_interval, .*\}}) + end + end + + describe 'rabbitmq-quorum_membership_reconciliation_interval 36000 options' do + let(:params) { { quorum_membership_reconciliation_interval: 36_000 } } + + it 'sets quorum_membership_reconciliation_interval parameter 36000 in config file' do + is_expected.to contain_file('rabbitmq.config'). \ + with_content(%r{\{quorum_membership_reconciliation_interval, 36000\}}) + end + end + + describe 'rabbitmq-quorum_membership_reconciliation_interval 36000000000 options' do + let(:params) { { quorum_membership_reconciliation_interval: 36_000_000_000 } } + + it 'sets quorum_membership_reconciliation_interval parameter 36000000000 in config file' do + is_expected.to contain_file('rabbitmq.config'). \ + with_content(%r{\{quorum_membership_reconciliation_interval, 36000000000\}}) + end + end + + describe 'rabbitmq-quorum_membership_reconciliation_trigger_interval undef options' do + let(:params) { { quorum_membership_reconciliation_trigger_interval: :undef } } + + it 'sets quorum_membership_reconciliation_trigger_interval parameter undef in config file' do + is_expected.not_to contain_file('rabbitmq.config'). \ + with_content(%r{\{quorum_membership_reconciliation_trigger_interval, .*\}}) + end + end + + describe 'rabbitmq-quorum_membership_reconciliation_trigger_interval 3600 options' do + let(:params) { { quorum_membership_reconciliation_trigger_interval: 3600 } } + + it 'sets quorum_membership_reconciliation_trigger_interval parameter 3600 in config file' do + is_expected.to contain_file('rabbitmq.config'). \ + with_content(%r{\{quorum_membership_reconciliation_trigger_interval, 3600\}}) + end + end + + describe 'rabbitmq-quorum_membership_reconciliation_trigger_interval 36000000000 options' do + let(:params) { { quorum_membership_reconciliation_trigger_interval: 36_000_000_000 } } + + it 'sets quorum_membership_reconciliation_trigger_interval parameter 36000000000 in config file' do + is_expected.to contain_file('rabbitmq.config'). \ + with_content(%r{\{quorum_membership_reconciliation_trigger_interval, 36000000000\}}) + end + end + + describe 'rabbitmq-quorum_membership_reconciliation_target_group_size undef options' do + let(:params) { { quorum_membership_reconciliation_target_group_size: :undef } } + + it 'sets quorum_membership_reconciliation_target_group_size parameter undef in config file' do + is_expected.not_to contain_file('rabbitmq.config'). \ + with_content(%r{\{quorum_membership_reconciliation_target_group_size, .*\}}) + end + end + + describe 'rabbitmq-quorum_membership_reconciliation_target_group_size 2 options' do + let(:params) { { quorum_membership_reconciliation_target_group_size: 2 } } + + it 'sets quorum_membership_reconciliation_target_group_size parameter 2 in config file' do + is_expected.to contain_file('rabbitmq.config'). \ + with_content(%r{\{quorum_membership_reconciliation_target_group_size, 2\}}) + end + end + + describe 'rabbitmq-quorum_membership_reconciliation_target_group_size 4 options' do + let(:params) { { quorum_membership_reconciliation_target_group_size: 4 } } + + it 'sets quorum_membership_reconciliation_target_group_size parameter 4 in config file' do + is_expected.to contain_file('rabbitmq.config'). \ + with_content(%r{\{quorum_membership_reconciliation_target_group_size, 4\}}) + end + end + context 'delete_guest_user' do describe 'should do nothing by default' do it { is_expected.not_to contain_rabbitmq_user('guest') } diff --git a/templates/rabbitmq.config.epp b/templates/rabbitmq.config.epp index 23492db7e..52ac55276 100644 --- a/templates/rabbitmq.config.epp +++ b/templates/rabbitmq.config.epp @@ -26,19 +26,19 @@ <%- } -%> {cluster_partition_handling, <%= $rabbitmq::config::cluster_partition_handling %>}, <% } -%> -<% if $rabbitmq::config::quorum_membership_reconciliation_enabled {-%> +<% unless $rabbitmq::config::quorum_membership_reconciliation_enabled =~ Undef {-%> {quorum_membership_reconciliation_enabled, <%= $rabbitmq::config::quorum_membership_reconciliation_enabled %>}, <% } -%> -<% if $rabbitmq::config::quorum_membership_reconciliation_auto_remove {-%> +<% unless $rabbitmq::config::quorum_membership_reconciliation_auto_remove =~ Undef {-%> {quorum_membership_reconciliation_auto_remove, <%= $rabbitmq::config::quorum_membership_reconciliation_auto_remove %>}, <% } -%> -<% if $rabbitmq::config::quorum_membership_reconciliation_interval {-%> +<% unless $rabbitmq::config::quorum_membership_reconciliation_interval =~ Undef {-%> {quorum_membership_reconciliation_interval, <%= $rabbitmq::config::quorum_membership_reconciliation_interval %>}, <% } -%> -<% if $rabbitmq::config::quorum_membership_reconciliation_trigger_interval {-%> +<% unless $rabbitmq::config::quorum_membership_reconciliation_trigger_interval =~ Undef {-%> {quorum_membership_reconciliation_trigger_interval, <%= $rabbitmq::config::quorum_membership_reconciliation_trigger_interval %>}, <% } -%> -<% if $rabbitmq::config::quorum_membership_reconciliation_target_group_size {-%> +<% unless $rabbitmq::config::quorum_membership_reconciliation_target_group_size =~ Undef {-%> {quorum_membership_reconciliation_target_group_size, <%= $rabbitmq::config::quorum_membership_reconciliation_target_group_size %>}, <% } -%> {tcp_listen_options, [ From 008c89b079007a2d14616cf2c0216ec03ba72af9 Mon Sep 17 00:00:00 2001 From: Jason Lang Date: Thu, 12 Dec 2024 22:21:28 +0000 Subject: [PATCH 3/5] Rework some logic and testing cases per github discussion. Should be fully dependent on an enablement variable now, with tests to verify that behavior. --- REFERENCE.md | 4 + manifests/init.pp | 4 + spec/classes/rabbitmq_spec.rb | 142 ++++++++++------------------------ templates/rabbitmq.config.epp | 4 +- 4 files changed, 51 insertions(+), 103 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index a1615f0f3..edcb27b5f 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -821,6 +821,7 @@ Data type: `Optional[Boolean]` Boolean - Enables or disables automatic removal of member nodes that are no longer part of the cluster, but still a member of the quorum queue. This requires RabbitMQ 3.13 or higher. More information on this configuration can be found here: https://www.rabbitmq.com/docs/quorum-queues +Important Note: This only takes affect if quorum_membership_reconciliation_enabled is set to true. Default value: `undef` @@ -830,6 +831,7 @@ Data type: `Optional[Integer]` Integer - The default evaluation interval in milliseconds. This requires RabbitMQ 3.13 or higher. More information on this configuration can be found here: https://www.rabbitmq.com/docs/quorum-queues +Important Note: This only takes affect if quorum_membership_reconciliation_enabled is set to true. Default value: `undef` @@ -842,6 +844,7 @@ for example, a node is added or removed from the cluster or an applicable policy This delay will be applied only once, then the regular interval will be used again. This requires RabbitMQ 3.13 or higher. More information on this configuration can be found here: https://www.rabbitmq.com/docs/quorum-queues +Important Note: This only takes affect if quorum_membership_reconciliation_enabled is set to true. Default value: `undef` @@ -852,6 +855,7 @@ Data type: `Optional[Integer]` Integer - Controls the target group size for a quorum queue This requires RabbitMQ 3.13 or higher. More information on this configuration can be found here: https://www.rabbitmq.com/docs/quorum-queues +Important Note: This only takes affect if quorum_membership_reconciliation_enabled is set to true. Default value: `undef` diff --git a/manifests/init.pp b/manifests/init.pp index f9e7d601c..af272bc61 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -248,19 +248,23 @@ # Boolean - Enables or disables automatic removal of member nodes that are no longer part of the cluster, # but still a member of the quorum queue. This requires RabbitMQ 3.13 or higher. More information on this configuration # can be found here: https://www.rabbitmq.com/docs/quorum-queues +# Important Note: This only takes affect if quorum_membership_reconciliation_enabled is set to true. # @param quorum_membership_reconciliation_interval # Integer - The default evaluation interval in milliseconds. This requires RabbitMQ 3.13 or higher. More information on this configuration # can be found here: https://www.rabbitmq.com/docs/quorum-queues +# Important Note: This only takes affect if quorum_membership_reconciliation_enabled is set to true. # @param quorum_membership_reconciliation_trigger_interval # Integer - The reconciliation delay in milliseconds, used when a trigger event occurs, # for example, a node is added or removed from the cluster or an applicable policy changes. # This delay will be applied only once, then the regular interval will be used again. # This requires RabbitMQ 3.13 or higher. More information on this configuration # can be found here: https://www.rabbitmq.com/docs/quorum-queues +# Important Note: This only takes affect if quorum_membership_reconciliation_enabled is set to true. # @param quorum_membership_reconciliation_target_group_size # Integer - Controls the target group size for a quorum queue # This requires RabbitMQ 3.13 or higher. More information on this configuration # can be found here: https://www.rabbitmq.com/docs/quorum-queues +# Important Note: This only takes affect if quorum_membership_reconciliation_enabled is set to true. # @param repos_ensure # Ensure that a repo with the official (and newer) RabbitMQ package is configured, along with its signing key. # Defaults to false (use system packages). This does not ensure that soft dependencies are present. diff --git a/spec/classes/rabbitmq_spec.rb b/spec/classes/rabbitmq_spec.rb index 3264c6213..11eceb70b 100644 --- a/spec/classes/rabbitmq_spec.rb +++ b/spec/classes/rabbitmq_spec.rb @@ -1794,24 +1794,41 @@ end end + # Ensure that whenever Param quorum_membership_reconciliation_enabled is unset - none of the + # other quorum_membership_reconciliation paramaters are set at all + # This ensures full backward compatibility with PRE RabbitMQ 3.13 describe 'rabbitmq-quorum_membership_reconciliation_enabled undef options' do let(:params) { { quorum_membership_reconciliation_enabled: :undef } } it 'sets quorum_membership_reconciliation_enabled parameter undef in config file' do is_expected.not_to contain_file('rabbitmq.config'). \ - with_content(%r{\{quorum_membership_reconciliation_enabled, .*\}}) + with_content(%r{\{quorum_membership_reconciliation_enabled, .*\}}). \ + with_content(%r{\{quorum_membership_reconciliation_auto_remove, .*\}}). \ + with_content(%r{\{quorum_membership_reconciliation_interval, .*\}}). \ + with_content(%r{\{quorum_membership_reconciliation_trigger_interval, .*\}}). \ + with_content(%r{\{quorum_membership_reconciliation_target_group_size, .*\}}) end end + # Ensure that whenever Param quorum_membership_reconciliation_enabled is false - none of the + # other quorum_membership_reconciliation paramaters are set at all + # This ensures full backward compatibility with PRE RabbitMQ 3.13 describe 'rabbitmq-quorum_membership_reconciliation_enabled false options' do let(:params) { { quorum_membership_reconciliation_enabled: false } } it 'sets quorum_membership_reconciliation_enabled parameter false in config file' do - is_expected.to contain_file('rabbitmq.config'). \ - with_content(%r{\{quorum_membership_reconciliation_enabled, false\}}) + is_expected.not_to contain_file('rabbitmq.config'). \ + with_content(%r{\{quorum_membership_reconciliation_enabled, .*\}}). \ + with_content(%r{\{quorum_membership_reconciliation_auto_remove, .*\}}). \ + with_content(%r{\{quorum_membership_reconciliation_interval, .*\}}). \ + with_content(%r{\{quorum_membership_reconciliation_trigger_interval, .*\}}). \ + with_content(%r{\{quorum_membership_reconciliation_target_group_size, .*\}}) end end + # Ensure that whenever Param quorum_membership_reconciliation_enabled is true - the defaults + # of all other quorum_membership_reconciliation parameters ensure they are UNSET until + # explicitly set. describe 'rabbitmq-quorum_membership_reconciliation_enabled true options' do let(:params) { { quorum_membership_reconciliation_enabled: true } } @@ -1819,113 +1836,36 @@ is_expected.to contain_file('rabbitmq.config'). \ with_content(%r{\{quorum_membership_reconciliation_enabled, true\}}) end - end - - describe 'rabbitmq-quorum_membership_reconciliation_auto_remove undef options' do - let(:params) { { quorum_membership_reconciliation_auto_remove: :undef } } - - it 'sets quorum_membership_reconciliation_auto_remove parameter undef in config file' do - is_expected.not_to contain_file('rabbitmq.config'). \ - with_content(%r{\{quorum_membership_reconciliation_auto_remove, .*\}}) - end - end - - describe 'rabbitmq-quorum_membership_reconciliation_auto_remove false options' do - let(:params) { { quorum_membership_reconciliation_auto_remove: false } } - - it 'sets quorum_membership_reconciliation_auto_remove parameter false in config file' do - is_expected.to contain_file('rabbitmq.config'). \ - with_content(%r{\{quorum_membership_reconciliation_auto_remove, false\}}) - end - end - - describe 'rabbitmq-quorum_membership_reconciliation_auto_remove true options' do - let(:params) { { quorum_membership_reconciliation_auto_remove: true } } - - it 'sets quorum_membership_reconciliation_auto_remove parameter true in config file' do - is_expected.to contain_file('rabbitmq.config'). \ - with_content(%r{\{quorum_membership_reconciliation_auto_remove, true\}}) - end - end - - describe 'rabbitmq-quorum_membership_reconciliation_interval undef options' do - let(:params) { { quorum_membership_reconciliation_interval: :undef } } - - it 'sets quorum_membership_reconciliation_interval parameter undef in config file' do - is_expected.not_to contain_file('rabbitmq.config'). \ - with_content(%r{\{quorum_membership_reconciliation_interval, .*\}}) - end - end - - describe 'rabbitmq-quorum_membership_reconciliation_interval 36000 options' do - let(:params) { { quorum_membership_reconciliation_interval: 36_000 } } - - it 'sets quorum_membership_reconciliation_interval parameter 36000 in config file' do - is_expected.to contain_file('rabbitmq.config'). \ - with_content(%r{\{quorum_membership_reconciliation_interval, 36000\}}) - end - end - - describe 'rabbitmq-quorum_membership_reconciliation_interval 36000000000 options' do - let(:params) { { quorum_membership_reconciliation_interval: 36_000_000_000 } } - - it 'sets quorum_membership_reconciliation_interval parameter 36000000000 in config file' do - is_expected.to contain_file('rabbitmq.config'). \ - with_content(%r{\{quorum_membership_reconciliation_interval, 36000000000\}}) - end - end - describe 'rabbitmq-quorum_membership_reconciliation_trigger_interval undef options' do - let(:params) { { quorum_membership_reconciliation_trigger_interval: :undef } } - - it 'sets quorum_membership_reconciliation_trigger_interval parameter undef in config file' do - is_expected.not_to contain_file('rabbitmq.config'). \ - with_content(%r{\{quorum_membership_reconciliation_trigger_interval, .*\}}) - end - end - - describe 'rabbitmq-quorum_membership_reconciliation_trigger_interval 3600 options' do - let(:params) { { quorum_membership_reconciliation_trigger_interval: 3600 } } - - it 'sets quorum_membership_reconciliation_trigger_interval parameter 3600 in config file' do - is_expected.to contain_file('rabbitmq.config'). \ - with_content(%r{\{quorum_membership_reconciliation_trigger_interval, 3600\}}) - end - end - - describe 'rabbitmq-quorum_membership_reconciliation_trigger_interval 36000000000 options' do - let(:params) { { quorum_membership_reconciliation_trigger_interval: 36_000_000_000 } } - - it 'sets quorum_membership_reconciliation_trigger_interval parameter 36000000000 in config file' do - is_expected.to contain_file('rabbitmq.config'). \ - with_content(%r{\{quorum_membership_reconciliation_trigger_interval, 36000000000\}}) - end - end - - describe 'rabbitmq-quorum_membership_reconciliation_target_group_size undef options' do - let(:params) { { quorum_membership_reconciliation_target_group_size: :undef } } - - it 'sets quorum_membership_reconciliation_target_group_size parameter undef in config file' do + it 'sets quorum_membership_reconciliation_enabled parameter true in config file ONLY' do is_expected.not_to contain_file('rabbitmq.config'). \ + with_content(%r{\{quorum_membership_reconciliation_auto_remove, .*\}}). \ + with_content(%r{\{quorum_membership_reconciliation_interval, .*\}}). \ + with_content(%r{\{quorum_membership_reconciliation_trigger_interval, .*\}}). \ with_content(%r{\{quorum_membership_reconciliation_target_group_size, .*\}}) end end - describe 'rabbitmq-quorum_membership_reconciliation_target_group_size 2 options' do - let(:params) { { quorum_membership_reconciliation_target_group_size: 2 } } - - it 'sets quorum_membership_reconciliation_target_group_size parameter 2 in config file' do - is_expected.to contain_file('rabbitmq.config'). \ - with_content(%r{\{quorum_membership_reconciliation_target_group_size, 2\}}) + # Ensure that whenever Param quorum_membership_reconciliation_enabled is true + # and the other parameters are set - they pass as expected. + describe 'rabbitmq-quorum_membership_reconciliation_enabled true options' do + let(:params) do + { + quorum_membership_reconciliation_enabled: true, + quorum_membership_reconciliation_auto_remove: true, + quorum_membership_reconciliation_interval: 36_000, + quorum_membership_reconciliation_trigger_interval: 3600, + quorum_membership_reconciliation_target_group_size: 2 + } end - end - describe 'rabbitmq-quorum_membership_reconciliation_target_group_size 4 options' do - let(:params) { { quorum_membership_reconciliation_target_group_size: 4 } } - - it 'sets quorum_membership_reconciliation_target_group_size parameter 4 in config file' do + it 'sets quorum_membership_reconciliation_enabled parameter true in config file' do is_expected.to contain_file('rabbitmq.config'). \ - with_content(%r{\{quorum_membership_reconciliation_target_group_size, 4\}}) + with_content(%r{\{quorum_membership_reconciliation_enabled, true\}}). \ + with_content(%r{\{quorum_membership_reconciliation_auto_remove, true\}}). \ + with_content(%r{\{quorum_membership_reconciliation_interval, 36000\}}). \ + with_content(%r{\{quorum_membership_reconciliation_trigger_interval, 3600\}}). \ + with_content(%r{\{quorum_membership_reconciliation_target_group_size, 2\}}) end end diff --git a/templates/rabbitmq.config.epp b/templates/rabbitmq.config.epp index 52ac55276..c470b4ced 100644 --- a/templates/rabbitmq.config.epp +++ b/templates/rabbitmq.config.epp @@ -26,9 +26,8 @@ <%- } -%> {cluster_partition_handling, <%= $rabbitmq::config::cluster_partition_handling %>}, <% } -%> -<% unless $rabbitmq::config::quorum_membership_reconciliation_enabled =~ Undef {-%> +<% if $rabbitmq::config::quorum_membership_reconciliation_enabled {-%> {quorum_membership_reconciliation_enabled, <%= $rabbitmq::config::quorum_membership_reconciliation_enabled %>}, -<% } -%> <% unless $rabbitmq::config::quorum_membership_reconciliation_auto_remove =~ Undef {-%> {quorum_membership_reconciliation_auto_remove, <%= $rabbitmq::config::quorum_membership_reconciliation_auto_remove %>}, <% } -%> @@ -40,6 +39,7 @@ <% } -%> <% unless $rabbitmq::config::quorum_membership_reconciliation_target_group_size =~ Undef {-%> {quorum_membership_reconciliation_target_group_size, <%= $rabbitmq::config::quorum_membership_reconciliation_target_group_size %>}, +<% } -%> <% } -%> {tcp_listen_options, [ <%- unless $rabbitmq::config::config_ranch {-%> From e4ff3823931031a291a86f21041d572c0907bc2a Mon Sep 17 00:00:00 2001 From: Jason Lang Date: Mon, 16 Dec 2024 22:05:47 +0000 Subject: [PATCH 4/5] additional fixes and tweaks per github conversation! --- REFERENCE.md | 20 ++++++------------ manifests/init.pp | 20 ++++++------------ spec/classes/rabbitmq_spec.rb | 40 ++++++++++++++++------------------- 3 files changed, 32 insertions(+), 48 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index edcb27b5f..04ad69c2e 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -808,8 +808,8 @@ Default value: `'python'` Data type: `Optional[Boolean]` -Boolean - Enables or disables continuous membership reconciliation. -This requires RabbitMQ 3.13 or higher. More information on this configuration +Enables or disables continuous membership reconciliation. +This REQUIRES RabbitMQ 3.13 or higher to be set to true. More information on this configuration can be found here: https://www.rabbitmq.com/docs/quorum-queues Default value: `undef` @@ -818,9 +818,8 @@ Default value: `undef` Data type: `Optional[Boolean]` -Boolean - Enables or disables automatic removal of member nodes that are no longer part of the cluster, -but still a member of the quorum queue. This requires RabbitMQ 3.13 or higher. More information on this configuration -can be found here: https://www.rabbitmq.com/docs/quorum-queues +Enables or disables automatic removal of member nodes that are no longer part of the cluster, +but still a member of the quorum queue. Important Note: This only takes affect if quorum_membership_reconciliation_enabled is set to true. Default value: `undef` @@ -829,8 +828,7 @@ Default value: `undef` Data type: `Optional[Integer]` -Integer - The default evaluation interval in milliseconds. This requires RabbitMQ 3.13 or higher. More information on this configuration -can be found here: https://www.rabbitmq.com/docs/quorum-queues +The default evaluation interval in milliseconds. Important Note: This only takes affect if quorum_membership_reconciliation_enabled is set to true. Default value: `undef` @@ -839,11 +837,9 @@ Default value: `undef` Data type: `Optional[Integer]` -Integer - The reconciliation delay in milliseconds, used when a trigger event occurs, +The reconciliation delay in milliseconds, used when a trigger event occurs, for example, a node is added or removed from the cluster or an applicable policy changes. This delay will be applied only once, then the regular interval will be used again. -This requires RabbitMQ 3.13 or higher. More information on this configuration -can be found here: https://www.rabbitmq.com/docs/quorum-queues Important Note: This only takes affect if quorum_membership_reconciliation_enabled is set to true. Default value: `undef` @@ -852,9 +848,7 @@ Default value: `undef` Data type: `Optional[Integer]` -Integer - Controls the target group size for a quorum queue -This requires RabbitMQ 3.13 or higher. More information on this configuration -can be found here: https://www.rabbitmq.com/docs/quorum-queues +Controls the target group size for a quorum queue Important Note: This only takes affect if quorum_membership_reconciliation_enabled is set to true. Default value: `undef` diff --git a/manifests/init.pp b/manifests/init.pp index af272bc61..6254cf404 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -241,29 +241,23 @@ # @param python_package # Name of the package required by rabbitmqadmin. # @param quorum_membership_reconciliation_enabled -# Boolean - Enables or disables continuous membership reconciliation. -# This requires RabbitMQ 3.13 or higher. More information on this configuration +# Enables or disables continuous membership reconciliation. +# This REQUIRES RabbitMQ 3.13 or higher to be set to true. More information on this configuration # can be found here: https://www.rabbitmq.com/docs/quorum-queues # @param quorum_membership_reconciliation_auto_remove -# Boolean - Enables or disables automatic removal of member nodes that are no longer part of the cluster, -# but still a member of the quorum queue. This requires RabbitMQ 3.13 or higher. More information on this configuration -# can be found here: https://www.rabbitmq.com/docs/quorum-queues +# Enables or disables automatic removal of member nodes that are no longer part of the cluster, +# but still a member of the quorum queue. # Important Note: This only takes affect if quorum_membership_reconciliation_enabled is set to true. # @param quorum_membership_reconciliation_interval -# Integer - The default evaluation interval in milliseconds. This requires RabbitMQ 3.13 or higher. More information on this configuration -# can be found here: https://www.rabbitmq.com/docs/quorum-queues +# The default evaluation interval in milliseconds. # Important Note: This only takes affect if quorum_membership_reconciliation_enabled is set to true. # @param quorum_membership_reconciliation_trigger_interval -# Integer - The reconciliation delay in milliseconds, used when a trigger event occurs, +# The reconciliation delay in milliseconds, used when a trigger event occurs, # for example, a node is added or removed from the cluster or an applicable policy changes. # This delay will be applied only once, then the regular interval will be used again. -# This requires RabbitMQ 3.13 or higher. More information on this configuration -# can be found here: https://www.rabbitmq.com/docs/quorum-queues # Important Note: This only takes affect if quorum_membership_reconciliation_enabled is set to true. # @param quorum_membership_reconciliation_target_group_size -# Integer - Controls the target group size for a quorum queue -# This requires RabbitMQ 3.13 or higher. More information on this configuration -# can be found here: https://www.rabbitmq.com/docs/quorum-queues +# Controls the target group size for a quorum queue # Important Note: This only takes affect if quorum_membership_reconciliation_enabled is set to true. # @param repos_ensure # Ensure that a repo with the official (and newer) RabbitMQ package is configured, along with its signing key. diff --git a/spec/classes/rabbitmq_spec.rb b/spec/classes/rabbitmq_spec.rb index 11eceb70b..9273b7f9a 100644 --- a/spec/classes/rabbitmq_spec.rb +++ b/spec/classes/rabbitmq_spec.rb @@ -1801,12 +1801,12 @@ let(:params) { { quorum_membership_reconciliation_enabled: :undef } } it 'sets quorum_membership_reconciliation_enabled parameter undef in config file' do - is_expected.not_to contain_file('rabbitmq.config'). \ - with_content(%r{\{quorum_membership_reconciliation_enabled, .*\}}). \ - with_content(%r{\{quorum_membership_reconciliation_auto_remove, .*\}}). \ - with_content(%r{\{quorum_membership_reconciliation_interval, .*\}}). \ - with_content(%r{\{quorum_membership_reconciliation_trigger_interval, .*\}}). \ - with_content(%r{\{quorum_membership_reconciliation_target_group_size, .*\}}) + is_expected.to contain_file('rabbitmq.config'). \ + without_content(%r{\{quorum_membership_reconciliation_enabled, }). \ + without_content(%r{\{quorum_membership_reconciliation_auto_remove, }). \ + without_content(%r{\{quorum_membership_reconciliation_interval, }). \ + without_content(%r{\{quorum_membership_reconciliation_trigger_interval, }). \ + without_content(%r{\{quorum_membership_reconciliation_target_group_size, }) end end @@ -1817,12 +1817,12 @@ let(:params) { { quorum_membership_reconciliation_enabled: false } } it 'sets quorum_membership_reconciliation_enabled parameter false in config file' do - is_expected.not_to contain_file('rabbitmq.config'). \ - with_content(%r{\{quorum_membership_reconciliation_enabled, .*\}}). \ - with_content(%r{\{quorum_membership_reconciliation_auto_remove, .*\}}). \ - with_content(%r{\{quorum_membership_reconciliation_interval, .*\}}). \ - with_content(%r{\{quorum_membership_reconciliation_trigger_interval, .*\}}). \ - with_content(%r{\{quorum_membership_reconciliation_target_group_size, .*\}}) + is_expected.to contain_file('rabbitmq.config'). \ + without_content(%r{\{quorum_membership_reconciliation_enabled, }). \ + without_content(%r{\{quorum_membership_reconciliation_auto_remove, }). \ + without_content(%r{\{quorum_membership_reconciliation_interval, }). \ + without_content(%r{\{quorum_membership_reconciliation_trigger_interval, }). \ + without_content(%r{\{quorum_membership_reconciliation_target_group_size, }) end end @@ -1834,15 +1834,11 @@ it 'sets quorum_membership_reconciliation_enabled parameter true in config file' do is_expected.to contain_file('rabbitmq.config'). \ - with_content(%r{\{quorum_membership_reconciliation_enabled, true\}}) - end - - it 'sets quorum_membership_reconciliation_enabled parameter true in config file ONLY' do - is_expected.not_to contain_file('rabbitmq.config'). \ - with_content(%r{\{quorum_membership_reconciliation_auto_remove, .*\}}). \ - with_content(%r{\{quorum_membership_reconciliation_interval, .*\}}). \ - with_content(%r{\{quorum_membership_reconciliation_trigger_interval, .*\}}). \ - with_content(%r{\{quorum_membership_reconciliation_target_group_size, .*\}}) + with_content(%r{\{quorum_membership_reconciliation_enabled, true\}}). \ + without_content(%r{\{quorum_membership_reconciliation_auto_remove, }). \ + without_content(%r{\{quorum_membership_reconciliation_interval, }). \ + without_content(%r{\{quorum_membership_reconciliation_trigger_interval, }). \ + without_content(%r{\{quorum_membership_reconciliation_target_group_size, }) end end @@ -1854,7 +1850,7 @@ quorum_membership_reconciliation_enabled: true, quorum_membership_reconciliation_auto_remove: true, quorum_membership_reconciliation_interval: 36_000, - quorum_membership_reconciliation_trigger_interval: 3600, + quorum_membership_reconciliation_trigger_interval: 3_600, quorum_membership_reconciliation_target_group_size: 2 } end From 539e45f4c7150ecbf1e2bda062bf6cda7354b1d0 Mon Sep 17 00:00:00 2001 From: Jason Lang Date: Mon, 16 Dec 2024 22:10:46 +0000 Subject: [PATCH 5/5] fix indents of epp markup --- templates/rabbitmq.config.epp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/templates/rabbitmq.config.epp b/templates/rabbitmq.config.epp index c470b4ced..7f93431e9 100644 --- a/templates/rabbitmq.config.epp +++ b/templates/rabbitmq.config.epp @@ -28,18 +28,18 @@ <% } -%> <% if $rabbitmq::config::quorum_membership_reconciliation_enabled {-%> {quorum_membership_reconciliation_enabled, <%= $rabbitmq::config::quorum_membership_reconciliation_enabled %>}, -<% unless $rabbitmq::config::quorum_membership_reconciliation_auto_remove =~ Undef {-%> + <%- unless $rabbitmq::config::quorum_membership_reconciliation_auto_remove =~ Undef {-%> {quorum_membership_reconciliation_auto_remove, <%= $rabbitmq::config::quorum_membership_reconciliation_auto_remove %>}, -<% } -%> -<% unless $rabbitmq::config::quorum_membership_reconciliation_interval =~ Undef {-%> + <%- } -%> + <%- unless $rabbitmq::config::quorum_membership_reconciliation_interval =~ Undef {-%> {quorum_membership_reconciliation_interval, <%= $rabbitmq::config::quorum_membership_reconciliation_interval %>}, -<% } -%> -<% unless $rabbitmq::config::quorum_membership_reconciliation_trigger_interval =~ Undef {-%> + <%- } -%> + <%- unless $rabbitmq::config::quorum_membership_reconciliation_trigger_interval =~ Undef {-%> {quorum_membership_reconciliation_trigger_interval, <%= $rabbitmq::config::quorum_membership_reconciliation_trigger_interval %>}, -<% } -%> -<% unless $rabbitmq::config::quorum_membership_reconciliation_target_group_size =~ Undef {-%> + <%- } -%> + <%- unless $rabbitmq::config::quorum_membership_reconciliation_target_group_size =~ Undef {-%> {quorum_membership_reconciliation_target_group_size, <%= $rabbitmq::config::quorum_membership_reconciliation_target_group_size %>}, -<% } -%> + <%- } -%> <% } -%> {tcp_listen_options, [ <%- unless $rabbitmq::config::config_ranch {-%>