3 describe 'apt::source' do
4 GPG_KEY_ID = '47B320EB4C7C375AA9DAE1A01054B7A24BD6EC30'
15 context 'without location' do
18 :lsbdistid => 'Debian',
19 :lsbdistcodename => 'wheezy',
25 is_expected.to compile
26 }.to raise_error(Puppet::Error, /source entry without specifying a location/)
29 context 'with location' do
32 :lsbdistid => 'Debian',
33 :lsbdistcodename => 'wheezy',
37 let(:params) { { :location => 'hello.there', } }
39 it { is_expected.to contain_apt__setting('list-my_source').with({
41 }).without_content(/# my_source\ndeb-src hello.there wheezy main\n/)
46 describe 'no defaults' do
49 :lsbdistid => 'Debian',
50 :lsbdistcodename => 'wheezy',
54 context 'with simple key' do
58 :location => 'http://debian.mirror.iweb.ca/debian/',
63 :architecture => 'x86_64',
64 :allow_unsigned => true,
68 it { is_expected.to contain_apt__setting('list-my_source').with({
70 }).with_content(/# foo\ndeb \[arch=x86_64 trusted=yes\] http:\/\/debian\.mirror\.iweb\.ca\/debian\/ sid testing\n/).without_content(/deb-src/)
73 it { is_expected.to contain_apt__pin('my_source').that_comes_before('Apt::Setting[list-my_source]').with({
76 :origin => 'debian.mirror.iweb.ca',
80 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({
87 context 'with complex key' do
91 :location => 'http://debian.mirror.iweb.ca/debian/',
94 :key => { 'id' => GPG_KEY_ID, 'server' => 'pgp.mit.edu',
95 'content' => 'GPG key content',
96 'source' => 'http://apt.puppetlabs.com/pubkey.gpg',},
98 :architecture => 'x86_64',
99 :allow_unsigned => true,
103 it { is_expected.to contain_apt__setting('list-my_source').with({
104 :ensure => 'present',
105 }).with_content(/# foo\ndeb \[arch=x86_64 trusted=yes\] http:\/\/debian\.mirror\.iweb\.ca\/debian\/ sid testing\n/).without_content(/deb-src/)
108 it { is_expected.to contain_apt__pin('my_source').that_comes_before('Apt::Setting[list-my_source]').with({
109 :ensure => 'present',
111 :origin => 'debian.mirror.iweb.ca',
115 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({
116 :ensure => 'present',
118 :server => 'pgp.mit.edu',
119 :content => 'GPG key content',
120 :source => 'http://apt.puppetlabs.com/pubkey.gpg',
125 context 'with simple key' do
129 :location => 'http://debian.mirror.iweb.ca/debian/',
134 :architecture => 'x86_64',
135 :allow_unsigned => true,
139 it { is_expected.to contain_apt__setting('list-my_source').with({
140 :ensure => 'present',
141 }).with_content(/# foo\ndeb \[arch=x86_64 trusted=yes\] http:\/\/debian\.mirror\.iweb\.ca\/debian\/ sid testing\n/).without_content(/deb-src/)
144 it { is_expected.to contain_apt__pin('my_source').that_comes_before('Apt::Setting[list-my_source]').with({
145 :ensure => 'present',
147 :origin => 'debian.mirror.iweb.ca',
151 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({
152 :ensure => 'present',
159 context 'allow_unsigned true' do
162 :lsbdistid => 'Debian',
163 :lsbdistcodename => 'wheezy',
164 :osfamily => 'Debian'
169 :location => 'hello.there',
170 :allow_unsigned => true,
174 it { is_expected.to contain_apt__setting('list-my_source').with({
175 :ensure => 'present',
176 }).with_content(/# my_source\ndeb \[trusted=yes\] hello.there wheezy main\n/)
180 context 'architecture equals x86_64' do
183 :lsbdistid => 'Debian',
184 :lsbdistcodename => 'wheezy',
185 :osfamily => 'Debian'
190 :location => 'hello.there',
191 :include => {'deb' => false, 'src' => true,},
192 :architecture => 'x86_64',
196 it { is_expected.to contain_apt__setting('list-my_source').with({
197 :ensure => 'present',
198 }).with_content(/# my_source\ndeb-src \[arch=x86_64 \] hello.there wheezy main\n/)
202 context 'ensure => absent' do
205 :lsbdistid => 'Debian',
206 :lsbdistcodename => 'wheezy',
207 :osfamily => 'Debian'
216 it { is_expected.to contain_apt__setting('list-my_source').with({
222 describe 'validation' do
223 context 'no release' do
226 :lsbdistid => 'Debian',
227 :osfamily => 'Debian'
230 let(:params) { { :location => 'hello.there', } }
234 is_expected.to compile
235 }.to raise_error(Puppet::Error, /lsbdistcodename fact not available: release parameter required/)