2014-01-07 01:53:19 +01:00
|
|
|
require 'spec_helper_acceptance'
|
|
|
|
|
2014-01-10 00:26:32 +01:00
|
|
|
codename = fact('lsbdistcodename')
|
|
|
|
case fact('operatingsystem')
|
|
|
|
when 'Ubuntu'
|
|
|
|
repos = 'main universe multiverse restricted'
|
|
|
|
when 'Debian'
|
|
|
|
repos = 'main contrib non-free'
|
|
|
|
end
|
|
|
|
|
2014-01-07 01:53:19 +01:00
|
|
|
describe 'apt::backports class' do
|
|
|
|
context 'defaults' do
|
|
|
|
it 'should work with no errors' do
|
|
|
|
pp = <<-EOS
|
|
|
|
class { 'apt::backports': }
|
|
|
|
EOS
|
|
|
|
|
|
|
|
apply_manifest(pp, :catch_failures => true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'release' do
|
|
|
|
it 'should work with no errors' do
|
|
|
|
pp = <<-EOS
|
2014-01-10 00:26:32 +01:00
|
|
|
class { 'apt::backports': release => '#{codename}' }
|
2014-01-07 01:53:19 +01:00
|
|
|
EOS
|
|
|
|
|
|
|
|
apply_manifest(pp, :catch_failures => true)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe file('/etc/apt/sources.list.d/backports.list') do
|
|
|
|
it { should be_file }
|
2014-01-10 00:26:32 +01:00
|
|
|
it { should contain "#{codename}-backports #{repos}" }
|
2014-01-07 01:53:19 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'location' do
|
|
|
|
it 'should work with no errors' do
|
|
|
|
pp = <<-EOS
|
|
|
|
class { 'apt::backports': release => 'precise', location => 'http://localhost/ubuntu' }
|
|
|
|
EOS
|
|
|
|
|
|
|
|
apply_manifest(pp, :catch_failures => true)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe file('/etc/apt/sources.list.d/backports.list') do
|
|
|
|
it { should be_file }
|
2014-01-10 00:26:32 +01:00
|
|
|
it { should contain "deb http://localhost/ubuntu precise-backports #{repos}" }
|
2014-01-07 01:53:19 +01:00
|
|
|
end
|
|
|
|
end
|
2014-01-09 20:26:59 +01:00
|
|
|
|
|
|
|
context 'reset' do
|
|
|
|
it 'deletes backport files' do
|
|
|
|
shell('rm -rf /etc/apt/sources.list.d/backports.list')
|
|
|
|
shell('rm -rf /etc/apt/preferences.d/backports.pref')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-01-07 01:53:19 +01:00
|
|
|
end
|