X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Facceptance%2Fapt_spec.rb;h=84b7f88281c1f6b7deda07779220f194ef4f200d;hb=b1a6d0863159d95c51501a56287785183249dce7;hp=4dbb54a0e98163b4ad9aafdeb8ec26366556ec47;hpb=16e57d4e4525b83d865db71f3bba300c54467255;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/spec/acceptance/apt_spec.rb b/spec/acceptance/apt_spec.rb index 4dbb54a..84b7f88 100644 --- a/spec/acceptance/apt_spec.rb +++ b/spec/acceptance/apt_spec.rb @@ -1,6 +1,12 @@ require 'spec_helper_acceptance' -describe 'apt class' do +describe 'apt class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do + + context 'reset' do + it 'fixes the sources.list' do + shell('cp /etc/apt/sources.list /tmp') + end + end context 'always_apt_update => true' do it 'should work with no errors' do @@ -62,7 +68,7 @@ describe 'apt class' do pp = <<-EOS class { 'apt': proxy_host => 'localhost', - proxy_port => '8080', + proxy_port => '7042', } EOS @@ -71,7 +77,7 @@ describe 'apt class' do describe file('/etc/apt/apt.conf.d/proxy') do it { should be_file } - it { should contain 'Acquire::http::Proxy "http://localhost:8080\";' } + it { should contain 'Acquire::http::Proxy "http://localhost:7042\";' } end end @@ -104,7 +110,7 @@ describe 'apt class' do pp = <<-EOS class { 'apt': proxy_host => 'localhost', - proxy_port => '8080', + proxy_port => '7042', } EOS @@ -113,7 +119,7 @@ describe 'apt class' do describe file('/etc/apt/apt.conf.d/proxy') do it { should be_file } - it { should contain 'Acquire::http::Proxy "http://localhost:8080\";' } + it { should contain 'Acquire::http::Proxy "http://localhost:7042\";' } end end @@ -169,6 +175,50 @@ describe 'apt class' do 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 be_file } + it 'is managed by Puppet' do + shell("grep 'Explanation' /etc/apt/preferences", {:acceptable_exit_codes => 0}) + end + end + end + end + context 'purge_preferences_d' do context 'false' do it 'creates a preferences file' do @@ -217,4 +267,11 @@ describe 'apt class' do end end end + + context 'reset' do + it 'fixes the sources.list' do + shell('cp /tmp/sources.list /etc/apt') + end + end + end