Skip to content

Commit

Permalink
php on el9 requires different inspec tests and fix opensuse
Browse files Browse the repository at this point in the history
Signed-off-by: Mike van Goor <[email protected]>
  • Loading branch information
mvangoor committed Jul 31, 2024
1 parent fe36c83 commit f457199
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 43 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
- debian-12
- fedora-latest
- opensuse-leap-15
- oraclelinux-8
- oraclelinux-9
- rockylinux-8
- rockylinux-9
- ubuntu-2004
Expand All @@ -39,16 +41,16 @@ jobs:
- basic-site
- default
- mod-auth-cas
- mod-php
- php
- module-template
- mod-wsgi
- ports
- ssl
- install-override
exclude:
# TODO: disabled due to https://github.com/chef/chef/pull/13691
- os: amazonlinux-2023
suite: mod-wsgi
# TODO: disabled due to https://github.com/chef/chef/pull/13691
- os: opensuse-leap-15
suite: mod-wsgi
steps:
Expand Down
9 changes: 5 additions & 4 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@ platforms:
- name: almalinux-8
- name: almalinux-9
- name: amazonlinux-2023
- name: centos-stream-8
- name: centos-stream-9
- name: debian-10
- name: debian-11
- name: debian-12
- name: fedora-latest
- name: opensuse-leap-15
- name: oraclelinux-8
- name: oraclelinux-9
- name: rockylinux-8
- name: rockylinux-9
- name: ubuntu-18.04
- name: ubuntu-20.04
- name: ubuntu-22.04
- name: ubuntu-24.04

suites:
- name: default
Expand All @@ -47,7 +48,7 @@ suites:
- name: module_template
run_list:
- recipe[test::module_template]
- name: mod_php
- name: php
run_list:
- recipe[test::php]
- name: mod_wsgi
Expand Down
2 changes: 1 addition & 1 deletion test/integration/mod_auth_cas/controls/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

httpd_command =
case os.family
when 'fedora', 'amazon'
when 'fedora', 'amazon', 'suse'
'httpd -M'
when 'redhat'
os.release.to_i >= 9 ? 'httpd -M' : 'apachectl -M'
Expand Down
35 changes: 0 additions & 35 deletions test/integration/mod_php/controls/default.rb

This file was deleted.

69 changes: 69 additions & 0 deletions test/integration/php/controls/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
include_controls 'apache2-default' do
skip_control 'welcome-page'
end

httpd_command =
case os.family
when 'fedora', 'amazon', 'suse'
'httpd -M'
when 'redhat'
os.release.to_i >= 9 ? 'httpd -M' : 'apachectl -M'
else
'apachectl -M'
end

control 'PHP module enabled & running' do
impact 1
desc 'php module should be enabled with config'

if os['family'] == 'redhat' && os['release'].to_i >= 9
describe command httpd_command do
its('stdout') { should match(/proxy_fcgi/) }
end
else
describe command httpd_command do
its('stdout') { should match(/php/) }
end
end

case os['family']
when 'debian', 'suse'
describe file('/etc/apache2/mods-available/php.conf') do
it { should exist }
its('content') { should match %r{SetHandler application/x-httpd-php} }
end
when 'freebsd'
describe file('/usr/local/etc/apache24/mods-available/php.conf') do
it { should exist }
its('content') { should match %r{SetHandler application/x-httpd-php} }
end
when 'redhat'
if os['release'].to_i >= 9
describe service('php-fpm') do
it { should be_installed }
it { should be_enabled }
it { should be_running }
end

describe file('/etc/httpd/conf-available/custom_php_pool.conf') do
it { should exist }
its('content') { should match %r{proxy:unix:/var/run/php.*-fpm.sock|fcgi://localhost} }
end
else
describe file('/etc/httpd/mods-available/php.conf') do
it { should exist }
its('content') { should match %r{SetHandler application/x-httpd-php} }
end
end
else
describe file('/etc/httpd/mods-available/php.conf') do
it { should exist }
its('content') { should match %r{SetHandler application/x-httpd-php} }
end
end

describe http('localhost/info.php') do
its('status') { should eq 200 }
its('body') { should match /PHP Version/ }
end
end
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: apache2-mod-php
name: apache2-php
title: Integration tests for apache2 cookbook
summary: This InSpec profile contains integration tests for apache2 cookbook
supports:
Expand Down

0 comments on commit f457199

Please sign in to comment.