2 describe 'apt::unattended_upgrades', :type => :class do
4 it { should contain_package("unattended-upgrades") }
7 should create_file("/etc/apt/apt.conf.d/50unattended-upgrades").with({
15 should create_file("/etc/apt/apt.conf.d/10periodic").with({
22 describe "with origins => ['ubuntu:precise-security']" do
24 { :origins => ['ubuntu:precise-security'] }
26 it { should contain_file('/etc/apt/apt.conf.d/50unattended-upgrades').with_content(/^Unattended-Upgrade::Allowed-Origins \{\n\t"ubuntu:precise-security";\n\};$/) }
29 describe "with blacklist => []" do
33 it { should contain_file('/etc/apt/apt.conf.d/50unattended-upgrades').with_content(/^Unattended-Upgrade::Package-Blacklist \{\n\};$/) }
36 describe "with update => 2" do
40 it { should contain_file('/etc/apt/apt.conf.d/10periodic').with_content(/^APT::Periodic::Update-Package-Lists "2";$/) }
43 describe "with download => 2" do
47 it { should contain_file('/etc/apt/apt.conf.d/10periodic').with_content(/^APT::Periodic::Download-Upgradeable-Packages "2";$/) }
50 describe "with upgrade => 2" do
54 it { should contain_file('/etc/apt/apt.conf.d/10periodic').with_content(/^APT::Periodic::Unattended-Upgrade "2";$/) }
57 describe "with autoclean => 2" do
61 it { should contain_file('/etc/apt/apt.conf.d/10periodic').with_content(/^APT::Periodic::AutocleanInterval "2";$/) }
64 describe "with auto_fix => false" do
66 { :auto_fix => false }
68 it { should contain_file('/etc/apt/apt.conf.d/50unattended-upgrades').with_content(/^Unattended-Upgrade::AutoFixInterruptedDpkg "false";$/) }
71 describe "with minimal_steps => true" do
73 { :minimal_steps => true }
75 it { should contain_file('/etc/apt/apt.conf.d/50unattended-upgrades').with_content(/^Unattended-Upgrade::MinimalSteps "true";$/) }
78 describe "with install_on_shutdown => true" do
80 { :install_on_shutdown => true }
82 it { should contain_file('/etc/apt/apt.conf.d/50unattended-upgrades').with_content(/^Unattended-Upgrade::InstallOnShutdown "true";$/) }
85 describe "with mail_to => NONE" do
87 { :mail_to => "NONE" }
89 it { should contain_file('/etc/apt/apt.conf.d/50unattended-upgrades').with_content(/^\/\/ 'mailx' must be installed.\n$/) }
90 it { should contain_file('/etc/apt/apt.conf.d/50unattended-upgrades').with_content(/^\/\/ is to always send a mail if Unattended-Upgrade::Mail is set\n$/) }
93 describe "with mail_to => user@website, mail_only_on_error => true" do
95 { :mail_to => "user@website",
96 :mail_only_on_error => true }
98 it { should contain_file('/etc/apt/apt.conf.d/50unattended-upgrades').with_content(/^Unattended-Upgrade::Mail "user@website";$/) }
99 it { should contain_file('/etc/apt/apt.conf.d/50unattended-upgrades').with_content(/^Unattended-Upgrade::MailOnlyOnError "true";$/) }
102 describe "with remove_unused => false" do
104 { :remove_unused => false }
106 it { should contain_file('/etc/apt/apt.conf.d/50unattended-upgrades').with_content(/^Unattended-Upgrade::Remove-Unused-Dependencies "false";$/) }
109 describe "with auto_reboot => true" do
111 { :auto_reboot => true }
113 it { should contain_file('/etc/apt/apt.conf.d/50unattended-upgrades').with_content(/^Unattended-Upgrade::Automatic-Reboot "true";$/) }
116 describe "with dl_limit => 70" do
118 { :dl_limit => "70" }
120 it { should contain_file('/etc/apt/apt.conf.d/50unattended-upgrades').with_content(/^Acquire::http::Dl-Limit "70";$/) }
123 describe "with enable => 0" do
127 it { should contain_file('/etc/apt/apt.conf.d/10periodic').with_content(/^APT::Periodic::Enable "0";$/) }
130 describe "with backup_interval => 1" do
132 { :backup_interval => "1" }
134 it { should contain_file('/etc/apt/apt.conf.d/10periodic').with_content(/^APT::Periodic::BackUpArchiveInterval "1";$/) }
137 describe "with backup_level => 0" do
139 { :backup_level => "0" }
141 it { should contain_file('/etc/apt/apt.conf.d/10periodic').with_content(/^APT::Periodic::BackUpLevel "0";$/) }
144 describe "with max_age => 1" do
148 it { should contain_file('/etc/apt/apt.conf.d/10periodic').with_content(/^APT::Periodic::MaxAge "1";$/) }
151 describe "with min_age => 1" do
155 it { should contain_file('/etc/apt/apt.conf.d/10periodic').with_content(/^APT::Periodic::MinAge "1";$/) }
158 describe "with max_size => 1" do
162 it { should contain_file('/etc/apt/apt.conf.d/10periodic').with_content(/^APT::Periodic::MaxSize "1";$/) }
165 describe "with download_delta => 2" do
167 { :download_delta => "2" }
169 it { should contain_file('/etc/apt/apt.conf.d/10periodic').with_content(/^APT::Periodic::Download-Upgradeable-Packages-Debdelta "2";$/) }
172 describe "with verbose => 2" do
176 it { should contain_file('/etc/apt/apt.conf.d/10periodic').with_content(/^APT::Periodic::Verbose "2";$/) }