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 :lsbdistid => 'Debian',
11 :osfamily => 'Debian',
12 :lsbdistcodename => 'wheezy',
13 :puppetversion => Puppet.version,
16 it { is_expected.to contain_apt__source('backports').with({
17 :location => 'http://ftp.debian.org/debian/',
18 :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
19 :repos => 'main contrib non-free',
20 :release => 'wheezy-backports',
25 context 'defaults on squeeze' do
28 :lsbdistid => 'Debian',
29 :osfamily => 'Debian',
30 :lsbdistcodename => 'squeeze',
31 :puppetversion => Puppet.version,
34 it { is_expected.to contain_apt__source('backports').with({
35 :location => 'http://backports.debian.org/debian-backports',
36 :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
37 :repos => 'main contrib non-free',
38 :release => 'squeeze-backports',
43 context 'defaults on ubuntu' do
46 :lsbdistid => 'Ubuntu',
47 :osfamily => 'Debian',
48 :lsbdistcodename => 'trusty',
49 :puppetversion => Puppet.version,
52 it { is_expected.to contain_apt__source('backports').with({
53 :location => 'http://archive.ubuntu.com/ubuntu',
54 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
55 :repos => 'main universe multiverse restricted',
56 :release => 'trusty-backports',
61 context 'set everything' do
64 :lsbdistid => 'Ubuntu',
65 :osfamily => 'Debian',
66 :lsbdistcodename => 'trusty',
67 :puppetversion => Puppet.version,
72 :location => 'http://archive.ubuntu.com/ubuntu-test',
75 :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
79 it { is_expected.to contain_apt__source('backports').with({
80 :location => 'http://archive.ubuntu.com/ubuntu-test',
81 :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
88 context 'set things with hashes' do
91 :lsbdistid => 'Ubuntu',
92 :osfamily => 'Debian',
93 :lsbdistcodename => 'trusty',
94 :puppetversion => Puppet.version,
100 'id' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
107 it { is_expected.to contain_apt__source('backports').with({
108 :key => { 'id' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553' },
109 :pin => { 'priority' => '90' },
114 describe 'mint tests' do
117 :lsbdistid => 'linuxmint',
118 :osfamily => 'Debian',
119 :lsbdistcodename => 'qiana',
120 :puppetversion => Puppet.version,
123 context 'sets all the needed things' do
126 :location => 'http://archive.ubuntu.com/ubuntu',
127 :release => 'trusty-backports',
128 :repos => 'main universe multiverse restricted',
129 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
132 it { is_expected.to contain_apt__source('backports').with({
133 :location => 'http://archive.ubuntu.com/ubuntu',
134 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
135 :repos => 'main universe multiverse restricted',
136 :release => 'trusty-backports',
141 context 'missing location' do
144 :release => 'trusty-backports',
145 :repos => 'main universe multiverse restricted',
146 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
152 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
155 context 'missing release' do
158 :location => 'http://archive.ubuntu.com/ubuntu',
159 :repos => 'main universe multiverse restricted',
160 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
166 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
169 context 'missing repos' do
172 :location => 'http://archive.ubuntu.com/ubuntu',
173 :release => 'trusty-backports',
174 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
180 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
183 context 'missing key' do
186 :location => 'http://archive.ubuntu.com/ubuntu',
187 :release => 'trusty-backports',
188 :repos => 'main universe multiverse restricted',
194 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
198 describe 'validation' do
201 :lsbdistid => 'Ubuntu',
202 :osfamily => 'Debian',
203 :lsbdistcodename => 'trusty',
204 :puppetversion => Puppet.version,
207 context 'invalid location' do
216 }.to raise_error(Puppet::Error, /is not a string/)
219 context 'invalid release' do
228 }.to raise_error(Puppet::Error, /is not a string/)
231 context 'invalid repos' do
240 }.to raise_error(Puppet::Error, /is not a string/)
243 context 'invalid key' do
252 }.to raise_error(Puppet::Error, /is not a string/)
255 context 'invalid pin' do
264 }.to raise_error(Puppet::Error, /pin must be either a string, number or hash/)