Skip to content

Commit

Permalink
fph::pool: add unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Deziel <[email protected]>
  • Loading branch information
simondeziel committed Aug 31, 2020
1 parent 283b9ae commit c91991b
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions spec/classes/php_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,46 @@
it { is_expected.to contain_file(dstfile).with_content(%r{group = nginx}) }
end

describe 'when configured with a pool with apparmor_hat parameter' do
let(:params) { { fpm_pools: { 'www' => { 'apparmor_hat' => 'www' } } } }

it { is_expected.to contain_php__fpm__pool('www').with(apparmor_hat: 'www') }

dstfile = case facts[:osfamily]
when 'Debian'
case facts[:os]['name']
when 'Debian'
case facts[:os]['release']['major']
when '10'
'/etc/php/7.3/fpm/pool.d/www.conf'
when '9'
'/etc/php/7.0/fpm/pool.d/www.conf'
else
'/etc/php5/fpm/pool.d/www.conf'
end
when 'Ubuntu'
case facts[:os]['release']['major']
when '18.04'
'/etc/php/7.2/fpm/pool.d/www.conf'
when '16.04'
'/etc/php/7.0/fpm/pool.d/www.conf'
else
'/etc/php5/fpm/pool.d/www.conf'
end
end
when 'Archlinux'
'/etc/php/php-fpm.d/www.conf'
when 'Suse'
'/etc/php5/fpm/pool.d/www.conf'
when 'RedHat'
'/etc/php-fpm.d/www.conf'
when 'FreeBSD'
'/usr/local/etc/php-fpm.d/www.conf'
end

it { is_expected.to contain_file(dstfile).with_content(%r{apparmor_hat = www}) }
end

describe 'when fpm is disabled' do
let(:params) { { fpm: false } }

Expand Down

0 comments on commit c91991b

Please sign in to comment.