Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify mod::php unit tests #2482

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions spec/classes/mod/php_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,6 @@
end

case facts[:os]['release']['major']
when '9'
context 'on stretch' do
it { is_expected.to contain_apache__mod('php7.0') }
it { is_expected.to contain_package('libapache2-mod-php7.0') }

it {
expect(subject).to contain_file('php7.0.load').with(
content: "LoadModule php7_module /usr/lib/apache2/modules/libphp7.0.so\n",
)
}
end
when '10'
context 'on buster' do
it { is_expected.to contain_apache__mod('php7.3') }
Expand Down Expand Up @@ -290,12 +279,9 @@
end

# all the following tests are for legacy php/apache versions. They don't work on modern ubuntu and redhat 8
next if (facts[:os]['release']['major'].to_i >= 15 && facts[:os]['name'] == 'SLES') ||
(facts[:os]['family'] == 'Debian') ||
(facts[:os]['release']['major'].to_i >= 8 && (facts[:os]['name'] == 'RedHat' || facts[:os]['name'] == 'CentOS' ||
facts[:os]['name'] == 'Rocky' || facts[:os]['name'] == 'AlmaLinux'))

describe 'OS independent tests' do
skip_os = ['Debian', 'RedHat']
describe 'OS independent tests',
unless: skip_os.include?(facts[:os]['family'] && facts[:os]['release']['major'].to_i > 7) || (facts[:os]['release']['major'].to_i >= 15 && facts[:os]['name'] == 'SLES') do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's an interesting hack. Technically you're right that Debian > 7 should be skipped. Though I always find >= 8 easier to read than > 7. Is that just me?

context 'with content param' do
let :params do
{ content: 'somecontent' }
Expand Down