puppet-openstack_extras/spec/classes/openstack_extras_repo_debian_debian_spec.rb
Emilien Macchi 6feda8b3e9 repo/apt: update to support apt 2.1.0 module
This patcha affects how we use puppetlabs-apt on Debian & Ubuntu
systems.

It:
* Drops 'required_packages' deprecated parameter
* Installs UCA keyring package *before* adding the new repo and run
  apt-get update
* For backward compatibility when package_require is True, make sure to
  not run `apt-get update` before the Package resource when manage_uca
  is True; because it would lead to a Circular issue.

Change-Id: I772d9929bcc379a7d1515a7a76658811720897dd
Closes-bug: #1468761
2015-06-25 10:46:09 -04:00

142 lines
4.3 KiB
Ruby

require 'spec_helper'
describe 'openstack_extras::repo::debian::debian' do
let :class_params do
{
:manage_whz => true,
:source_hash => {},
:source_defaults => {},
:package_require => false
}
end
let :paramclass_defaults do
{
:release => 'kilo'
}
end
let :default_params do
class_params.merge!(paramclass_defaults)
end
context 'on Debian platforms' do
let :facts do
{
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:lsbdistid => 'Debian'
}
end
describe 'with default parameters' do
let :params do
{}.merge!(default_params)
end
it { should contain_apt__source('debian_wheezy').with(
:location => 'http://archive.gplhost.com/debian',
:release => 'kilo',
:repos => 'main',
)}
it { should contain_apt__source('debian_wheezy_backports').with(
:location => 'http://archive.gplhost.com/debian',
:release => 'kilo-backports',
:repos => 'main'
)}
it { should contain_package('gplhost-archive-keyring') }
end
describe 'with overridden release' do
let :params do
default_params.merge!({ :release => 'juno' })
end
it { should contain_apt__source('debian_wheezy').with(
:location => 'http://archive.gplhost.com/debian',
:release => 'juno',
:repos => 'main',
)}
it { should contain_apt__source('debian_wheezy_backports').with(
:location => 'http://archive.gplhost.com/debian',
:release => 'juno-backports',
:repos => 'main'
)}
it { should contain_package('gplhost-archive-keyring') }
end
describe 'when not managing wheezy repo' do
let :params do
default_params.merge!({ :manage_whz => false })
end
it { should_not contain_package('gplhost-archive-keyring') }
end
describe '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' => 'wheezy',
'key' => '4BD6EC30',
'key_server' => 'pgp.mit.edu'
}
}
})
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 => 'wheezy',
:key => '4BD6EC30',
:key_server => 'pgp.mit.edu'
)}
it { should contain_package('gplhost-archive-keyring') }
end
describe 'with overridden source default' do
let :params do
default_params.merge!({ :source_defaults => {
'include_src' => 'true'
}
})
end
it { should contain_apt__source('debian_wheezy').with(
:location => 'http://archive.gplhost.com/debian',
:release => 'kilo',
:repos => 'main',
:include_src => 'true'
)}
it { should contain_apt__source('debian_wheezy_backports').with(
:location => 'http://archive.gplhost.com/debian',
:release => 'kilo-backports',
:repos => 'main',
:include_src => 'true'
)}
it { should contain_package('gplhost-archive-keyring') }
end
end
end