4 describe 'apt::backports', :type => :class do
5 let (:pre_condition) { "class{ '::apt': }" }
6 describe 'debian/ubuntu tests' do
7 context 'defaults on deb' do
10 :os => { :family => 'Debian', :name => 'Debian', :release => { :major => '7', :full => '7.0' }},
11 :lsbdistid => 'Debian',
12 :osfamily => 'Debian',
13 :lsbdistcodename => 'wheezy',
14 :puppetversion => Puppet.version,
17 it { is_expected.to contain_apt__source('backports').with({
18 :location => 'http://httpredir.debian.org/debian',
19 :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
20 :repos => 'main contrib non-free',
21 :release => 'wheezy-backports',
22 :pin => { 'priority' => 200, 'release' => 'wheezy-backports' },
26 context 'defaults on squeeze' do
29 :os => { :family => 'Debian', :name => 'Debian', :release => { :major => '6', :full => '6.0' }},
30 :lsbdistid => 'Debian',
31 :osfamily => 'Debian',
32 :lsbdistcodename => 'squeeze',
33 :puppetversion => Puppet.version,
36 it { is_expected.to contain_apt__source('backports').with({
37 :location => 'http://httpredir.debian.org/debian-backports',
38 :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
39 :repos => 'main contrib non-free',
40 :release => 'squeeze-backports',
41 :pin => { 'priority' => 200, 'release' => 'squeeze-backports' },
45 context 'defaults on ubuntu' do
48 :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '14', :full => '14.04' }},
49 :lsbdistid => 'Ubuntu',
50 :osfamily => 'Debian',
51 :lsbdistcodename => 'trusty',
52 :lsbdistrelease => '14.04',
53 :puppetversion => Puppet.version,
56 it { is_expected.to contain_apt__source('backports').with({
57 :location => 'http://archive.ubuntu.com/ubuntu',
58 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
59 :repos => 'main universe multiverse restricted',
60 :release => 'trusty-backports',
61 :pin => { 'priority' => 200, 'release' => 'trusty-backports' },
65 context 'set everything' do
68 :lsbdistid => 'Ubuntu',
69 :osfamily => 'Debian',
70 :lsbdistcodename => 'trusty',
71 :lsbdistrelease => '14.04',
72 :puppetversion => Puppet.version,
77 :location => 'http://archive.ubuntu.com/ubuntu-test',
80 :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
84 it { is_expected.to contain_apt__source('backports').with({
85 :location => 'http://archive.ubuntu.com/ubuntu-test',
86 :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
89 :pin => { 'priority' => 90, 'release' => 'vivid' },
93 context 'set things with hashes' do
96 :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '14', :full => '14.04' }},
97 :lsbdistid => 'Ubuntu',
98 :osfamily => 'Debian',
99 :lsbdistcodename => 'trusty',
100 :lsbdistrelease => '14.04',
101 :puppetversion => Puppet.version,
107 'id' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
114 it { is_expected.to contain_apt__source('backports').with({
115 :key => { 'id' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553' },
116 :pin => { 'priority' => '90' },
121 describe 'mint tests' do
124 :lsbdistid => 'linuxmint',
125 :osfamily => 'Debian',
126 :lsbdistcodename => 'qiana',
127 :puppetversion => Puppet.version,
130 context 'sets all the needed things' do
133 :location => 'http://archive.ubuntu.com/ubuntu',
134 :release => 'trusty-backports',
135 :repos => 'main universe multiverse restricted',
136 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
139 it { is_expected.to contain_apt__source('backports').with({
140 :location => 'http://archive.ubuntu.com/ubuntu',
141 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
142 :repos => 'main universe multiverse restricted',
143 :release => 'trusty-backports',
144 :pin => { 'priority' => 200, 'release' => 'trusty-backports' },
148 context 'missing location' do
151 :release => 'trusty-backports',
152 :repos => 'main universe multiverse restricted',
153 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
159 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
162 context 'missing release' do
165 :location => 'http://archive.ubuntu.com/ubuntu',
166 :repos => 'main universe multiverse restricted',
167 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
173 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
176 context 'missing repos' do
179 :location => 'http://archive.ubuntu.com/ubuntu',
180 :release => 'trusty-backports',
181 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
187 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
190 context 'missing key' do
193 :location => 'http://archive.ubuntu.com/ubuntu',
194 :release => 'trusty-backports',
195 :repos => 'main universe multiverse restricted',
201 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
205 describe 'validation' do
208 :lsbdistid => 'Ubuntu',
209 :osfamily => 'Debian',
210 :lsbdistcodename => 'trusty',
211 :lsbdistrelease => '14.04',
212 :puppetversion => Puppet.version,
215 context 'invalid location' do
224 }.to raise_error(Puppet::Error, /expects a String value/)
227 context 'invalid release' do
236 }.to raise_error(Puppet::Error, /expects a String value/)
239 context 'invalid repos' do
248 }.to raise_error(Puppet::Error, /expects a String value/)
251 context 'invalid key' do
260 }.to raise_error(Puppet::Error, /expects a value of type String, Hash,/)
263 context 'invalid pin' do
272 }.to raise_error(Puppet::Error, /parameter 'pin' expects a value of type Integer, Pattern/)