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://httpredir.debian.org/debian',
18 :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
19 :repos => 'main contrib non-free',
20 :release => 'wheezy-backports',
21 :pin => { 'priority' => 200, '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://httpredir.debian.org/debian-backports',
36 :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
37 :repos => 'main contrib non-free',
38 :release => 'squeeze-backports',
39 :pin => { 'priority' => 200, 'release' => 'squeeze-backports' },
43 context 'defaults on ubuntu' do
46 :lsbdistid => 'Ubuntu',
47 :osfamily => 'Debian',
48 :lsbdistcodename => 'trusty',
49 :lsbdistrelease => '14.04',
50 :puppetversion => Puppet.version,
53 it { is_expected.to contain_apt__source('backports').with({
54 :location => 'http://archive.ubuntu.com/ubuntu',
55 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
56 :repos => 'main universe multiverse restricted',
57 :release => 'trusty-backports',
58 :pin => { 'priority' => 200, 'release' => 'trusty-backports' },
62 context 'set everything' do
65 :lsbdistid => 'Ubuntu',
66 :osfamily => 'Debian',
67 :lsbdistcodename => 'trusty',
68 :lsbdistrelease => '14.04',
69 :puppetversion => Puppet.version,
74 :location => 'http://archive.ubuntu.com/ubuntu-test',
77 :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
81 it { is_expected.to contain_apt__source('backports').with({
82 :location => 'http://archive.ubuntu.com/ubuntu-test',
83 :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
86 :pin => { 'priority' => 90, 'release' => 'vivid' },
90 context 'set things with hashes' do
93 :lsbdistid => 'Ubuntu',
94 :osfamily => 'Debian',
95 :lsbdistcodename => 'trusty',
96 :lsbdistrelease => '14.04',
97 :puppetversion => Puppet.version,
103 'id' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
110 it { is_expected.to contain_apt__source('backports').with({
111 :key => { 'id' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553' },
112 :pin => { 'priority' => '90' },
117 describe 'mint tests' do
120 :lsbdistid => 'linuxmint',
121 :osfamily => 'Debian',
122 :lsbdistcodename => 'qiana',
123 :puppetversion => Puppet.version,
126 context 'sets all the needed things' do
129 :location => 'http://archive.ubuntu.com/ubuntu',
130 :release => 'trusty-backports',
131 :repos => 'main universe multiverse restricted',
132 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
135 it { is_expected.to contain_apt__source('backports').with({
136 :location => 'http://archive.ubuntu.com/ubuntu',
137 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
138 :repos => 'main universe multiverse restricted',
139 :release => 'trusty-backports',
140 :pin => { 'priority' => 200, 'release' => 'trusty-backports' },
144 context 'missing location' do
147 :release => 'trusty-backports',
148 :repos => 'main universe multiverse restricted',
149 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
155 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
158 context 'missing release' do
161 :location => 'http://archive.ubuntu.com/ubuntu',
162 :repos => 'main universe multiverse restricted',
163 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
169 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
172 context 'missing repos' do
175 :location => 'http://archive.ubuntu.com/ubuntu',
176 :release => 'trusty-backports',
177 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
183 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
186 context 'missing key' do
189 :location => 'http://archive.ubuntu.com/ubuntu',
190 :release => 'trusty-backports',
191 :repos => 'main universe multiverse restricted',
197 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
201 describe 'validation' do
204 :lsbdistid => 'Ubuntu',
205 :osfamily => 'Debian',
206 :lsbdistcodename => 'trusty',
207 :lsbdistrelease => '14.04',
208 :puppetversion => Puppet.version,
211 context 'invalid location' do
220 }.to raise_error(Puppet::Error, /is not a string/)
223 context 'invalid release' do
232 }.to raise_error(Puppet::Error, /is not a string/)
235 context 'invalid repos' do
244 }.to raise_error(Puppet::Error, /is not a string/)
247 context 'invalid key' do
256 }.to raise_error(Puppet::Error, /is not a string/)
259 context 'invalid pin' do
268 }.to raise_error(Puppet::Error, /pin must be either a string, number or hash/)