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 :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '14', :full => '14.04' }},
69 :lsbdistid => 'Ubuntu',
70 :osfamily => 'Debian',
71 :lsbdistcodename => 'trusty',
72 :lsbdistrelease => '14.04',
73 :puppetversion => Puppet.version,
78 :location => 'http://archive.ubuntu.com/ubuntu-test',
81 :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
85 it { is_expected.to contain_apt__source('backports').with({
86 :location => 'http://archive.ubuntu.com/ubuntu-test',
87 :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
90 :pin => { 'priority' => 90, 'release' => 'vivid' },
94 context 'set things with hashes' do
97 :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '14', :full => '14.04' }},
98 :lsbdistid => 'Ubuntu',
99 :osfamily => 'Debian',
100 :lsbdistcodename => 'trusty',
101 :lsbdistrelease => '14.04',
102 :puppetversion => Puppet.version,
108 'id' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
115 it { is_expected.to contain_apt__source('backports').with({
116 :key => { 'id' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553' },
117 :pin => { 'priority' => '90' },
122 describe 'mint tests' do
125 :os => { :family => 'Debian', :name => 'Linuxmint', :release => { :major => '17', :full => '17' }},
126 :lsbdistid => 'linuxmint',
127 :osfamily => 'Debian',
128 :lsbdistcodename => 'qiana',
129 :puppetversion => Puppet.version,
132 context 'sets all the needed things' do
135 :location => 'http://archive.ubuntu.com/ubuntu',
136 :release => 'trusty-backports',
137 :repos => 'main universe multiverse restricted',
138 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
141 it { is_expected.to contain_apt__source('backports').with({
142 :location => 'http://archive.ubuntu.com/ubuntu',
143 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
144 :repos => 'main universe multiverse restricted',
145 :release => 'trusty-backports',
146 :pin => { 'priority' => 200, 'release' => 'trusty-backports' },
150 context 'missing location' do
153 :release => 'trusty-backports',
154 :repos => 'main universe multiverse restricted',
155 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
161 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
164 context 'missing release' do
167 :location => 'http://archive.ubuntu.com/ubuntu',
168 :repos => 'main universe multiverse restricted',
169 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
175 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
178 context 'missing repos' do
181 :location => 'http://archive.ubuntu.com/ubuntu',
182 :release => 'trusty-backports',
183 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
189 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
192 context 'missing key' do
195 :location => 'http://archive.ubuntu.com/ubuntu',
196 :release => 'trusty-backports',
197 :repos => 'main universe multiverse restricted',
203 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
207 describe 'validation' do
210 :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '14', :full => '14.04' }},
211 :lsbdistid => 'Ubuntu',
212 :osfamily => 'Debian',
213 :lsbdistcodename => 'trusty',
214 :lsbdistrelease => '14.04',
215 :puppetversion => Puppet.version,
218 context 'invalid location' do
227 }.to raise_error(Puppet::Error, /expects a/)
230 context 'invalid release' do
239 }.to raise_error(Puppet::Error, /expects a/)
242 context 'invalid repos' do
251 }.to raise_error(Puppet::Error, /expects a/)
254 context 'invalid key' do
263 }.to raise_error(Puppet::Error, /expects a/)
266 context 'invalid pin' do
275 }.to raise_error(Puppet::Error, /expects a/)