X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Facceptance%2Fapt_ppa_spec.rb;h=60e6d4d4b2e605f8fc3859bdaa5b6021b31d89c2;hb=d0b8ed8f64e413b4d33eaa6b9ce06dd197f1e9b1;hp=f9369802431a18c86feb27a6d794187946ab182a;hpb=16e57d4e4525b83d865db71f3bba300c54467255;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/spec/acceptance/apt_ppa_spec.rb b/spec/acceptance/apt_ppa_spec.rb index f936980..60e6d4d 100644 --- a/spec/acceptance/apt_ppa_spec.rb +++ b/spec/acceptance/apt_ppa_spec.rb @@ -1,61 +1,20 @@ require 'spec_helper_acceptance' -describe 'apt::ppa' do +if fact('operatingsystem') == 'Ubuntu' + describe 'apt::ppa' do - context 'reset' do - it 'removes ppa' do - shell('rm /etc/apt/sources.list.d/canonical-kernel-team-ppa-*', :acceptable_exit_codes => [0,1,2]) - shell('rm /etc/apt/sources.list.d/raravena80-collectd5-*', :acceptable_exit_codes => [0,1,2]) - end - end - - context 'adding a ppa that doesnt exist' do - it 'should work with no errors' do - pp = <<-EOS - include '::apt' - apt::ppa { 'ppa:canonical-kernel-team/ppa': } - 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]) + context 'reset' do + it 'removes ppa' do + shell('rm /etc/apt/sources.list.d/canonical-kernel-team-ppa-*', :acceptable_exit_codes => [0,1,2]) + shell('rm /etc/apt/sources.list.d/raravena80-collectd5-*', :acceptable_exit_codes => [0,1,2]) end end - end - - context 'readding a removed ppa.' do - it 'setup' do - shell('add-apt-repository -y ppa:raravena80/collectd5') - # This leaves a blank file - shell('add-apt-repository --remove ppa:raravena80/collectd5') - end - - it 'should readd it successfully' do - pp = <<-EOS - include '::apt' - apt::ppa { 'ppa:raravena80/collectd5': } - EOS - - apply_manifest(pp, :catch_failures => true) - end - end - - context 'reset' do - it 'removes added ppas' do - shell('rm /etc/apt/sources.list.d/canonical-kernel-team-ppa-*') - shell('rm /etc/apt/sources.list.d/raravena80-collectd5-*') - end - end - context 'ensure' do - context 'present' do - it 'works without failure' do + context 'adding a ppa that doesnt exist' do + it 'should work with no errors' do pp = <<-EOS include '::apt' - apt::ppa { 'ppa:canonical-kernel-team/ppa': ensure => present } + apt::ppa { 'ppa:canonical-kernel-team/ppa': } EOS apply_manifest(pp, :catch_failures => true) @@ -67,72 +26,75 @@ describe 'apt::ppa' do end end end - end - context 'ensure' do - context 'absent' do - it 'works without failure' do + context 'reading a removed ppa.' do + it 'setup' do + # This leaves a blank file + shell('echo > /etc/apt/sources.list.d/raravena80-collectd5-$(lsb_release -c -s).list') + end + + it 'should read it successfully' do pp = <<-EOS include '::apt' - apt::ppa { 'ppa:canonical-kernel-team/ppa': ensure => absent } + apt::ppa { 'ppa:raravena80/collectd5': } EOS apply_manifest(pp, :catch_failures => true) end + 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 + context 'reset' do + it 'removes added ppas' do + shell('rm /etc/apt/sources.list.d/canonical-kernel-team-ppa-*') + shell('rm /etc/apt/sources.list.d/raravena80-collectd5-*') 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 - 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 'release' do + context 'precise' do + it 'works without failure' do + pp = <<-EOS + include '::apt' + apt::ppa { 'ppa:canonical-kernel-team/ppa': + release => precise, + } + 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 - describe file('/etc/apt/sources.list.d/canonical-kernel-team-ppa-precise.list') do - it { should be_file } + describe file('/etc/apt/sources.list.d/canonical-kernel-team-ppa-precise.list') do + it { should be_file } + end end end - end - - context 'options' do - context '-y' do - it 'works without failure' do - pp = <<-EOS - include '::apt' - apt::ppa { 'ppa:canonical-kernel-team/ppa': - ensure => present, - 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) + 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 + + describe file('/etc/apt/sources.list.d/canonical-kernel-team-ppa-precise.list') do + it { should be_file } + end + end end - describe file('/etc/apt/sources.list.d/canonical-kernel-team-ppa-precise.list') do - it { should be_file } + 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 - - context 'reset' do - it { shell('rm -rf /etc/apt/sources.list.d/canonical-kernel-team-ppa*', :acceptable_exit_codes => [0,1,2]) } - end - end