3 describe 'apt::source', :type => :define do
4 GPG_KEY_ID = '6F6B15509CF8E59E6E469F327F438280EF8D349F'
10 context 'mostly defaults' do
13 :os => { :family => 'Debian', :name => 'Debian', :release => { :major => '7', :full => '7.0' }},
14 :lsbdistid => 'Debian',
15 :lsbdistcodename => 'wheezy',
16 :osfamily => 'Debian',
17 :puppetversion => Puppet.version,
23 'include' => { 'deb' => false, 'src' => true },
24 'location' => 'http://debian.mirror.iweb.ca/debian/',
28 it { is_expected.to contain_apt__setting('list-my_source').with_content(/# my_source\ndeb-src http:\/\/debian\.mirror\.iweb\.ca\/debian\/ wheezy main\n/)
32 context 'no defaults' do
35 :os => { :family => 'Debian', :name => 'Debian', :release => { :major => '7', :full => '7.0' }},
36 :lsbdistid => 'Debian',
37 :lsbdistcodename => 'wheezy',
38 :osfamily => 'Debian',
39 :puppetversion => Puppet.version,
45 'location' => 'http://debian.mirror.iweb.ca/debian/',
48 'include' => { 'src' => false },
51 'architecture' => 'x86_64',
52 'allow_unsigned' => true,
56 it { is_expected.to contain_apt__setting('list-my_source').with_content(/# foo\ndeb \[arch=x86_64 trusted=yes\] http:\/\/debian\.mirror\.iweb\.ca\/debian\/ sid testing\n/).without_content(/deb-src/)
59 it { is_expected.to contain_apt__pin('my_source').that_comes_before('Apt::Setting[list-my_source]').with({
60 'ensure' => 'present',
62 'origin' => 'debian.mirror.iweb.ca',
66 it { is_expected.to contain_apt__key("Add key: #{GPG_KEY_ID} from Apt::Source my_source").that_comes_before('Apt::Setting[list-my_source]').with({
67 'ensure' => 'present',
73 context 'allow_unsigned true' do
76 :os => { :family => 'Debian', :name => 'Debian', :release => { :major => '7', :full => '7.0' }},
77 :lsbdistid => 'Debian',
78 :lsbdistcodename => 'wheezy',
79 :osfamily => 'Debian',
80 :puppetversion => Puppet.version,
85 'include' => {'src' => false},
86 'location' => 'http://debian.mirror.iweb.ca/debian/',
87 'allow_unsigned' => true,
91 it { is_expected.to contain_apt__setting('list-my_source').with_content(/# my_source\ndeb \[trusted=yes\] http:\/\/debian\.mirror\.iweb\.ca\/debian\/ wheezy main\n/) }
94 context 'architecture equals x86_64' do
97 :os => { :family => 'Debian', :name => 'Debian', :release => { :major => '7', :full => '7.0' }},
98 :lsbdistid => 'Debian',
99 :lsbdistcodename => 'wheezy',
100 :osfamily => 'Debian',
101 :puppetversion => Puppet.version,
106 'location' => 'http://debian.mirror.iweb.ca/debian/',
107 'architecture' => 'x86_64',
111 it { is_expected.to contain_apt__setting('list-my_source').with_content(/# my_source\ndeb \[arch=x86_64\] http:\/\/debian\.mirror\.iweb\.ca\/debian\/ wheezy main\n/)
115 context 'ensure => absent' do
118 :os => { :family => 'Debian', :name => 'Debian', :release => { :major => '7', :full => '7.0' }},
119 :lsbdistid => 'Debian',
120 :lsbdistcodename => 'wheezy',
121 :osfamily => 'Debian',
122 :puppetversion => Puppet.version,
127 'ensure' => 'absent',
131 it { is_expected.to contain_apt__setting('list-my_source').with({
137 describe 'validation' do
138 context 'no release' do
141 :os => { :family => 'Debian', :name => 'Debian', :release => { :major => '7', :full => '7.0' }},
142 :lsbdistid => 'Debian',
143 :osfamily => 'Debian',
144 :puppetversion => Puppet.version,
149 expect { subject.call }.to raise_error(Puppet::Error, /lsbdistcodename fact not available: release parameter required/)