3 describe 'apt::source' do
4 GPG_KEY_ID = '47B320EB4C7C375AA9DAE1A01054B7A24BD6EC30'
14 context 'mostly defaults' do
17 :lsbdistid => 'Debian',
18 :lsbdistcodename => 'wheezy',
25 :include_deb => false,
30 it { is_expected.to contain_apt__setting('list-my_source').with({
32 }).with_content(/# my_source\ndeb-src wheezy main\n/)
37 describe 'no defaults' do
40 :lsbdistid => 'Debian',
41 :lsbdistcodename => 'wheezy',
45 context 'with simple key' do
49 :location => 'http://debian.mirror.iweb.ca/debian/',
52 :include_src => false,
55 :architecture => 'x86_64',
56 :trusted_source => true,
60 it { is_expected.to contain_apt__setting('list-my_source').with({
62 }).with_content(/# foo\ndeb \[arch=x86_64 trusted=yes\] http:\/\/debian\.mirror\.iweb\.ca\/debian\/ sid testing\n/).without_content(/deb-src/)
65 it { is_expected.to contain_apt__pin('my_source').that_comes_before('Apt::Setting[list-my_source]').with({
68 :origin => 'debian.mirror.iweb.ca',
72 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({
79 context 'with complex key' do
83 :location => 'http://debian.mirror.iweb.ca/debian/',
86 :include_src => false,
87 :key => { 'id' => GPG_KEY_ID, 'server' => 'pgp.mit.edu',
88 'content' => 'GPG key content',
89 'source' => 'http://apt.puppetlabs.com/pubkey.gpg',},
91 :architecture => 'x86_64',
92 :trusted_source => true,
96 it { is_expected.to contain_apt__setting('list-my_source').with({
98 }).with_content(/# foo\ndeb \[arch=x86_64 trusted=yes\] http:\/\/debian\.mirror\.iweb\.ca\/debian\/ sid testing\n/).without_content(/deb-src/)
101 it { is_expected.to contain_apt__pin('my_source').that_comes_before('Apt::Setting[list-my_source]').with({
102 :ensure => 'present',
104 :origin => 'debian.mirror.iweb.ca',
108 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({
109 :ensure => 'present',
111 :server => 'pgp.mit.edu',
112 :content => 'GPG key content',
113 :source => 'http://apt.puppetlabs.com/pubkey.gpg',
118 context 'with simple key' do
122 :location => 'http://debian.mirror.iweb.ca/debian/',
125 :include_src => false,
128 :architecture => 'x86_64',
129 :trusted_source => true,
133 it { is_expected.to contain_apt__setting('list-my_source').with({
134 :ensure => 'present',
135 }).with_content(/# foo\ndeb \[arch=x86_64 trusted=yes\] http:\/\/debian\.mirror\.iweb\.ca\/debian\/ sid testing\n/).without_content(/deb-src/)
138 it { is_expected.to contain_apt__pin('my_source').that_comes_before('Apt::Setting[list-my_source]').with({
139 :ensure => 'present',
141 :origin => 'debian.mirror.iweb.ca',
145 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({
146 :ensure => 'present',
153 context 'trusted_source true' do
156 :lsbdistid => 'Debian',
157 :lsbdistcodename => 'wheezy',
158 :osfamily => 'Debian'
163 :include_src => false,
164 :trusted_source => true,
168 it { is_expected.to contain_apt__setting('list-my_source').with({
169 :ensure => 'present',
170 }).with_content(/# my_source\ndeb \[trusted=yes\] wheezy main\n/)
174 context 'architecture equals x86_64' do
177 :lsbdistid => 'Debian',
178 :lsbdistcodename => 'wheezy',
179 :osfamily => 'Debian'
184 :include_deb => false,
185 :include_src => true,
186 :architecture => 'x86_64',
190 it { is_expected.to contain_apt__setting('list-my_source').with({
191 :ensure => 'present',
192 }).with_content(/# my_source\ndeb-src \[arch=x86_64 \] wheezy main\n/)
196 context 'ensure => absent' do
199 :lsbdistid => 'Debian',
200 :lsbdistcodename => 'wheezy',
201 :osfamily => 'Debian'
210 it { is_expected.to contain_apt__setting('list-my_source').with({
216 describe 'validation' do
217 context 'no release' do
220 :lsbdistid => 'Debian',
221 :osfamily => 'Debian'
227 is_expected.to compile
228 }.to raise_error(Puppet::Error, /lsbdistcodename fact not available: release parameter required/)