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 repos: 'main contrib non-free',
20 release: 'jessie-backports',
21 pin: { 'priority' => 200, 'release' => 'jessie-backports' })
24 context 'with defaults on ubuntu' do
27 os: { family: 'Debian', name: 'Ubuntu', release: { major: '16', full: '16.04' } },
30 lsbdistcodename: 'xenial',
31 lsbdistrelease: '16.04',
36 is_expected.to contain_apt__source('backports').with(location: 'http://archive.ubuntu.com/ubuntu',
37 key: '630239CC130E1A7FD81A27B140976EAF437D05B5',
38 repos: 'main universe multiverse restricted',
39 release: 'xenial-backports',
40 pin: { 'priority' => 200, 'release' => 'xenial-backports' })
43 context 'with everything set' do
46 os: { family: 'Debian', name: 'Ubuntu', release: { major: '16', full: '16.04' } },
49 lsbdistcodename: 'xenial',
50 lsbdistrelease: '16.04',
55 location: 'http://archive.ubuntu.com/ubuntu-test',
58 key: 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
64 is_expected.to contain_apt__source('backports').with(location: 'http://archive.ubuntu.com/ubuntu-test',
65 key: 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
68 pin: { 'priority' => 90, 'release' => 'vivid' })
71 context 'when set things with hashes' do
74 os: { family: 'Debian', name: 'Ubuntu', release: { major: '16', full: '16.04' } },
77 lsbdistcodename: 'xenial',
78 lsbdistrelease: '16.04',
84 'id' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
93 is_expected.to contain_apt__source('backports').with(key: { 'id' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553' },
94 pin: { 'priority' => '90' })
98 describe 'mint tests' do
101 os: { family: 'Debian', name: 'Linuxmint', release: { major: '17', full: '17' } },
102 lsbdistid: 'linuxmint',
104 lsbdistcodename: 'qiana',
108 context 'with all the needed things set' do
111 location: 'http://archive.ubuntu.com/ubuntu',
112 release: 'trusty-backports',
113 repos: 'main universe multiverse restricted',
114 key: '630239CC130E1A7FD81A27B140976EAF437D05B5',
119 is_expected.to contain_apt__source('backports').with(location: 'http://archive.ubuntu.com/ubuntu',
120 key: '630239CC130E1A7FD81A27B140976EAF437D05B5',
121 repos: 'main universe multiverse restricted',
122 release: 'trusty-backports',
123 pin: { 'priority' => 200, 'release' => 'trusty-backports' })
126 context 'with missing location' do
129 release: 'trusty-backports',
130 repos: 'main universe multiverse restricted',
131 key: '630239CC130E1A7FD81A27B140976EAF437D05B5',
136 is_expected.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
139 context 'with missing release' do
142 location: 'http://archive.ubuntu.com/ubuntu',
143 repos: 'main universe multiverse restricted',
144 key: '630239CC130E1A7FD81A27B140976EAF437D05B5',
149 is_expected.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
152 context 'with missing repos' do
155 location: 'http://archive.ubuntu.com/ubuntu',
156 release: 'trusty-backports',
157 key: '630239CC130E1A7FD81A27B140976EAF437D05B5',
162 is_expected.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
165 context 'with missing key' do
168 location: 'http://archive.ubuntu.com/ubuntu',
169 release: 'trusty-backports',
170 repos: 'main universe multiverse restricted',
175 is_expected.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
179 describe 'validation' do
182 os: { family: 'Debian', name: 'Ubuntu', release: { major: '16', full: '16.04' } },
185 lsbdistcodename: 'xenial',
186 lsbdistrelease: '16.04',
190 context 'with invalid location' do
198 is_expected.to raise_error(Puppet::Error, %r{expects a})
201 context 'with invalid release' do
209 is_expected.to raise_error(Puppet::Error, %r{expects a})
212 context 'with invalid repos' do
220 is_expected.to raise_error(Puppet::Error, %r{expects a})
223 context 'with invalid key' do
231 is_expected.to raise_error(Puppet::Error, %r{expects a})
234 context 'with invalid pin' do
242 is_expected.to raise_error(Puppet::Error, %r{expects a})