|
1 | 1 | # frozen_string_literal: true |
2 | 2 |
|
3 | | -# rubocop:disable RSpec/RepeatedExampleGroupDescription |
4 | | -# rubocop:disable RSpec/RepeatedExampleGroupBody |
5 | | - |
6 | 3 | require 'spec_helper' |
7 | 4 |
|
8 | 5 | describe 'rabbitmq' do |
|
144 | 141 | it { is_expected.not_to contain_file('/etc/default/rabbitmq-server') } |
145 | 142 | end |
146 | 143 |
|
147 | | - if os_facts[:systemd] |
| 144 | + if os_facts['systemd'] |
148 | 145 | selinux_ignore_defaults = os_facts[:os]['family'] == 'RedHat' |
149 | 146 |
|
150 | 147 | it do |
151 | 148 | is_expected.to contain_systemd__service_limits("#{name}.service"). |
152 | 149 | with_selinux_ignore_defaults(selinux_ignore_defaults). |
153 | | - with_limits('LimitNOFILE' => value). |
| 150 | + with_limits({ 'LimitNOFILE' => value, 'OOMScoreAdjust' => 0 }). |
154 | 151 | with_restart_service(false) |
155 | 152 | end |
156 | 153 | else |
|
179 | 176 | it { is_expected.not_to contain_file('/etc/default/rabbitmq-server') } |
180 | 177 | end |
181 | 178 |
|
182 | | - if os_facts[:systemd] |
| 179 | + if os_facts['systemd'] |
183 | 180 | it do |
184 | 181 | is_expected.to contain_systemd__service_limits("#{name}.service"). |
185 | | - with_limits('OOMScoreAdjust' => value). |
| 182 | + with_limits({ 'LimitNOFILE' => 16_384, 'OOMScoreAdjust' => value }). |
186 | 183 | with_restart_service(false) |
187 | 184 | end |
188 | 185 | else |
|
201 | 198 | end |
202 | 199 | end |
203 | 200 |
|
204 | | - context 'on systems with systemd', if: os_facts[:systemd] do |
| 201 | + context 'on systems with systemd', if: os_facts['systemd'] do |
205 | 202 | it do |
206 | 203 | is_expected.to contain_systemd__service_limits("#{name}.service"). |
207 | 204 | with_restart_service(false) |
208 | 205 | end |
209 | 206 | end |
210 | 207 |
|
211 | | - context 'on systems without systemd', unless: os_facts[:systemd] do |
| 208 | + context 'on systems without systemd', unless: os_facts['systemd'] do |
212 | 209 | it { is_expected.not_to contain_systemd__service_limits("#{name}.service") } |
213 | 210 | end |
214 | 211 |
|
|
1806 | 1803 | end |
1807 | 1804 | end |
1808 | 1805 | end |
1809 | | - |
1810 | | -# rubocop:enable RSpec/RepeatedExampleGroupDescription |
1811 | | -# rubocop:enable RSpec/RepeatedExampleGroupBody |
0 commit comments