Skip to content

Commit c91991b

Browse files
committed
fph::pool: add unit test
Signed-off-by: Simon Deziel <[email protected]>
1 parent 283b9ae commit c91991b

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

spec/classes/php_spec.rb

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,46 @@
239239
it { is_expected.to contain_file(dstfile).with_content(%r{group = nginx}) }
240240
end
241241

242+
describe 'when configured with a pool with apparmor_hat parameter' do
243+
let(:params) { { fpm_pools: { 'www' => { 'apparmor_hat' => 'www' } } } }
244+
245+
it { is_expected.to contain_php__fpm__pool('www').with(apparmor_hat: 'www') }
246+
247+
dstfile = case facts[:osfamily]
248+
when 'Debian'
249+
case facts[:os]['name']
250+
when 'Debian'
251+
case facts[:os]['release']['major']
252+
when '10'
253+
'/etc/php/7.3/fpm/pool.d/www.conf'
254+
when '9'
255+
'/etc/php/7.0/fpm/pool.d/www.conf'
256+
else
257+
'/etc/php5/fpm/pool.d/www.conf'
258+
end
259+
when 'Ubuntu'
260+
case facts[:os]['release']['major']
261+
when '18.04'
262+
'/etc/php/7.2/fpm/pool.d/www.conf'
263+
when '16.04'
264+
'/etc/php/7.0/fpm/pool.d/www.conf'
265+
else
266+
'/etc/php5/fpm/pool.d/www.conf'
267+
end
268+
end
269+
when 'Archlinux'
270+
'/etc/php/php-fpm.d/www.conf'
271+
when 'Suse'
272+
'/etc/php5/fpm/pool.d/www.conf'
273+
when 'RedHat'
274+
'/etc/php-fpm.d/www.conf'
275+
when 'FreeBSD'
276+
'/usr/local/etc/php-fpm.d/www.conf'
277+
end
278+
279+
it { is_expected.to contain_file(dstfile).with_content(%r{apparmor_hat = www}) }
280+
end
281+
242282
describe 'when fpm is disabled' do
243283
let(:params) { { fpm: false } }
244284

0 commit comments

Comments
 (0)