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 :os => { :family => 'Debian', :name => 'Debian', :release => { :major => '7', :full => '7.0' }},
11 :lsbdistid => 'Debian',
12 :osfamily => 'Debian',
13 :lsbdistcodename => 'wheezy',
14 :puppetversion => Puppet.version,
17 it { is_expected.to contain_apt__source('backports').with({
18 :location => 'http://deb.debian.org/debian',
19 :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
20 :repos => 'main contrib non-free',
21 :release => 'wheezy-backports',
22 :pin => { 'priority' => 200, 'release' => 'wheezy-backports' },
26 context 'defaults on ubuntu' do
29 :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '14', :full => '14.04' }},
30 :lsbdistid => 'Ubuntu',
31 :osfamily => 'Debian',
32 :lsbdistcodename => 'trusty',
33 :lsbdistrelease => '14.04',
34 :puppetversion => Puppet.version,
37 it { is_expected.to contain_apt__source('backports').with({
38 :location => 'http://archive.ubuntu.com/ubuntu',
39 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
40 :repos => 'main universe multiverse restricted',
41 :release => 'trusty-backports',
42 :pin => { 'priority' => 200, 'release' => 'trusty-backports' },
46 context 'set everything' do
49 :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '14', :full => '14.04' }},
50 :lsbdistid => 'Ubuntu',
51 :osfamily => 'Debian',
52 :lsbdistcodename => 'trusty',
53 :lsbdistrelease => '14.04',
54 :puppetversion => Puppet.version,
59 :location => 'http://archive.ubuntu.com/ubuntu-test',
62 :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
66 it { is_expected.to contain_apt__source('backports').with({
67 :location => 'http://archive.ubuntu.com/ubuntu-test',
68 :key => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
71 :pin => { 'priority' => 90, 'release' => 'vivid' },
75 context 'set things with hashes' do
78 :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '14', :full => '14.04' }},
79 :lsbdistid => 'Ubuntu',
80 :osfamily => 'Debian',
81 :lsbdistcodename => 'trusty',
82 :lsbdistrelease => '14.04',
83 :puppetversion => Puppet.version,
89 'id' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
96 it { is_expected.to contain_apt__source('backports').with({
97 :key => { 'id' => 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553' },
98 :pin => { 'priority' => '90' },
103 describe 'mint tests' do
106 :os => { :family => 'Debian', :name => 'Linuxmint', :release => { :major => '17', :full => '17' }},
107 :lsbdistid => 'linuxmint',
108 :osfamily => 'Debian',
109 :lsbdistcodename => 'qiana',
110 :puppetversion => Puppet.version,
113 context 'sets all the needed things' do
116 :location => 'http://archive.ubuntu.com/ubuntu',
117 :release => 'trusty-backports',
118 :repos => 'main universe multiverse restricted',
119 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
122 it { is_expected.to contain_apt__source('backports').with({
123 :location => 'http://archive.ubuntu.com/ubuntu',
124 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
125 :repos => 'main universe multiverse restricted',
126 :release => 'trusty-backports',
127 :pin => { 'priority' => 200, 'release' => 'trusty-backports' },
131 context 'missing location' do
134 :release => 'trusty-backports',
135 :repos => 'main universe multiverse restricted',
136 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
142 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
145 context 'missing release' do
148 :location => 'http://archive.ubuntu.com/ubuntu',
149 :repos => 'main universe multiverse restricted',
150 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
156 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
159 context 'missing repos' do
162 :location => 'http://archive.ubuntu.com/ubuntu',
163 :release => 'trusty-backports',
164 :key => '630239CC130E1A7FD81A27B140976EAF437D05B5',
170 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
173 context 'missing key' do
176 :location => 'http://archive.ubuntu.com/ubuntu',
177 :release => 'trusty-backports',
178 :repos => 'main universe multiverse restricted',
184 }.to raise_error(Puppet::Error, /If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key/)
188 describe 'validation' do
191 :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '14', :full => '14.04' }},
192 :lsbdistid => 'Ubuntu',
193 :osfamily => 'Debian',
194 :lsbdistcodename => 'trusty',
195 :lsbdistrelease => '14.04',
196 :puppetversion => Puppet.version,
199 context 'invalid location' do
208 }.to raise_error(Puppet::Error, /expects a/)
211 context 'invalid release' do
220 }.to raise_error(Puppet::Error, /expects a/)
223 context 'invalid repos' do
232 }.to raise_error(Puppet::Error, /expects a/)
235 context 'invalid key' do
244 }.to raise_error(Puppet::Error, /expects a/)
247 context 'invalid pin' do
256 }.to raise_error(Puppet::Error, /expects a/)