3 describe 'apt::source' do
4 GPG_KEY_ID = '47B320EB4C7C375AA9DAE1A01054B7A24BD6EC30'
17 :lsbdistid => 'Debian',
18 :lsbdistcodename => 'wheezy',
23 it { is_expected.to contain_apt__setting('list-my_source').with({
25 }).without_content(/# my_source\ndeb-src wheezy main\n/)
29 describe 'no defaults' do
32 :lsbdistid => 'Debian',
33 :lsbdistcodename => 'wheezy',
37 context 'with simple key' do
41 :location => 'http://debian.mirror.iweb.ca/debian/',
46 :architecture => 'x86_64',
47 :trusted_source => true,
51 it { is_expected.to contain_apt__setting('list-my_source').with({
53 }).with_content(/# foo\ndeb \[arch=x86_64 trusted=yes\] http:\/\/debian\.mirror\.iweb\.ca\/debian\/ sid testing\n/).without_content(/deb-src/)
56 it { is_expected.to contain_apt__pin('my_source').that_comes_before('Apt::Setting[list-my_source]').with({
59 :origin => 'debian.mirror.iweb.ca',
63 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({
70 context 'with complex key' do
74 :location => 'http://debian.mirror.iweb.ca/debian/',
77 :key => { 'id' => GPG_KEY_ID, 'server' => 'pgp.mit.edu',
78 'content' => 'GPG key content',
79 'source' => 'http://apt.puppetlabs.com/pubkey.gpg',},
81 :architecture => 'x86_64',
82 :trusted_source => true,
86 it { is_expected.to contain_apt__setting('list-my_source').with({
88 }).with_content(/# foo\ndeb \[arch=x86_64 trusted=yes\] http:\/\/debian\.mirror\.iweb\.ca\/debian\/ sid testing\n/).without_content(/deb-src/)
91 it { is_expected.to contain_apt__pin('my_source').that_comes_before('Apt::Setting[list-my_source]').with({
94 :origin => 'debian.mirror.iweb.ca',
98 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({
101 :server => 'pgp.mit.edu',
102 :content => 'GPG key content',
103 :source => 'http://apt.puppetlabs.com/pubkey.gpg',
108 context 'with simple key' do
112 :location => 'http://debian.mirror.iweb.ca/debian/',
117 :architecture => 'x86_64',
118 :trusted_source => true,
122 it { is_expected.to contain_apt__setting('list-my_source').with({
123 :ensure => 'present',
124 }).with_content(/# foo\ndeb \[arch=x86_64 trusted=yes\] http:\/\/debian\.mirror\.iweb\.ca\/debian\/ sid testing\n/).without_content(/deb-src/)
127 it { is_expected.to contain_apt__pin('my_source').that_comes_before('Apt::Setting[list-my_source]').with({
128 :ensure => 'present',
130 :origin => 'debian.mirror.iweb.ca',
134 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({
135 :ensure => 'present',
142 context 'trusted_source true' do
145 :lsbdistid => 'Debian',
146 :lsbdistcodename => 'wheezy',
147 :osfamily => 'Debian'
152 :trusted_source => true,
156 it { is_expected.to contain_apt__setting('list-my_source').with({
157 :ensure => 'present',
158 }).with_content(/# my_source\ndeb \[trusted=yes\] wheezy main\n/)
162 context 'architecture equals x86_64' do
165 :lsbdistid => 'Debian',
166 :lsbdistcodename => 'wheezy',
167 :osfamily => 'Debian'
172 :include => {'deb' => false, 'src' => true,},
173 :architecture => 'x86_64',
177 it { is_expected.to contain_apt__setting('list-my_source').with({
178 :ensure => 'present',
179 }).with_content(/# my_source\ndeb-src \[arch=x86_64 \] wheezy main\n/)
183 context 'ensure => absent' do
186 :lsbdistid => 'Debian',
187 :lsbdistcodename => 'wheezy',
188 :osfamily => 'Debian'
197 it { is_expected.to contain_apt__setting('list-my_source').with({
203 describe 'validation' do
204 context 'no release' do
207 :lsbdistid => 'Debian',
208 :osfamily => 'Debian'
214 is_expected.to compile
215 }.to raise_error(Puppet::Error, /lsbdistcodename fact not available: release parameter required/)