1 require 'spec_helper_acceptance'
3 describe 'apt::unattended_upgrades class' do
5 it 'should work with no errors' do
8 include apt::unattended_upgrades
11 apply_manifest(pp, :catch_failures => true)
14 describe file('/etc/apt/apt.conf.d/10periodic') do
17 describe file('/etc/apt/apt.conf.d/50unattended-upgrades') do
23 it 'should work with no errors' do
26 class { 'apt::unattended_upgrades':
27 origins => ['${distro_id}:${distro_codename}-test'],
31 apply_manifest(pp, :catch_failures => true)
34 describe file('/etc/apt/apt.conf.d/50unattended-upgrades') do
36 it { should contain '${distro_id}:${distro_codename}-test' }
40 context 'blacklist' do
41 it 'should work with no errors' do
44 class { 'apt::unattended_upgrades':
45 blacklist => ['puppet']
49 apply_manifest(pp, :catch_failures => true)
52 describe file('/etc/apt/apt.conf.d/50unattended-upgrades') do
54 it { should contain 'puppet' }
59 it 'should work with no errors' do
62 class { 'apt::unattended_upgrades':
67 apply_manifest(pp, :catch_failures => true)
70 describe file('/etc/apt/apt.conf.d/10periodic') do
72 it { should contain 'APT::Periodic::Update-Package-Lists "99";' }
77 it 'should work with no errors' do
80 class { 'apt::unattended_upgrades':
85 apply_manifest(pp, :catch_failures => true)
88 describe file('/etc/apt/apt.conf.d/10periodic') do
90 it { should contain 'APT::Periodic::Download-Upgradeable-Packages "99";' }
95 it 'should work with no errors' do
98 class { 'apt::unattended_upgrades':
103 apply_manifest(pp, :catch_failures => true)
106 describe file('/etc/apt/apt.conf.d/10periodic') do
107 it { should be_file }
108 it { should contain 'APT::Periodic::Unattended-Upgrade "99";' }
112 context 'autoclean' do
113 it 'should work with no errors' do
116 class { 'apt::unattended_upgrades':
121 apply_manifest(pp, :catch_failures => true)
124 describe file('/etc/apt/apt.conf.d/10periodic') do
125 it { should be_file }
126 it { should contain 'APT::Periodic::AutocleanInterval "99";' }
130 context 'auto_fix' do
132 it 'should work with no errors' do
135 class { 'apt::unattended_upgrades':
140 apply_manifest(pp, :catch_failures => true)
143 describe file('/etc/apt/apt.conf.d/50unattended-upgrades') do
144 it { should be_file }
145 it { should contain 'Unattended-Upgrade::AutoFixInterruptedDpkg "true";' }
150 it 'should work with no errors' do
153 class { 'apt::unattended_upgrades':
158 apply_manifest(pp, :catch_failures => true)
161 describe file('/etc/apt/apt.conf.d/50unattended-upgrades') do
162 it { should be_file }
163 it { should contain 'Unattended-Upgrade::AutoFixInterruptedDpkg "false";' }
168 context 'minimal_steps' do
170 it 'should work with no errors' do
173 class { 'apt::unattended_upgrades':
174 minimal_steps => true
178 apply_manifest(pp, :catch_failures => true)
181 describe file('/etc/apt/apt.conf.d/50unattended-upgrades') do
182 it { should be_file }
183 it { should contain 'Unattended-Upgrade::MinimalSteps "true";' }
188 it 'should work with no errors' do
191 class { 'apt::unattended_upgrades':
192 minimal_steps => false
196 apply_manifest(pp, :catch_failures => true)
199 describe file('/etc/apt/apt.conf.d/50unattended-upgrades') do
200 it { should be_file }
201 it { should contain 'Unattended-Upgrade::MinimalSteps "false";' }
206 context 'install_on_shutdown' do
208 it 'should work with no errors' do
211 class { 'apt::unattended_upgrades':
212 install_on_shutdown => true
216 apply_manifest(pp, :catch_failures => true)
219 describe file('/etc/apt/apt.conf.d/50unattended-upgrades') do
220 it { should be_file }
221 it { should contain 'Unattended-Upgrade::InstallOnShutdown "true";' }
226 it 'should work with no errors' do
229 class { 'apt::unattended_upgrades':
230 install_on_shutdown => false
234 apply_manifest(pp, :catch_failures => true)
237 describe file('/etc/apt/apt.conf.d/50unattended-upgrades') do
238 it { should be_file }
239 it { should contain 'Unattended-Upgrade::InstallOnShutdown "false";' }
245 it 'should work with no errors' do
248 class { 'apt::unattended_upgrades':
249 mail_to => 'test@example.com'
253 apply_manifest(pp, :catch_failures => true)
256 describe file('/etc/apt/apt.conf.d/50unattended-upgrades') do
257 it { should be_file }
258 it { should contain 'Unattended-Upgrade::Mail "test@example.com";' }
262 context 'mail_only_on_error' do
264 it 'should work with no errors' do
267 class { 'apt::unattended_upgrades':
268 mail_to => 'test@example.com',
269 mail_only_on_error => true
273 apply_manifest(pp, :catch_failures => true)
276 describe file('/etc/apt/apt.conf.d/50unattended-upgrades') do
277 it { should be_file }
278 it { should contain 'Unattended-Upgrade::MailOnlyOnError "true";' }
283 it 'should work with no errors' do
286 class { 'apt::unattended_upgrades':
287 mail_to => 'test@example.com',
288 mail_only_on_error => false,
292 apply_manifest(pp, :catch_failures => true)
295 describe file('/etc/apt/apt.conf.d/50unattended-upgrades') do
296 it { should be_file }
297 it { should contain 'Unattended-Upgrade::MailOnlyOnError "false";' }
301 context 'mail_to missing' do
302 it 'should work with no errors' do
305 class { 'apt::unattended_upgrades':
306 mail_only_on_error => true,
310 apply_manifest(pp, :catch_failures => true)
313 describe file('/etc/apt/apt.conf.d/50unattended-upgrades') do
314 it { should be_file }
315 it { should_not contain 'Unattended-Upgrade::MailOnlyOnError "true";' }
320 context 'remove_unused' do
322 it 'should work with no errors' do
325 class { 'apt::unattended_upgrades':
326 remove_unused => true
330 apply_manifest(pp, :catch_failures => true)
333 describe file('/etc/apt/apt.conf.d/50unattended-upgrades') do
334 it { should be_file }
335 it { should contain 'Unattended-Upgrade::Remove-Unused-Dependencies "true";' }
340 it 'should work with no errors' do
343 class { 'apt::unattended_upgrades':
344 remove_unused => false,
348 apply_manifest(pp, :catch_failures => true)
351 describe file('/etc/apt/apt.conf.d/50unattended-upgrades') do
352 it { should be_file }
353 it { should contain 'Unattended-Upgrade::Remove-Unused-Dependencies "false";' }
358 context 'auto_reboot' do
360 it 'should work with no errors' do
363 class { 'apt::unattended_upgrades':
368 apply_manifest(pp, :catch_failures => true)
371 describe file('/etc/apt/apt.conf.d/50unattended-upgrades') do
372 it { should be_file }
373 it { should contain 'Unattended-Upgrade::Automatic-Reboot "true";' }
378 it 'should work with no errors' do
381 class { 'apt::unattended_upgrades':
382 auto_reboot => false,
386 apply_manifest(pp, :catch_failures => true)
389 describe file('/etc/apt/apt.conf.d/50unattended-upgrades') do
390 it { should be_file }
391 it { should contain 'Unattended-Upgrade::Automatic-Reboot "false";' }
396 context 'dl_limit' do
397 it 'should work with no errors' do
400 class { 'apt::unattended_upgrades':
405 apply_manifest(pp, :catch_failures => true)
408 describe file('/etc/apt/apt.conf.d/50unattended-upgrades') do
409 it { should be_file }
410 it { should contain 'Acquire::http::Dl-Limit "99"' }
415 it 'should work with no errors' do
418 class { 'apt::unattended_upgrades':
423 apply_manifest(pp, :catch_failures => true)
426 describe file('/etc/apt/apt.conf.d/10periodic') do
427 it { should be_file }
428 it { should contain 'APT::Periodic::Enable "2"' }
432 context 'backup_interval' do
433 it 'should work with no errors' do
436 class { 'apt::unattended_upgrades':
437 backup_interval => '2'
441 apply_manifest(pp, :catch_failures => true)
444 describe file('/etc/apt/apt.conf.d/10periodic') do
445 it { should be_file }
446 it { should contain 'APT::Periodic::BackUpArchiveInterval "2";' }
450 context 'backup_level' do
451 it 'should work with no errors' do
454 class { 'apt::unattended_upgrades':
459 apply_manifest(pp, :catch_failures => true)
462 describe file('/etc/apt/apt.conf.d/10periodic') do
463 it { should be_file }
464 it { should contain 'APT::Periodic::BackUpLevel "2";' }
469 it 'should work with no errors' do
472 class { 'apt::unattended_upgrades':
477 apply_manifest(pp, :catch_failures => true)
480 describe file('/etc/apt/apt.conf.d/10periodic') do
481 it { should be_file }
482 it { should contain 'APT::Periodic::MaxAge "2";' }
487 it 'should work with no errors' do
490 class { 'apt::unattended_upgrades':
495 apply_manifest(pp, :catch_failures => true)
498 describe file('/etc/apt/apt.conf.d/10periodic') do
499 it { should be_file }
500 it { should contain 'APT::Periodic::MinAge "2";' }
504 context 'max_size' do
505 it 'should work with no errors' do
508 class { 'apt::unattended_upgrades':
513 apply_manifest(pp, :catch_failures => true)
516 describe file('/etc/apt/apt.conf.d/10periodic') do
517 it { should be_file }
518 it { should contain 'APT::Periodic::MaxSize "2";' }
522 context 'download_delta' do
523 it 'should work with no errors' do
526 class { 'apt::unattended_upgrades':
527 download_delta => '2'
531 apply_manifest(pp, :catch_failures => true)
534 describe file('/etc/apt/apt.conf.d/10periodic') do
535 it { should be_file }
536 it { should contain 'APT::Periodic::Download-Upgradeable-Packages-Debdelta "2";' }
541 it 'should work with no errors' do
544 class { 'apt::unattended_upgrades':
549 apply_manifest(pp, :catch_failures => true)
552 describe file('/etc/apt/apt.conf.d/10periodic') do
553 it { should be_file }
554 it { should contain 'APT::Periodic::Verbose "2";' }