Revision b969c150
Added by Mickaël Canévet over 9 years ago
spec/classes/foreman_install_repos_extra_spec.rb | ||
---|---|---|
require 'spec_helper'
|
||
|
||
describe 'foreman::install::repos::extra' do
|
||
describe 'when EL repos are fully enabled' do
|
||
let(:params) do
|
||
{
|
||
:configure_scl_repo => true,
|
||
:configure_epel_repo => true,
|
||
}
|
||
end
|
||
|
||
context 'RHEL 6' do
|
||
let :facts do
|
||
{
|
||
:operatingsystem => 'RedHat',
|
||
:operatingsystemrelease => '6.4',
|
||
:osfamily => 'RedHat',
|
||
}
|
||
on_supported_os.each do |os, facts|
|
||
context "on #{os}" do
|
||
let(:facts) do
|
||
facts.merge({
|
||
:concat_basedir => '/tmp',
|
||
})
|
||
end
|
||
|
||
it { should contain_yumrepo('epel').with({
|
||
:mirrorlist => 'https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch',
|
||
:gpgcheck => 1,
|
||
:gpgkey => 'https://fedoraproject.org/static/0608B895.txt',
|
||
}) }
|
||
it { should contain_package('foreman-release-scl') }
|
||
end
|
||
|
||
context 'RHEL 7' do
|
||
let :facts do
|
||
{
|
||
:operatingsystem => 'RedHat',
|
||
:operatingsystemrelease => '7.0',
|
||
:osfamily => 'RedHat',
|
||
}
|
||
end
|
||
describe 'when repos are fully enabled' do
|
||
case facts[:osfamily]
|
||
when 'Debian'
|
||
if facts[:operatingsystem] == 'Ubuntu'
|
||
let(:params) do
|
||
{
|
||
:configure_brightbox_repo => true,
|
||
}
|
||
end
|
||
|
||
it { should contain_yumrepo('epel').with({
|
||
:mirrorlist => 'https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch',
|
||
:gpgcheck => 1,
|
||
:gpgkey => 'https://fedoraproject.org/static/352C64E5.txt',
|
||
}) }
|
||
it { should contain_package('foreman-release-scl') }
|
||
end
|
||
end
|
||
it { should contain_class('apt') }
|
||
it { should contain_apt__ppa('ppa:brightbox/ruby-ng') }
|
||
it { should contain_alternatives('ruby') }
|
||
it { should contain_alternatives('gem') }
|
||
end
|
||
when 'RedHat'
|
||
if facts[:operatingsystem] != 'Fedora'
|
||
let(:params) do
|
||
{
|
||
:configure_scl_repo => true,
|
||
:configure_epel_repo => true,
|
||
}
|
||
end
|
||
|
||
describe 'when deb repos are fully enabled' do
|
||
let(:params) do
|
||
{
|
||
:configure_brightbox_repo => true,
|
||
}
|
||
end
|
||
let(:gpgkey) do
|
||
case facts[:operatingsystemmajrelease]
|
||
when '6'
|
||
'0608B895'
|
||
when '7'
|
||
'352C64E5'
|
||
end
|
||
end
|
||
|
||
context 'Ubuntu' do
|
||
let :facts do
|
||
{
|
||
:lsbdistid => 'ubuntu',
|
||
:lsbdistcodename => 'precise',
|
||
:operatingsystem => 'Ubuntu',
|
||
:operatingsystemrelease => '12.04',
|
||
:osfamily => 'Debian',
|
||
}
|
||
it { should contain_yumrepo('epel').with({
|
||
:mirrorlist => "https://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:operatingsystemmajrelease]}&arch=$basearch",
|
||
:gpgcheck => 1,
|
||
:gpgkey => "https://fedoraproject.org/static/#{gpgkey}.txt",
|
||
}) }
|
||
it { should contain_package('foreman-release-scl') }
|
||
end
|
||
end
|
||
end
|
||
|
||
it { should contain_class('apt') }
|
||
it { should contain_apt__ppa('ppa:brightbox/ruby-ng') }
|
||
it { should contain_alternatives('ruby') }
|
||
it { should contain_alternatives('gem') }
|
||
end
|
||
end
|
||
|
||
describe 'when fully disabled' do
|
||
let(:params) do
|
||
{
|
||
:configure_scl_repo => false,
|
||
:configure_epel_repo => false,
|
||
:configure_brightbox_repo => false,
|
||
}
|
||
end
|
||
describe 'when fully disabled' do
|
||
let(:params) do
|
||
{
|
||
:configure_scl_repo => false,
|
||
:configure_epel_repo => false,
|
||
:configure_brightbox_repo => false,
|
||
}
|
||
end
|
||
|
||
context 'RHEL 6' do
|
||
let :facts do
|
||
{
|
||
:operatingsystem => 'RedHat',
|
||
:operatingsystemrelease => '6.4',
|
||
:osfamily => 'RedHat',
|
||
}
|
||
it { should_not contain_yumrepo('epel') }
|
||
it { should_not contain_package('foreman-release-scl') }
|
||
it { should_not contain_class('apt') }
|
||
it { should have_apt__ppa_resource_count(0) }
|
||
end
|
||
|
||
it { should_not contain_yumrepo('epel') }
|
||
it { should_not contain_package('foreman-release-scl') }
|
||
it { should_not contain_class('apt') }
|
||
it { should have_apt__ppa_resource_count(0) }
|
||
end
|
||
end
|
||
end
|
Also available in: Unified diff
Use rspec-puppet-facts