Skip to content

Commit

Permalink
add needed docs, tests, and fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
LangJV committed Dec 5, 2024
1 parent 6a5c3c1 commit 58680e9
Show file tree
Hide file tree
Showing 4 changed files with 210 additions and 11 deletions.
56 changes: 56 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -799,6 +804,57 @@ Name of the package required by rabbitmqadmin.

Default value: `'python'`

##### <a name="-rabbitmq--quorum_membership_reconciliation_enabled"></a>`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`

##### <a name="-rabbitmq--quorum_membership_reconciliation_auto_remove"></a>`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`

##### <a name="-rabbitmq--quorum_membership_reconciliation_interval"></a>`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`

##### <a name="-rabbitmq--quorum_membership_reconciliation_trigger_interval"></a>`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`

##### <a name="-rabbitmq--quorum_membership_reconciliation_target_group_size"></a>`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`

##### <a name="-rabbitmq--repos_ensure"></a>`repos_ensure`

Data type: `Boolean`
Expand Down
18 changes: 13 additions & 5 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
137 changes: 136 additions & 1 deletion spec/classes/rabbitmq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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') }
Expand Down
10 changes: 5 additions & 5 deletions templates/rabbitmq.config.epp
Original file line number Diff line number Diff line change
Expand Up @@ -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, [
Expand Down

0 comments on commit 58680e9

Please sign in to comment.