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',
15 it { is_expected.to contain_apt__source('backports').with({
16 :location => 'http://ftp.debian.org/debian/',
17 :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
18 :repos => 'main contrib non-free',
19 :release => 'wheezy-backports',
24 context 'defaults on squeeze' do
27 :lsbdistid => 'Debian',
28 :osfamily => 'Debian',
29 :lsbdistcodename => 'squeeze',
32 it { is_expected.to contain_apt__source('backports').with({
33 :location => 'http://backports.debian.org/debian-backports',
34 :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
35 :repos => 'main contrib non-free',
36 :release => 'squeeze-backports',
41 context 'defaults on ubuntu' do
44 :lsbdistid => 'Ubuntu',
45 :osfamily => 'Debian',
46 :lsbdistcodename => 'trusty',
49 it { is_expected.to contain_apt__source('backports').with({
50 :location => 'http://archive.ubuntu.com/ubuntu',
51 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
52 :repos => 'main universe multiverse restricted',
53 :release => 'trusty-backports',
58 context 'set everything' do
61 :lsbdistid => 'Ubuntu',
62 :osfamily => 'Debian',
63 :lsbdistcodename => 'trusty',
68 :location => 'http://archive.ubuntu.com/ubuntu-test',
71 :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
75 it { is_expected.to contain_apt__source('backports').with({
76 :location => 'http://archive.ubuntu.com/ubuntu-test',
77 :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
84 context 'set things with hashes' do
87 :lsbdistid => 'Ubuntu',
88 :osfamily => 'Debian',
89 :lsbdistcodename => 'trusty',
95 'id' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
102 it { is_expected.to contain_apt__source('backports').with({
103 :key => { 'id' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553' },
104 :pin => { 'priority' => '90' },
109 describe 'mint tests' do
112 :lsbdistid => 'linuxmint',
113 :osfamily => 'Debian',
114 :lsbdistcodename => 'qiana',
117 context 'sets all the needed things' do
120 :location => 'http://archive.ubuntu.com/ubuntu',
121 :release => 'trusty-backports',
122 :repos => 'main universe multiverse restricted',
123 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
126 it { is_expected.to contain_apt__source('backports').with({
127 :location => 'http://archive.ubuntu.com/ubuntu',
128 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
129 :repos => 'main universe multiverse restricted',
130 :release => 'trusty-backports',
135 context 'missing location' do
138 :release => 'trusty-backports',
139 :repos => 'main universe multiverse restricted',
140 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
145 is_expected.to compile
146 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
149 context 'missing release' do
152 :location => 'http://archive.ubuntu.com/ubuntu',
153 :repos => 'main universe multiverse restricted',
154 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
159 is_expected.to compile
160 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
163 context 'missing repos' do
166 :location => 'http://archive.ubuntu.com/ubuntu',
167 :release => 'trusty-backports',
168 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
173 is_expected.to compile
174 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
177 context 'missing key' do
180 :location => 'http://archive.ubuntu.com/ubuntu',
181 :release => 'trusty-backports',
182 :repos => 'main universe multiverse restricted',
187 is_expected.to compile
188 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
192 describe 'validation' do
195 :lsbdistid => 'Ubuntu',
196 :osfamily => 'Debian',
197 :lsbdistcodename => 'trusty',
200 context 'invalid location' do
208 is_expected.to compile
209 }.to raise_error(Puppet::Error, /is not a string/)
212 context 'invalid release' do
220 is_expected.to compile
221 }.to raise_error(Puppet::Error, /is not a string/)
224 context 'invalid repos' do
232 is_expected.to compile
233 }.to raise_error(Puppet::Error, /is not a string/)
236 context 'invalid key' do
244 is_expected.to compile
245 }.to raise_error(Puppet::Error, /is not a string/)
248 context 'invalid pin' do
256 is_expected.to compile
257 }.to raise_error(Puppet::Error, /pin must be either a string, number or hash/)