|
9 | 9 | os_facts
|
10 | 10 | end
|
11 | 11 |
|
12 |
| - name = case os_facts[:os]['family'] |
| 12 | + name = case os_facts['os']['family'] |
13 | 13 | when 'Archlinux', 'OpenBSD', 'FreeBSD'
|
14 | 14 | 'rabbitmq'
|
15 | 15 | else
|
16 | 16 | 'rabbitmq-server'
|
17 | 17 | end
|
18 | 18 |
|
19 |
| - rabbitmq_home = case os_facts[:os]['family'] |
| 19 | + rabbitmq_home = case os_facts['os']['family'] |
20 | 20 | when 'FreeBSD'
|
21 | 21 | '/var/db/rabbitmq'
|
22 | 22 | else
|
|
30 | 30 |
|
31 | 31 | it { is_expected.to contain_package(name).with_ensure('installed').with_name(name) }
|
32 | 32 |
|
33 |
| - it { is_expected.to contain_package('rabbitmq-server-plugins') } if os_facts[:os]['family'] == 'Suse' |
| 33 | + it { is_expected.to contain_package('rabbitmq-server-plugins') } if os_facts['os']['family'] == 'Suse' |
34 | 34 |
|
35 | 35 | context 'with default params' do
|
36 | 36 | it { is_expected.not_to contain_class('rabbitmq::repo::apt') }
|
|
48 | 48 | context 'with repos_ensure => true' do
|
49 | 49 | let(:params) { { repos_ensure: true } }
|
50 | 50 |
|
51 |
| - if os_facts[:os]['family'] == 'Debian' |
| 51 | + if os_facts['os']['family'] == 'Debian' |
52 | 52 | it 'includes rabbitmq::repo::apt' do
|
53 | 53 | is_expected.to contain_class('rabbitmq::repo::apt').
|
54 | 54 | with_key_source('https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey').
|
|
58 | 58 | it 'adds a repo with default values' do
|
59 | 59 | is_expected.to contain_apt__source('rabbitmq').
|
60 | 60 | with_ensure('present').
|
61 |
| - with_location("https://packagecloud.io/rabbitmq/rabbitmq-server/#{os_facts[:os]['name'].downcase}"). |
| 61 | + with_location("https://packagecloud.io/rabbitmq/rabbitmq-server/#{os_facts['os']['name'].downcase}"). |
62 | 62 | with_release(nil).
|
63 | 63 | with_repos('main')
|
64 | 64 | end
|
|
67 | 67 | it { is_expected.not_to contain_apt__souce('rabbitmq') }
|
68 | 68 | end
|
69 | 69 |
|
70 |
| - if os_facts[:os]['family'] == 'RedHat' |
| 70 | + if os_facts['os']['family'] == 'RedHat' |
71 | 71 | it { is_expected.to contain_class('rabbitmq::repo::rhel') }
|
72 | 72 |
|
73 | 73 | it 'the repo should be present, and contain the expected values' do
|
|
82 | 82 | end
|
83 | 83 | end
|
84 | 84 |
|
85 |
| - context 'with no pin', if: os_facts[:os]['family'] == 'Debian' do |
| 85 | + context 'with no pin', if: os_facts['os']['family'] == 'Debian' do |
86 | 86 | let(:params) { { repos_ensure: true, package_apt_pin: '' } }
|
87 | 87 |
|
88 | 88 | describe 'it sets up an apt::source' do
|
89 | 89 | it {
|
90 | 90 | is_expected.to contain_apt__source('rabbitmq').with(
|
91 |
| - 'location' => "https://packagecloud.io/rabbitmq/rabbitmq-server/#{os_facts[:os]['name'].downcase}", |
| 91 | + 'location' => "https://packagecloud.io/rabbitmq/rabbitmq-server/#{os_facts['os']['name'].downcase}", |
92 | 92 | 'repos' => 'main',
|
93 | 93 | 'key' => '{"id"=>"8C695B0219AFDEB04A058ED8F4E789204D206F89", "source"=>"https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey", "content"=>nil}'
|
94 | 94 | )
|
95 | 95 | }
|
96 | 96 | end
|
97 | 97 | end
|
98 | 98 |
|
99 |
| - context 'with pin', if: os_facts[:os]['family'] == 'Debian' do |
| 99 | + context 'with pin', if: os_facts['os']['family'] == 'Debian' do |
100 | 100 | let(:params) { { repos_ensure: true, package_apt_pin: '700' } }
|
101 | 101 |
|
102 | 102 | describe 'it sets up an apt::source and pin' do
|
103 | 103 | it {
|
104 | 104 | is_expected.to contain_apt__source('rabbitmq').with(
|
105 |
| - 'location' => "https://packagecloud.io/rabbitmq/rabbitmq-server/#{os_facts[:os]['name'].downcase}", |
| 105 | + 'location' => "https://packagecloud.io/rabbitmq/rabbitmq-server/#{os_facts['os']['name'].downcase}", |
106 | 106 | 'repos' => 'main',
|
107 | 107 | 'key' => '{"id"=>"8C695B0219AFDEB04A058ED8F4E789204D206F89", "source"=>"https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey", "content"=>nil}'
|
108 | 108 | )
|
|
122 | 122 | context "with file_limit => '#{value}'", if: os_facts['kernel'] == 'Linux' do
|
123 | 123 | let(:params) { { file_limit: value } }
|
124 | 124 |
|
125 |
| - selinux_ignore_defaults = os_facts[:os]['family'] == 'RedHat' |
| 125 | + selinux_ignore_defaults = os_facts['os']['family'] == 'RedHat' |
126 | 126 |
|
127 | 127 | it do
|
128 | 128 | is_expected.to contain_systemd__manage_dropin('service-90-limits.conf').
|
|
143 | 143 | end
|
144 | 144 |
|
145 | 145 | [-1000, 0, 1000].each do |value|
|
146 |
| - context "with oom_score_adj => '#{value}'", if: os_facts[:kernel] == 'Linux' do |
| 146 | + context "with oom_score_adj => '#{value}'", if: os_facts['kernel'] == 'Linux' do |
147 | 147 | let(:params) { { oom_score_adj: value } }
|
148 | 148 |
|
149 | 149 | it { is_expected.to contain_systemd__manage_dropin('service-90-limits.conf').with_service_entry({ 'LimitNOFILE' => 16_384, 'OOMScoreAdjust' => value }) }
|
|
160 | 160 | end
|
161 | 161 | end
|
162 | 162 |
|
163 |
| - context 'on Linux', if: os_facts[:kernel] == 'Linux' do |
| 163 | + context 'on Linux', if: os_facts['kernel'] == 'Linux' do |
164 | 164 | it { is_expected.to contain_systemd__manage_dropin('service-90-limits.conf') }
|
165 | 165 | end
|
166 | 166 |
|
167 |
| - context 'on non-Linux', unless: os_facts[:kernel] == 'Linux' do |
| 167 | + context 'on non-Linux', unless: os_facts['kernel'] == 'Linux' do |
168 | 168 | it { is_expected.not_to contain_systemd__manage_dropin('service-90-limits.conf') }
|
169 | 169 | end
|
170 | 170 |
|
|
190 | 190 | is_expected.to contain_archive('rabbitmqadmin').with_source('http://1.1.1.1:15672/cli/rabbitmqadmin')
|
191 | 191 | end
|
192 | 192 |
|
193 |
| - it { is_expected.to contain_package('python') } if %w[RedHat SUSE Archlinux].include?(os_facts[:os]['family']) |
194 |
| - it { is_expected.to contain_package('python3') } if %w[Debian].include?(os_facts[:os]['family']) |
195 |
| - it { is_expected.to contain_package('python38') } if %w[FreeBSD].include?(os_facts[:os]['family']) |
| 193 | + it { is_expected.to contain_package('python') } if %w[RedHat SUSE Archlinux].include?(os_facts['os']['family']) |
| 194 | + it { is_expected.to contain_package('python3') } if %w[Debian].include?(os_facts['os']['family']) |
| 195 | + it { is_expected.to contain_package('python38') } if %w[FreeBSD].include?(os_facts['os']['family']) |
196 | 196 | end
|
197 | 197 |
|
198 | 198 | context 'with manage_python false' do
|
|
205 | 205 | end
|
206 | 206 | end
|
207 | 207 |
|
208 |
| - context 'with $management_ip_address undef and service_manage set to true', unless: os_facts[:os]['family'] == 'Archlinux' do |
| 208 | + context 'with $management_ip_address undef and service_manage set to true', unless: os_facts['os']['family'] == 'Archlinux' do |
209 | 209 | let(:params) { { admin_enable: true, management_ip_address: :undef } }
|
210 | 210 |
|
211 | 211 | it 'we enable the admin interface by default' do
|
|
217 | 217 | end
|
218 | 218 | end
|
219 | 219 |
|
220 |
| - context 'with service_manage set to true, node_ip_address = undef, and default user/pass specified', unless: os_facts[:os]['family'] == 'Archlinux' do |
| 220 | + context 'with service_manage set to true, node_ip_address = undef, and default user/pass specified', unless: os_facts['os']['family'] == 'Archlinux' do |
221 | 221 | let(:params) { { admin_enable: true, default_user: 'foobar', default_pass: 'hunter2', node_ip_address: :undef } }
|
222 | 222 |
|
223 | 223 | it 'we use the correct URL to rabbitmqadmin' do
|
|
229 | 229 | end
|
230 | 230 | end
|
231 | 231 |
|
232 |
| - context 'with service_manage set to true and default user/pass specified', unless: os_facts[:os]['family'] == 'Archlinux' do |
| 232 | + context 'with service_manage set to true and default user/pass specified', unless: os_facts['os']['family'] == 'Archlinux' do |
233 | 233 | let(:params) { { admin_enable: true, default_user: 'foobar', default_pass: 'hunter2', management_ip_address: '1.1.1.1' } }
|
234 | 234 |
|
235 | 235 | it 'we use the correct URL to rabbitmqadmin' do
|
|
241 | 241 | end
|
242 | 242 | end
|
243 | 243 |
|
244 |
| - context 'with service_manage set to true and archive_options set', unless: os_facts[:os]['family'] == 'Archlinux' do |
| 244 | + context 'with service_manage set to true and archive_options set', unless: os_facts['os']['family'] == 'Archlinux' do |
245 | 245 | let(:params) do
|
246 | 246 | {
|
247 | 247 | admin_enable: true,
|
|
258 | 258 | end
|
259 | 259 | end
|
260 | 260 |
|
261 |
| - context 'with service_manage set to true and management port specified', unless: os_facts[:os]['family'] == 'Archlinux' do |
| 261 | + context 'with service_manage set to true and management port specified', unless: os_facts['os']['family'] == 'Archlinux' do |
262 | 262 | # NOTE: that the 2.x management port is 55672 not 15672
|
263 | 263 | let(:params) { { admin_enable: true, management_port: 55_672, management_ip_address: '1.1.1.1' } }
|
264 | 264 |
|
|
271 | 271 | end
|
272 | 272 | end
|
273 | 273 |
|
274 |
| - context 'with ipv6, service_manage set to true and management port specified', unless: os_facts[:os]['family'] == 'Archlinux' do |
| 274 | + context 'with ipv6, service_manage set to true and management port specified', unless: os_facts['os']['family'] == 'Archlinux' do |
275 | 275 | # NOTE: that the 2.x management port is 55672 not 15672
|
276 | 276 | let(:params) { { admin_enable: true, management_port: 55_672, management_ip_address: '::1' } }
|
277 | 277 |
|
|
476 | 476 | describe 'rabbitmq-env configuration' do
|
477 | 477 | context 'with default params' do
|
478 | 478 | it 'sets environment variables' do
|
479 |
| - if %w[FreeBSD OpenBSD].include?(os_facts[:os]['family']) |
| 479 | + if %w[FreeBSD OpenBSD].include?(os_facts['os']['family']) |
480 | 480 | is_expected.to contain_file('rabbitmq-env.config'). \
|
481 | 481 | with_content(%r{ERL_INETRC=/usr/local/etc/rabbitmq/inetrc})
|
482 | 482 | else
|
|
0 commit comments