
The $source_defaults parameter only has meaning if $source_hash is also set, otherwise create_resources will not create any resources. Without this patch, the rspec-puppet tests for the source_defaults parameter only tested the values of the apt::source resources that were not created with create_resources and were therefore not using the $source_defaults. The tests were passing because the default value of the include_src parameter for apt::source is true, but the $source_defaults parameter was never exercised. This patch corrects those tests to actually use a $source_hash parameter and test user-provided resources, not the default ones. Change-Id: Ib6d17869f915171787c4f79679f5731edd3341de
133 lines
4.2 KiB
Ruby
133 lines
4.2 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe 'openstack_extras::repo::debian::ubuntu' do
|
|
let :class_params do
|
|
{
|
|
:manage_uca => 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 => 'Ubuntu',
|
|
:lsbdistid => 'Ubuntu',
|
|
:lsbdistcodename => 'trusty'
|
|
}
|
|
end
|
|
|
|
describe 'with default parameters' do
|
|
let :params do
|
|
{}.merge!(default_params)
|
|
end
|
|
|
|
it { should contain_apt__source('ubuntu-cloud-archive').with(
|
|
:location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
|
|
:release => 'trusty-updates/kilo',
|
|
:repos => 'main',
|
|
)}
|
|
|
|
it { should contain_exec('installing ubuntu-cloud-keyring') }
|
|
|
|
end
|
|
|
|
describe 'with overridden release' do
|
|
let :params do
|
|
default_params.merge!({ :release => 'juno' })
|
|
end
|
|
|
|
it { should contain_apt__source('ubuntu-cloud-archive').with(
|
|
:location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
|
|
:release => 'trusty-updates/juno',
|
|
:repos => 'main',
|
|
)}
|
|
|
|
it { should contain_exec('installing ubuntu-cloud-keyring') }
|
|
end
|
|
|
|
describe 'when not managing UCA' do
|
|
let :params do
|
|
default_params.merge!({ :manage_uca => false })
|
|
end
|
|
|
|
it { should_not contain_exec('installing ubuntu-cloud-keyring') }
|
|
end
|
|
|
|
describe 'with overridden source hash' do
|
|
let :params do
|
|
default_params.merge!({ :source_hash => {
|
|
'local_mirror' => {
|
|
'location' => 'http://mymirror/ubuntu/',
|
|
'repos' => 'main',
|
|
'release' => 'trusty'
|
|
},
|
|
'puppetlabs' => {
|
|
'location' => 'http://apt.puppetlabs.com',
|
|
'repos' => 'main',
|
|
'release' => 'trusty',
|
|
'key' => '4BD6EC30',
|
|
'key_server' => 'pgp.mit.edu'
|
|
}
|
|
}
|
|
})
|
|
end
|
|
|
|
it { should contain_apt__source('local_mirror').with(
|
|
:location => 'http://mymirror/ubuntu/',
|
|
:release => 'trusty',
|
|
:repos => 'main'
|
|
)}
|
|
|
|
it { should contain_apt__source('puppetlabs').with(
|
|
:location => 'http://apt.puppetlabs.com',
|
|
:release => 'trusty',
|
|
:repos => 'main',
|
|
:key => '4BD6EC30',
|
|
:key_server => 'pgp.mit.edu'
|
|
)}
|
|
|
|
it { should contain_exec('installing ubuntu-cloud-keyring') }
|
|
end
|
|
|
|
describe 'with overridden source default' do
|
|
let :params do
|
|
default_params.merge!({ :source_hash => {
|
|
'local_mirror' => {
|
|
'location' => 'http://mymirror/ubuntu/',
|
|
'repos' => 'main',
|
|
'release' => 'trusty'
|
|
}
|
|
}
|
|
})
|
|
default_params.merge!({ :source_defaults => {
|
|
'include_src' => 'true'
|
|
}
|
|
})
|
|
end
|
|
|
|
it { should contain_apt__source('local_mirror').with(
|
|
:include_src => 'true',
|
|
:location => 'http://mymirror/ubuntu/',
|
|
:release => 'trusty',
|
|
:repos => 'main',
|
|
)}
|
|
|
|
it { should contain_exec('installing ubuntu-cloud-keyring') }
|
|
end
|
|
end
|
|
end
|