8a1981f640
There were some bugs in the existing $::operatingsystem based approach.
* amazon was it's own package set when it's properly part of $::osfamily ==
'redhat' as of facter >= 1.7.2
* gentoo was improperly part of the amazon package set; this patch removes
support for gentoo but it was broken anyways
modifications to nginx:📦:redhat were made as well
* it no longer tries to setup the nginx.org yumrepo for fedora as no packages
for fedora are currently provided
* amazon release numbers are inconsistent with EL. Unknown
$::lsbmajdistrelease values are now mapped to 6 so it's no longer nessicary to
test for $::lsbmajdistrelease being undefined. This logic will need to be
reworked after RHEL7.x is released.
* the url to the nginx repo was including $::operatingsystem in it but
nginx.org only has package dirs for 'rhel' & 'centos' which are presently
identical; the usage of the 'rhel' dir has been hardcoded. This fixes broken
yum repo setup for all $::osfamily == 'redhat' platforms other than redhat and
centos.
67 lines
2.2 KiB
Ruby
67 lines
2.2 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe 'nginx::package' do
|
|
|
|
shared_examples 'redhat' do |operatingsystem|
|
|
let(:facts) {{ :operatingsystem => operatingsystem, :osfamily => 'RedHat' }}
|
|
it { should contain_package('nginx') }
|
|
it { should contain_package('gd') }
|
|
it { should contain_package('libXpm') }
|
|
it { should contain_package('libxslt') }
|
|
it { should contain_yumrepo('nginx-release').with_enabled('1') }
|
|
end
|
|
|
|
shared_examples 'debian' do |operatingsystem|
|
|
let(:facts) {{ :operatingsystem => operatingsystem, :osfamily => 'Debian'}}
|
|
it { should contain_file('/etc/apt/sources.list.d/nginx.list') }
|
|
end
|
|
|
|
shared_examples 'suse' do |operatingsystem|
|
|
let(:facts) {{ :operatingsystem => operatingsystem, :osfamily => 'Suse'}}
|
|
it { should contain_package('nginx-0.8') }
|
|
it { should contain_package('apache2') }
|
|
it { should contain_package('apache2-itk') }
|
|
it { should contain_package('apache2-utils') }
|
|
it { should contain_package('gd') }
|
|
end
|
|
|
|
|
|
context 'redhat' do
|
|
it_behaves_like 'redhat', 'centos'
|
|
it_behaves_like 'redhat', 'rhel'
|
|
it_behaves_like 'redhat', 'redhat'
|
|
it_behaves_like 'redhat', 'scientific'
|
|
it_behaves_like 'redhat', 'amazon'
|
|
end
|
|
|
|
context 'debian' do
|
|
it_behaves_like 'debian', 'debian'
|
|
it_behaves_like 'debian', 'ubuntu'
|
|
end
|
|
|
|
context 'suse' do
|
|
it_behaves_like 'suse', 'opensuse'
|
|
it_behaves_like 'suse', 'suse'
|
|
end
|
|
|
|
context 'amazon with facter < 1.7.2' do
|
|
let(:facts) {{ :operatingsystem => 'Amazon', :osfamily => 'Linux' }}
|
|
it { should contain_class('nginx::package::redhat') }
|
|
end
|
|
|
|
context 'fedora' do
|
|
# fedora is identical to the rest of osfamily RedHat except for not
|
|
# including nginx-release
|
|
let(:facts) {{ :operatingsystem => 'Fedora', :osfamily => 'RedHat' }}
|
|
it { should contain_package('nginx') }
|
|
it { should contain_package('gd') }
|
|
it { should contain_package('libXpm') }
|
|
it { should contain_package('libxslt') }
|
|
it { should_not contain_yumrepo('nginx-release') }
|
|
end
|
|
|
|
context 'other' do
|
|
let(:facts) {{ :operatingsystem => 'xxx' }}
|
|
it { expect { subject }.to raise_error(Puppet::Error, /Module nginx is not supported on xxx/) }
|
|
end
|
|
end
|