1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
|
require 'spec_helper'
describe 'openstack_extras::repo::debian::debian' do
shared_examples 'openstack_extras::repo::debian::debian' do
let :class_params do
{
:manage_deb => true,
:source_hash => {},
:source_defaults => {},
:package_require => false,
:use_extrepo => false,
}
end
let :paramclass_defaults do
{
:release => 'dalmatian'
}
end
let :default_params do
class_params.merge!(paramclass_defaults)
end
context 'with default params' do
it { should contain_exec('/usr/bin/extrepo enable openstack_dalmatian').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
apt-get update
apt-get install -y extrepo
extrepo enable openstack_dalmatian
apt-get update
",
)}
end
context 'wallaby with extrepo' do
let :params do
{
:release => 'wallaby',
:use_extrepo => true,
}
end
it { should contain_exec('/usr/bin/extrepo enable openstack_wallaby').with(
:command => "/bin/true # comment to satisfy puppet syntax requirements
apt-get update
apt-get install -y extrepo
extrepo enable openstack_wallaby
apt-get update
",
)}
end
context 'with extrepo set to false' do
let :params do
{
:use_extrepo => false,
}
end
it { should contain_apt__source('debian-openstack-backports').with(
:location => "http://#{facts[:os]['distro']['codename']}-dalmatian.debian.net/debian",
:release => "#{facts[:os]['distro']['codename']}-dalmatian-backports",
:repos => 'main',
)}
it { should contain_apt__source('debian-openstack-backports-nochange').with(
:location => "http://#{facts[:os]['distro']['codename']}-dalmatian.debian.net/debian",
:release => "#{facts[:os]['distro']['codename']}-dalmatian-backports-nochange",
:repos => 'main'
)}
it { should contain_exec('installing openstack-backports-archive-keyring') }
end
context 'with overridden release' do
let :params do
default_params.merge!({ :release => 'pike' })
end
it { should contain_apt__source('debian-openstack-backports').with(
:location => "http://#{facts[:os]['distro']['codename']}-pike.debian.net/debian",
:release => "#{facts[:os]['distro']['codename']}-pike-backports",
:repos => 'main',
)}
it { should contain_apt__source('debian-openstack-backports-nochange').with(
:location => "http://#{facts[:os]['distro']['codename']}-pike.debian.net/debian",
:release => "#{facts[:os]['distro']['codename']}-pike-backports-nochange",
:repos => 'main'
)}
it { should contain_exec('installing openstack-backports-archive-keyring') }
end
context 'when not managing openstack repo' do
let :params do
default_params.merge!({ :manage_deb => false })
end
it { should_not contain_exec('installing openstack-backports-archive-keyring') }
end
context 'with overridden source hash' do
let :params do
default_params.merge!({
:source_hash => {
'debian_unstable' => {
'location' => 'http://mymirror/debian/',
'repos' => 'main',
'release' => 'unstable'
},
'puppetlabs' => {
'location' => 'http://apt.puppetlabs.com',
'repos' => 'main',
'release' => facts[:os]['distro']['codename'],
'key' => { 'id' => '4BD6EC30', 'server' => 'pgp.mit.edu' }
}
},
:use_extrepo => false
})
end
it { should contain_apt__source('debian_unstable').with(
:location => 'http://mymirror/debian/',
:release => 'unstable',
:repos => 'main',
)}
it { should contain_apt__source('puppetlabs').with(
:location => 'http://apt.puppetlabs.com',
:repos => 'main',
:release => facts[:os]['distro']['codename'],
:key => { 'id' => '4BD6EC30', 'server' => 'pgp.mit.edu' },
)}
it { should contain_exec('installing openstack-backports-archive-keyring') }
end
context 'with overridden source default' do
let :params do
default_params.merge!({
:source_hash => {
'debian_unstable' => {
'location' => 'http://mymirror/debian/',
'repos' => 'main',
'release' => 'unstable'
},
},
:source_defaults => {
'include' => { 'src' => true }
},
:use_extrepo => false
})
end
it { should contain_apt__source('debian_unstable').with(
:include => { 'src' => true },
:location => 'http://mymirror/debian/',
:release => 'unstable',
:repos => 'main',
)}
it { should contain_exec('installing openstack-backports-archive-keyring') }
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
if facts[:os]['name'] == 'Debian'
it_behaves_like 'openstack_extras::repo::debian::debian'
end
end
end
end
|