Merge pull request #938 from mdklapwijk-forks/support-acng-ssl
[puppet-modules/puppetlabs-apt.git] / spec / acceptance / apt_spec.rb
1 require 'spec_helper_acceptance'
2
3 everything_everything_pp = <<-MANIFEST
4       $sources = {
5         'puppetlabs' => {
6           'ensure'   => present,
7           'location' => 'http://apt.puppetlabs.com',
8           'repos'    => 'main',
9           'key'      => {
10             'id'     => '6F6B15509CF8E59E6E469F327F438280EF8D349F',
11             'server' => 'pool.sks-keyservers.net',
12           },
13         },
14       }
15       class { 'apt':
16         update => {
17           'frequency' => 'always',
18           'timeout'   => 400,
19           'tries'     => 3,
20         },
21         purge => {
22           'sources.list'   => true,
23           'sources.list.d' => true,
24           'preferences'    => true,
25           'preferences.d'  => true,
26           'apt.conf.d'     => true,
27         },
28         sources => $sources,
29       }
30   MANIFEST
31
32 describe 'apt class' do
33   context 'with reset' do
34     it 'fixes the sources.list' do
35       run_shell('cp /etc/apt/sources.list /tmp')
36     end
37   end
38
39   context 'with all the things' do
40     it 'works with no errors' do
41       # Apply the manifest (Retry if timeout error is received from key pool)
42       retry_on_error_matching do
43         apply_manifest(everything_everything_pp, catch_failures: true)
44       end
45     end
46     it 'stills work' do
47       run_shell('apt-get update')
48       run_shell('apt-get -y --force-yes upgrade')
49     end
50   end
51
52   context 'with reset' do
53     it 'fixes the sources.list' do
54       run_shell('cp /tmp/sources.list /etc/apt')
55     end
56   end
57 end