1 require 'spec_helper_acceptance'
3 if fact('operatingsystem') == 'Ubuntu'
4 describe 'apt::ppa', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
8 shell('rm /etc/apt/sources.list.d/canonical-kernel-team-ppa-*', :acceptable_exit_codes => [0,1,2])
9 shell('rm /etc/apt/sources.list.d/raravena80-collectd5-*', :acceptable_exit_codes => [0,1,2])
13 context 'adding a ppa that doesnt exist' do
14 it 'should work with no errors' do
17 apt::ppa { 'ppa:canonical-kernel-team/ppa': }
20 apply_manifest(pp, :catch_failures => true)
23 describe 'contains the source file' do
24 it 'contains a kernel ppa source' do
25 shell('ls /etc/apt/sources.list.d/canonical-kernel-team-ppa-*', :acceptable_exit_codes => [0])
30 context 'reading a removed ppa.' do
32 # This leaves a blank file
33 shell('echo > /etc/apt/sources.list.d/raravena80-collectd5-$(lsb_release -c -s).list')
36 it 'should read it successfully' do
39 apt::ppa { 'ppa:raravena80/collectd5': }
42 apply_manifest(pp, :catch_failures => true)
47 it 'removes added ppas' do
48 shell('rm /etc/apt/sources.list.d/canonical-kernel-team-ppa-*')
49 shell('rm /etc/apt/sources.list.d/raravena80-collectd5-*')
55 it 'works without failure' do
58 apt::ppa { 'ppa:canonical-kernel-team/ppa': ensure => present }
61 apply_manifest(pp, :catch_failures => true)
64 describe 'contains the source file' do
65 it 'contains a kernel ppa source' do
66 shell('ls /etc/apt/sources.list.d/canonical-kernel-team-ppa-*', :acceptable_exit_codes => [0])
74 it 'works without failure' do
77 apt::ppa { 'ppa:canonical-kernel-team/ppa': ensure => absent }
80 apply_manifest(pp, :catch_failures => true)
83 describe 'doesnt contain the source file' do
85 shell('ls /etc/apt/sources.list.d/canonical-kernel-team-ppa-*', :acceptable_exit_codes => [2])
93 it 'works without failure' do
96 apt::ppa { 'ppa:canonical-kernel-team/ppa':
102 shell('rm -rf /etc/apt/sources.list.d/canonical-kernel-team-ppa*', :acceptable_exit_codes => [0,1,2])
103 apply_manifest(pp, :catch_failures => true)
106 describe file('/etc/apt/sources.list.d/canonical-kernel-team-ppa-precise.list') do
107 it { should be_file }
113 context '-y', :unless => default[:platform].match(/10\.04/) do
114 it 'works without failure' do
117 apt::ppa { 'ppa:canonical-kernel-team/ppa':
124 shell('rm -rf /etc/apt/sources.list.d/canonical-kernel-team-ppa*', :acceptable_exit_codes => [0,1,2])
125 apply_manifest(pp, :catch_failures => true)
128 describe file('/etc/apt/sources.list.d/canonical-kernel-team-ppa-precise.list') do
129 it { should be_file }
135 it { shell('rm -rf /etc/apt/sources.list.d/canonical-kernel-team-ppa*', :acceptable_exit_codes => [0,1,2]) }