Fix source_defaults unit tests
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
This commit is contained in:
parent
f68fc29524
commit
d193b48e4a
|
@ -115,26 +115,27 @@ describe 'openstack_extras::repo::debian::debian' do
|
|||
|
||||
describe 'with overridden source default' do
|
||||
let :params do
|
||||
default_params.merge!({ :source_hash => {
|
||||
'debian_unstable' => {
|
||||
'location' => 'http://mymirror/debian/',
|
||||
'repos' => 'main',
|
||||
'release' => 'unstable'
|
||||
},
|
||||
}
|
||||
})
|
||||
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',
|
||||
it { should contain_apt__source('debian_unstable').with(
|
||||
:location => 'http://mymirror/debian/',
|
||||
:release => 'unstable',
|
||||
: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_exec('installing gplhost-archive-keyring') }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -105,16 +105,24 @@ describe 'openstack_extras::repo::debian::ubuntu' do
|
|||
|
||||
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('ubuntu-cloud-archive').with(
|
||||
it { should contain_apt__source('local_mirror').with(
|
||||
:include_src => 'true',
|
||||
:location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
|
||||
:release => 'trusty-updates/kilo',
|
||||
:location => 'http://mymirror/ubuntu/',
|
||||
:release => 'trusty',
|
||||
:repos => 'main',
|
||||
)}
|
||||
|
||||
|
|
Loading…
Reference in New Issue