module-puppetlabs-apt/spec/acceptance/apt_spec.rb

61 lines
1.4 KiB
Ruby
Raw Normal View History

require 'spec_helper_acceptance'
describe 'apt class' do
context 'reset' do
it 'fixes the sources.list' do
shell('cp /etc/apt/sources.list /tmp')
end
end
context 'all the things' do
it 'should work with no errors' do
pp = <<-EOS
2015-06-17 23:56:22 +02:00
if $::lsbdistcodename == 'lucid' {
$sources = undef
} else {
$sources = {
'puppetlabs' => {
'ensure' => present,
'location' => 'http://apt.puppetlabs.com',
'repos' => 'main',
'key' => {
'id' => '47B320EB4C7C375AA9DAE1A01054B7A24BD6EC30',
'server' => 'pgp.mit.edu',
},
},
}
}
class { 'apt':
2015-03-18 20:56:29 +01:00
update => {
'frequency' => 'always',
'timeout' => '400',
'tries' => '3',
},
purge => {
'sources.list' => true,
'sources.list.d' => true,
'preferences' => true,
'preferences.d' => true,
},
2015-06-17 23:56:22 +02:00
sources => $sources,
}
EOS
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_failures => true)
end
it 'should still work' do
shell('apt-get update')
2014-10-07 01:44:19 +02:00
shell('apt-get -y --force-yes upgrade')
end
end
context 'reset' do
it 'fixes the sources.list' do
shell('cp /tmp/sources.list /etc/apt')
end
end
end