2014-01-06 23:39:48 +01:00
|
|
|
require 'spec_helper_acceptance'
|
2013-10-02 18:42:56 +02:00
|
|
|
|
2014-01-10 00:26:32 +01:00
|
|
|
if fact('operatingsystem') == 'Ubuntu'
|
2014-02-24 22:52:13 +01:00
|
|
|
describe 'apt::ppa', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
|
2013-10-02 18:42:56 +02:00
|
|
|
|
2014-01-10 00:26:32 +01:00
|
|
|
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])
|
2013-10-02 18:42:56 +02:00
|
|
|
end
|
|
|
|
end
|
2013-10-02 19:56:06 +02:00
|
|
|
|
2014-01-10 00:26:32 +01:00
|
|
|
context 'adding a ppa that doesnt exist' do
|
|
|
|
it 'should work with no errors' do
|
2014-01-07 01:53:19 +01:00
|
|
|
pp = <<-EOS
|
|
|
|
include '::apt'
|
2014-01-10 00:26:32 +01:00
|
|
|
apt::ppa { 'ppa:canonical-kernel-team/ppa': }
|
2014-01-07 01:53:19 +01:00
|
|
|
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
|
|
|
|
|
2014-02-21 01:43:48 +01:00
|
|
|
context 'reading a removed ppa.' do
|
2014-01-10 00:26:32 +01:00
|
|
|
it 'setup' do
|
|
|
|
# This leaves a blank file
|
2014-02-21 01:43:48 +01:00
|
|
|
shell('echo > /etc/apt/sources.list.d/raravena80-collectd5-$(lsb_release -c -s).list')
|
2014-01-10 00:26:32 +01:00
|
|
|
end
|
|
|
|
|
2014-02-21 01:43:48 +01:00
|
|
|
it 'should read it successfully' do
|
2014-01-07 01:53:19 +01:00
|
|
|
pp = <<-EOS
|
|
|
|
include '::apt'
|
2014-01-10 00:26:32 +01:00
|
|
|
apt::ppa { 'ppa:raravena80/collectd5': }
|
2014-01-07 01:53:19 +01:00
|
|
|
EOS
|
|
|
|
|
|
|
|
apply_manifest(pp, :catch_failures => true)
|
|
|
|
end
|
2014-01-10 00:26:32 +01:00
|
|
|
end
|
2014-01-07 01:53:19 +01:00
|
|
|
|
2014-01-10 00:26:32 +01:00
|
|
|
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-*')
|
2014-01-07 01:53:19 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-02-14 23:49:43 +01:00
|
|
|
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
|
|
|
|
|
2014-01-10 00:26:32 +01:00
|
|
|
context 'release' do
|
|
|
|
context 'precise' do
|
|
|
|
it 'works without failure' do
|
|
|
|
pp = <<-EOS
|
|
|
|
include '::apt'
|
|
|
|
apt::ppa { 'ppa:canonical-kernel-team/ppa':
|
2014-02-14 23:49:43 +01:00
|
|
|
ensure => present,
|
2014-01-10 00:26:32 +01:00
|
|
|
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
|
2014-01-07 01:53:19 +01:00
|
|
|
|
2014-01-10 00:26:32 +01:00
|
|
|
describe file('/etc/apt/sources.list.d/canonical-kernel-team-ppa-precise.list') do
|
|
|
|
it { should be_file }
|
|
|
|
end
|
2014-01-07 01:53:19 +01:00
|
|
|
end
|
2014-01-10 00:26:32 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'options' do
|
2014-02-21 20:45:21 +01:00
|
|
|
context '-y', :unless => default[:platform].match(/10\.04/) do
|
2014-01-10 00:26:32 +01:00
|
|
|
it 'works without failure' do
|
|
|
|
pp = <<-EOS
|
|
|
|
include '::apt'
|
|
|
|
apt::ppa { 'ppa:canonical-kernel-team/ppa':
|
2014-02-14 23:49:43 +01:00
|
|
|
ensure => present,
|
2014-01-10 00:26:32 +01:00
|
|
|
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
|
2014-01-07 01:53:19 +01:00
|
|
|
|
2014-01-10 00:26:32 +01:00
|
|
|
describe file('/etc/apt/sources.list.d/canonical-kernel-team-ppa-precise.list') do
|
|
|
|
it { should be_file }
|
|
|
|
end
|
2014-01-07 01:53:19 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-01-10 00:26:32 +01:00
|
|
|
context 'reset' do
|
|
|
|
it { shell('rm -rf /etc/apt/sources.list.d/canonical-kernel-team-ppa*', :acceptable_exit_codes => [0,1,2]) }
|
|
|
|
end
|
|
|
|
end
|
2013-10-02 18:42:56 +02:00
|
|
|
end
|