Merge pull request #472 from mhaskel/acceptance_test_fixes

Acceptance test fixes
This commit is contained in:
Daniele Sluijters 2015-03-19 10:16:15 +01:00
commit ff51f714ab
4 changed files with 30 additions and 24 deletions

View file

@ -149,8 +149,8 @@ Puppet::Type.type(:apt_key).provide(:apt_key) do
# Breaking up the command like this is needed because it blows up
# if --recv-keys isn't the last argument.
command.push('adv', '--keyserver', resource[:server])
unless resource[:keyserver_options].nil?
command.push('--keyserver-options', resource[:keyserver_options])
unless resource[:options].nil?
command.push('--keyserver-options', resource[:options])
end
command.push('--recv-keys', resource[:id])
elsif resource[:content]

View file

@ -58,7 +58,7 @@ Puppet::Type.newtype(:apt_key) do
newparam(:server) do
desc 'The key server to fetch the key from based on the ID. It can either be a domain name or url.'
defaultto :'keyserver.ubuntu.com'
newvalues(/\A((hkp|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,5})?$/)
end

View file

@ -488,14 +488,14 @@ ugVIB2pi+8u84f+an4Hml4xlyijgYu05pqNvnLRyJDLd61hviLC8GYU=
end
end
describe 'keyserver_options =>' do
describe 'options =>' do
context 'debug' do
it 'works' do
pp = <<-EOS
apt_key { 'puppetlabs':
id => '#{PUPPETLABS_GPG_KEY_LONG_ID}',
ensure => 'present',
keyserver_options => 'debug',
id => '#{PUPPETLABS_GPG_KEY_LONG_ID}',
ensure => 'present',
options => 'debug',
}
EOS
@ -507,9 +507,9 @@ ugVIB2pi+8u84f+an4Hml4xlyijgYu05pqNvnLRyJDLd61hviLC8GYU=
it 'fails on invalid options' do
pp = <<-EOS
apt_key { 'puppetlabs':
id => '#{PUPPETLABS_GPG_KEY_LONG_ID}',
ensure => 'present',
keyserver_options => 'this is totally bonkers',
id => '#{PUPPETLABS_GPG_KEY_LONG_ID}',
ensure => 'present',
options => 'this is totally bonkers',
}
EOS

View file

@ -12,21 +12,27 @@ describe 'apt class' do
it 'should work with no errors' do
pp = <<-EOS
class { 'apt':
always_apt_update => true,
purge_sources_list => true,
purge_sources_list_d => true,
purge_preferences => true,
purge_preferences_d => true,
update_timeout => '400',
update_tries => '3',
sources => {
update => {
'frequency' => 'always',
'timeout' => '400',
'tries' => '3',
},
purge => {
'sources.list' => true,
'sources.list.d' => true,
'preferences' => true,
'preferences.d' => true,
},
sources => {
'puppetlabs' => {
'ensure' => present,
'location' => 'http://apt.puppetlabs.com',
'repos' => 'main',
'key' => '4BD6EC30',
'key_server' => 'pgp.mit.edu',
}
'ensure' => present,
'location' => 'http://apt.puppetlabs.com',
'repos' => 'main',
'key' => {
'id' => '4BD6EC30',
'server' => 'pgp.mit.edu',
},
},
},
}
EOS