2018-07-06 09:07:39 -04:00
|
|
|
# encoding: utf-8
|
|
|
|
|
|
|
|
title 'Test logrotate installation'
|
|
|
|
|
2018-11-14 14:48:29 -05:00
|
|
|
case os[:name]
|
2019-08-20 11:29:20 -04:00
|
|
|
when 'redhat', 'centos', 'fedora', 'amazon'
|
2018-11-14 14:48:29 -05:00
|
|
|
pkg = 'cronie'
|
|
|
|
else
|
|
|
|
pkg = 'logrotate'
|
|
|
|
end
|
|
|
|
describe package(pkg) do
|
2018-07-06 09:07:39 -04: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 07:54:02 -04:00
|
|
|
case os[:name]
|
2019-08-20 11:29:20 -04:00
|
|
|
when 'redhat', 'centos', 'fedora', 'amazon'
|
2018-10-26 07:54:02 -04:00
|
|
|
service = 'crond'
|
|
|
|
else
|
|
|
|
service = 'cron'
|
|
|
|
end
|
|
|
|
|
|
|
|
describe service(service) do
|
2018-07-06 09:07:39 -04:00
|
|
|
it { should be_installed }
|
|
|
|
it { should be_enabled }
|
|
|
|
it { should be_running }
|
|
|
|
end
|