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: '8', full: '8.0' } },
13 lsbdistcodename: 'jessie',
18 is_expected.to contain_apt__source('backports').with(location: 'http://deb.debian.org/debian',
19 key: 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
20 repos: 'main contrib non-free',
21 release: 'jessie-backports',
22 pin: { 'priority' => 200, 'release' => 'jessie-backports' })
25 context 'with defaults on ubuntu' do
28 os: { family: 'Debian', name: 'Ubuntu', release: { major: '16', full: '16.04' } },
31 lsbdistcodename: 'xenial',
32 lsbdistrelease: '16.04',
37 is_expected.to contain_apt__source('backports').with(location: 'http://archive.ubuntu.com/ubuntu',
38 key: '630239CC130E1A7FD81A27B140976EAF437D05B5',
39 repos: 'main universe multiverse restricted',
40 release: 'xenial-backports',
41 pin: { 'priority' => 200, 'release' => 'xenial-backports' })
44 context 'with everything set' do
47 os: { family: 'Debian', name: 'Ubuntu', release: { major: '16', full: '16.04' } },
50 lsbdistcodename: 'xenial',
51 lsbdistrelease: '16.04',
56 location: 'http://archive.ubuntu.com/ubuntu-test',
59 key: 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
65 is_expected.to contain_apt__source('backports').with(location: 'http://archive.ubuntu.com/ubuntu-test',
66 key: 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
69 pin: { 'priority' => 90, 'release' => 'vivid' })
72 context 'when set things with hashes' do
75 os: { family: 'Debian', name: 'Ubuntu', release: { major: '16', full: '16.04' } },
78 lsbdistcodename: 'xenial',
79 lsbdistrelease: '16.04',
85 'id' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
94 is_expected.to contain_apt__source('backports').with(key: { 'id' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553' },
95 pin: { 'priority' => '90' })
99 describe 'mint tests' do
102 os: { family: 'Debian', name: 'Linuxmint', release: { major: '17', full: '17' } },
103 lsbdistid: 'linuxmint',
105 lsbdistcodename: 'qiana',
109 context 'with all the needed things set' do
112 location: 'http://archive.ubuntu.com/ubuntu',
113 release: 'trusty-backports',
114 repos: 'main universe multiverse restricted',
115 key: '630239CC130E1A7FD81A27B140976EAF437D05B5',
120 is_expected.to contain_apt__source('backports').with(location: 'http://archive.ubuntu.com/ubuntu',
121 key: '630239CC130E1A7FD81A27B140976EAF437D05B5',
122 repos: 'main universe multiverse restricted',
123 release: 'trusty-backports',
124 pin: { 'priority' => 200, 'release' => 'trusty-backports' })
127 context 'with missing location' do
130 release: 'trusty-backports',
131 repos: 'main universe multiverse restricted',
132 key: '630239CC130E1A7FD81A27B140976EAF437D05B5',
137 is_expected.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
140 context 'with missing release' do
143 location: 'http://archive.ubuntu.com/ubuntu',
144 repos: 'main universe multiverse restricted',
145 key: '630239CC130E1A7FD81A27B140976EAF437D05B5',
150 is_expected.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
153 context 'with missing repos' do
156 location: 'http://archive.ubuntu.com/ubuntu',
157 release: 'trusty-backports',
158 key: '630239CC130E1A7FD81A27B140976EAF437D05B5',
163 is_expected.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
166 context 'with missing key' do
169 location: 'http://archive.ubuntu.com/ubuntu',
170 release: 'trusty-backports',
171 repos: 'main universe multiverse restricted',
176 is_expected.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
180 describe 'validation' do
183 os: { family: 'Debian', name: 'Ubuntu', release: { major: '16', full: '16.04' } },
186 lsbdistcodename: 'xenial',
187 lsbdistrelease: '16.04',
191 context 'with invalid location' do
199 is_expected.to raise_error(Puppet::Error, %r{expects a})
202 context 'with invalid release' do
210 is_expected.to raise_error(Puppet::Error, %r{expects a})
213 context 'with invalid repos' do
221 is_expected.to raise_error(Puppet::Error, %r{expects a})
224 context 'with invalid key' do
232 is_expected.to raise_error(Puppet::Error, %r{expects a})
235 context 'with invalid pin' do
243 is_expected.to raise_error(Puppet::Error, %r{expects a})