Skip to content

Commit

Permalink
Merge pull request #476 from bastelfreak/tests
Browse files Browse the repository at this point in the history
Add acceptance tests for system php with extensions
  • Loading branch information
sandra-thieme authored Sep 15, 2018
2 parents 9634ea1 + 6de085e commit 781b427
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
13 changes: 10 additions & 3 deletions manifests/extension.pp
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,16 @@
}

$_settings.each |$settings_name, $settings_hash| {
$so_name = $multifile_settings ? {
true => downcase($settings_name),
false => pick(downcase($so_name), downcase($name), downcase($settings_name)),
if $so_name {
$so_name = $multifile_settings ? {
true => downcase($settings_name),
false => pick(downcase($so_name), downcase($name), downcase($settings_name)),
}
} else {
$so_name = $multifile_settings ? {
true => downcase($settings_name),
false => pick(downcase($name), downcase($settings_name)),
}
}

php::extension::config { $settings_name:
Expand Down
38 changes: 38 additions & 0 deletions spec/acceptance/php_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,44 @@
it { is_expected.to be_installed }
end

describe service(packagename) do
it { is_expected.to be_running }
it { is_expected.to be_enabled }
end
end
context 'default parameters with extensions' do
it 'works with defaults' do
pp = <<-EOS
class{'php':
extensions => {
'mysql' => {},
'gd' => {}
}
}
EOS
# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end

case default[:platform]
when %r{ubuntu-18.04}
packagename = 'php7.2-fpm'
when %r{ubuntu-16.04}
packagename = 'php7.0-fpm'
when %r{ubuntu-14.04}
packagename = 'php5-fpm'
when %r{el}
packagename = 'php-fpm'
when %r{debian-8}
packagename = 'php5-fpm'
when %r{debian-9}
packagename = 'php7.0-fpm'
end
describe package(packagename) do
it { is_expected.to be_installed }
end

describe service(packagename) do
it { is_expected.to be_running }
it { is_expected.to be_enabled }
Expand Down

0 comments on commit 781b427

Please sign in to comment.