3 describe 'apt::backports', type: :class do
4 let(:pre_condition) { "class{ '::apt': }" }
6 describe 'debian/ubuntu tests' do
7 context 'with defaults on deb' do
10 os: { family: 'Debian', name: 'Debian', release: { major: '7', full: '7.0' } },
13 lsbdistcodename: 'wheezy',
14 puppetversion: Puppet.version,
19 is_expected.to contain_apt__source('backports').with(location: 'http://deb.debian.org/debian',
20 key: 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
21 repos: 'main contrib non-free',
22 release: 'wheezy-backports',
23 pin: { 'priority' => 200, 'release' => 'wheezy-backports' })
26 context 'with defaults on ubuntu' do
29 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
32 lsbdistcodename: 'trusty',
33 lsbdistrelease: '14.04',
34 puppetversion: Puppet.version,
39 is_expected.to contain_apt__source('backports').with(location: 'http://archive.ubuntu.com/ubuntu',
40 key: '630239CC130E1A7FD81A27B140976EAF437D05B5',
41 repos: 'main universe multiverse restricted',
42 release: 'trusty-backports',
43 pin: { 'priority' => 200, 'release' => 'trusty-backports' })
46 context 'with everything set' do
49 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
52 lsbdistcodename: 'trusty',
53 lsbdistrelease: '14.04',
54 puppetversion: Puppet.version,
59 location: 'http://archive.ubuntu.com/ubuntu-test',
62 key: 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
68 is_expected.to contain_apt__source('backports').with(location: 'http://archive.ubuntu.com/ubuntu-test',
69 key: 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
72 pin: { 'priority' => 90, 'release' => 'vivid' })
75 context 'when set things with hashes' do
78 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
81 lsbdistcodename: 'trusty',
82 lsbdistrelease: '14.04',
83 puppetversion: Puppet.version,
89 'id' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
98 is_expected.to contain_apt__source('backports').with(key: { 'id' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553' },
99 pin: { 'priority' => '90' })
103 describe 'mint tests' do
106 os: { family: 'Debian', name: 'Linuxmint', release: { major: '17', full: '17' } },
107 lsbdistid: 'linuxmint',
109 lsbdistcodename: 'qiana',
110 puppetversion: Puppet.version,
114 context 'with all the needed things set' do
117 location: 'http://archive.ubuntu.com/ubuntu',
118 release: 'trusty-backports',
119 repos: 'main universe multiverse restricted',
120 key: '630239CC130E1A7FD81A27B140976EAF437D05B5',
125 is_expected.to contain_apt__source('backports').with(location: 'http://archive.ubuntu.com/ubuntu',
126 key: '630239CC130E1A7FD81A27B140976EAF437D05B5',
127 repos: 'main universe multiverse restricted',
128 release: 'trusty-backports',
129 pin: { 'priority' => 200, 'release' => 'trusty-backports' })
132 context 'with missing location' do
135 release: 'trusty-backports',
136 repos: 'main universe multiverse restricted',
137 key: '630239CC130E1A7FD81A27B140976EAF437D05B5',
142 is_expected.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
145 context 'with missing release' do
148 location: 'http://archive.ubuntu.com/ubuntu',
149 repos: 'main universe multiverse restricted',
150 key: '630239CC130E1A7FD81A27B140976EAF437D05B5',
155 is_expected.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
158 context 'with missing repos' do
161 location: 'http://archive.ubuntu.com/ubuntu',
162 release: 'trusty-backports',
163 key: '630239CC130E1A7FD81A27B140976EAF437D05B5',
168 is_expected.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
171 context 'with missing key' do
174 location: 'http://archive.ubuntu.com/ubuntu',
175 release: 'trusty-backports',
176 repos: 'main universe multiverse restricted',
181 is_expected.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
185 describe 'validation' do
188 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
191 lsbdistcodename: 'trusty',
192 lsbdistrelease: '14.04',
193 puppetversion: Puppet.version,
197 context 'with invalid location' do
205 is_expected.to raise_error(Puppet::Error, %r{expects a})
208 context 'with invalid release' do
216 is_expected.to raise_error(Puppet::Error, %r{expects a})
219 context 'with invalid repos' do
227 is_expected.to raise_error(Puppet::Error, %r{expects a})
230 context 'with invalid key' do
238 is_expected.to raise_error(Puppet::Error, %r{expects a})
241 context 'with invalid pin' do
249 is_expected.to raise_error(Puppet::Error, %r{expects a})