X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Facceptance%2Fapt_spec.rb;h=60def0e1544cd6ff86bc982bd36f6e25dc8d5b3d;hb=71ebb94283618ca99faf9c3fd9d65557f2d774d6;hp=775139145ec8b575543210ebb7b5e3f4e6782359;hpb=f6816c6bb3ec29594c792c1bac05d264c99fcdfd;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/spec/acceptance/apt_spec.rb b/spec/acceptance/apt_spec.rb index 7751391..60def0e 100644 --- a/spec/acceptance/apt_spec.rb +++ b/spec/acceptance/apt_spec.rb @@ -75,10 +75,13 @@ describe 'apt class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily') apply_manifest(pp, :catch_failures => true) end - describe file('/etc/apt/apt.conf.d/proxy') do + describe file('/etc/apt/apt.conf.d/01proxy') do it { should be_file } it { should contain 'Acquire::http::Proxy "http://localhost:7042\";' } end + describe file('/etc/apt/apt.conf.d/proxy') do + it { should_not be_file } + end end context 'purge_sources' do @@ -117,10 +120,13 @@ describe 'apt class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily') apply_manifest(pp, :catch_failures => true) end - describe file('/etc/apt/apt.conf.d/proxy') do + describe file('/etc/apt/apt.conf.d/01proxy') do it { should be_file } it { should contain 'Acquire::http::Proxy "http://localhost:7042\";' } end + describe file('/etc/apt/apt.conf.d/proxy') do + it { should_not be_file } + end end context 'purge_sources' do @@ -175,6 +181,47 @@ describe 'apt class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily') end end + context 'purge_preferences' do + context 'false' do + it 'creates a preferences file' do + shell("echo 'original' > /etc/apt/preferences") + end + + it 'should work with no errors' do + pp = <<-EOS + class { 'apt': purge_preferences => false } + EOS + + apply_manifest(pp, :catch_failures => true) + end + + describe file('/etc/apt/preferences') do + it { should be_file } + it 'is not managed by Puppet' do + shell("grep 'original' /etc/apt/preferences", {:acceptable_exit_codes => 0}) + end + end + end + + context 'true' do + it 'creates a preferences file' do + shell('touch /etc/apt/preferences') + end + + it 'should work with no errors' do + pp = <<-EOS + class { 'apt': purge_preferences => true } + EOS + + apply_manifest(pp, :catch_failures => true) + end + + describe file('/etc/apt/preferences') do + it { should_not be_file } + end + end + end + context 'purge_preferences_d' do context 'false' do it 'creates a preferences file' do @@ -224,6 +271,34 @@ describe 'apt class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily') end end + context 'fancy_progress => true' do + it 'should work with no errors' do + pp = <<-EOS + class { 'apt': fancy_progress => true } + EOS + + apply_manifest(pp, :catch_failures => true) + end + + describe file('/etc/apt/apt.conf.d/99progressbar') do + it { should be_file } + it { should contain 'Dpkg::Progress-Fancy "1";' } + end + end + context 'fancy_progress => false' do + it 'should work with no errors' do + pp = <<-EOS + class { 'apt': fancy_progress => false } + EOS + + apply_manifest(pp, :catch_failures => true) + end + + describe file('/etc/apt/apt.conf.d/99progressbar') do + it { should_not be_file } + end + end + context 'reset' do it 'fixes the sources.list' do shell('cp /tmp/sources.list /etc/apt')