X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Facceptance%2Fapt_ppa_spec.rb;h=b665c5cf477a84a5d74590163ebe7ae1d6a0dc35;hb=a68eca58a658e432fbfffcd91862134082ac7dc0;hp=60e6d4d4b2e605f8fc3859bdaa5b6021b31d89c2;hpb=b7b4153e9144051c175b3993112cb31bb416be92;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/spec/acceptance/apt_ppa_spec.rb b/spec/acceptance/apt_ppa_spec.rb index 60e6d4d..b665c5c 100644 --- a/spec/acceptance/apt_ppa_spec.rb +++ b/spec/acceptance/apt_ppa_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper_acceptance' if fact('operatingsystem') == 'Ubuntu' - describe 'apt::ppa' do + describe 'apt::ppa', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do context 'reset' do it 'removes ppa' do @@ -50,12 +50,51 @@ if fact('operatingsystem') == 'Ubuntu' end end + context 'ensure' do + context 'present' do + it 'works without failure' do + pp = <<-EOS + include '::apt' + apt::ppa { 'ppa:canonical-kernel-team/ppa': ensure => present } + EOS + + apply_manifest(pp, :catch_failures => true) + end + + describe 'contains the source file' do + it 'contains a kernel ppa source' do + shell('ls /etc/apt/sources.list.d/canonical-kernel-team-ppa-*', :acceptable_exit_codes => [0]) + end + end + end + end + + context 'ensure' do + context 'absent' do + it 'works without failure' do + pp = <<-EOS + include '::apt' + apt::ppa { 'ppa:canonical-kernel-team/ppa': ensure => absent } + EOS + + apply_manifest(pp, :catch_failures => true) + end + + describe 'doesnt contain the source file' do + it 'fails' do + shell('ls /etc/apt/sources.list.d/canonical-kernel-team-ppa-*', :acceptable_exit_codes => [2]) + end + end + end + end + context 'release' do context 'precise' do it 'works without failure' do pp = <<-EOS include '::apt' apt::ppa { 'ppa:canonical-kernel-team/ppa': + ensure => present, release => precise, } EOS @@ -70,31 +109,30 @@ if fact('operatingsystem') == 'Ubuntu' end end - if ! default[:platform].match(/10\.04/) - context 'options' do - context '-y' do - it 'works without failure' do - pp = <<-EOS - include '::apt' - apt::ppa { 'ppa:canonical-kernel-team/ppa': - release => precise, - options => '-y', - } - EOS - - shell('rm -rf /etc/apt/sources.list.d/canonical-kernel-team-ppa*', :acceptable_exit_codes => [0,1,2]) - apply_manifest(pp, :catch_failures => true) - end + context 'options' do + context '-y', :unless => default[:platform].match(/10\.04/) do + it 'works without failure' do + pp = <<-EOS + include '::apt' + apt::ppa { 'ppa:canonical-kernel-team/ppa': + ensure => present, + release => precise, + options => '-y', + } + EOS - describe file('/etc/apt/sources.list.d/canonical-kernel-team-ppa-precise.list') do - it { should be_file } - end + shell('rm -rf /etc/apt/sources.list.d/canonical-kernel-team-ppa*', :acceptable_exit_codes => [0,1,2]) + apply_manifest(pp, :catch_failures => true) end - end - context 'reset' do - it { shell('rm -rf /etc/apt/sources.list.d/canonical-kernel-team-ppa*', :acceptable_exit_codes => [0,1,2]) } + describe file('/etc/apt/sources.list.d/canonical-kernel-team-ppa-precise.list') do + it { should be_file } + end end end + + context 'reset' do + it { shell('rm -rf /etc/apt/sources.list.d/canonical-kernel-team-ppa*', :acceptable_exit_codes => [0,1,2]) } + end end end