Project

General

Profile

« Previous | Next » 

Revision 79a01ae1

Added by Ewoud Kohl van Wijngaarden over 5 years ago

Refactor extras repo handling

This drops support for EL6 by only having the URL for the EL6 GPG key.

It also allows setting the package state of foreman-release-scl.

View differences:

spec/classes/foreman_repos_extra_spec.rb
require 'spec_helper'
describe 'foreman::repos::extra' do
on_os_under_test.each do |os, facts|
context "on #{os}" do
context "on #{os}", if: facts[:osfamily] == 'RedHat' do
let :facts do facts end
describe 'when repos are fully enabled' do
case facts[:osfamily]
when 'RedHat'
if facts[:operatingsystem] != 'Fedora'
let(:params) do
{
:configure_scl_repo => true,
:configure_epel_repo => true,
}
end
let(:params) do
{
configure_scl_repo: true,
configure_epel_repo: true,
}
end
let(:gpgkey) do
case facts[:operatingsystemmajrelease]
when '6'
'0608B895'
when '7'
'352C64E5'
end
end
it do
is_expected.to contain_yumrepo('epel')
.with_mirrorlist("https://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:operatingsystemmajrelease]}&arch=$basearch")
.with_gpgcheck(1)
.with_gpgkey('https://fedoraproject.org/static/352C64E5.txt')
end
it { is_expected.to contain_package('foreman-release-scl').with_ensure('installed') }
end
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
describe 'when scl repo set to latest' do
let(:params) do
{
configure_scl_repo: true,
configure_epel_repo: true,
scl_repo_ensure: 'latest',
}
end
it { is_expected.to contain_package('foreman-release-scl').with_ensure('latest') }
end
describe 'when fully disabled' do
let(:params) do
{
:configure_scl_repo => false,
:configure_epel_repo => false,
configure_scl_repo: false,
configure_epel_repo: false,
}
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) }
it { is_expected.to_not contain_yumrepo('epel') }
it { is_expected.to_not contain_package('foreman-release-scl') }
end
end
end

Also available in: Unified diff