and an acceptance test
[puppet-modules/puppetlabs-apt.git] / spec / acceptance / apt_spec.rb
1 require 'spec_helper_acceptance'
2
3 describe 'apt class' do
4
5   context 'reset' do
6     it 'fixes the sources.list' do
7       shell('cp /etc/apt/sources.list /tmp')
8     end
9   end
10
11   context 'all the things' do
12     it 'should work with no errors' do
13       pp = <<-EOS
14       class { 'apt':
15         always_apt_update    => true,
16         purge_sources_list   => true,
17         purge_sources_list_d => true,
18         purge_preferences    => true,
19         purge_preferences_d  => true,
20         update_timeout       => '400',
21         update_tries         => '3',
22         sources              => {
23           'puppetlabs' => {
24             'ensure'     => present,
25             'location'   => 'http://apt.puppetlabs.com',
26             'repos'      => 'main',
27             'key'        => '4BD6EC30',
28             'key_server' => 'pgp.mit.edu',
29           }
30         },
31       }
32       EOS
33
34       apply_manifest(pp, :catch_failures => true)
35       apply_manifest(pp, :catch_failures => true)
36     end
37     it 'should still work' do
38       shell('apt-get update')
39       shell('apt-get -y --force-yes upgrade')
40     end
41   end
42
43   context 'reset' do
44     it 'fixes the sources.list' do
45       shell('cp /tmp/sources.list /etc/apt')
46     end
47   end
48
49 end