2018-07-06 15:07:39 +02:00
|
|
|
# encoding: utf-8
|
|
|
|
|
|
|
|
title 'Test logrotate installation'
|
|
|
|
|
2018-11-14 16:48:29 -03:00
|
|
|
case os[:name]
|
2019-08-20 16:29:20 +01:00
|
|
|
when 'redhat', 'centos', 'fedora', 'amazon'
|
2018-11-14 16:48:29 -03:00
|
|
|
pkg = 'cronie'
|
|
|
|
else
|
|
|
|
pkg = 'logrotate'
|
|
|
|
end
|
|
|
|
describe package(pkg) do
|
2018-07-06 15:07:39 +02:00
|
|
|
it { should be_installed }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe file('/etc/logrotate.conf') do
|
|
|
|
it { should exist }
|
|
|
|
it { should be_owned_by 'root' }
|
|
|
|
it { should be_grouped_into 'root' }
|
|
|
|
its('mode') { should cmp '0644' }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe file('/etc/logrotate.d') do
|
|
|
|
it { should be_directory }
|
|
|
|
it { should be_owned_by 'root' }
|
|
|
|
it { should be_grouped_into 'root' }
|
|
|
|
its('mode') { should cmp '0755' }
|
|
|
|
end
|
|
|
|
|
2018-10-26 08:54:02 -03:00
|
|
|
case os[:name]
|
2019-08-20 16:29:20 +01:00
|
|
|
when 'redhat', 'centos', 'fedora', 'amazon'
|
2018-10-26 08:54:02 -03:00
|
|
|
service = 'crond'
|
|
|
|
else
|
|
|
|
service = 'cron'
|
|
|
|
end
|
|
|
|
|
|
|
|
describe service(service) do
|
2018-07-06 15:07:39 +02:00
|
|
|
it { should be_installed }
|
|
|
|
it { should be_enabled }
|
|
|
|
it { should be_running }
|
|
|
|
end
|