test(base): update from template-formula
and Arch Linux exclusion
This commit is contained in:
parent
b2e67d64fa
commit
09d4f5a034
1 changed files with 52 additions and 28 deletions
|
@ -2,15 +2,24 @@
|
||||||
|
|
||||||
title 'Test logrotate installation'
|
title 'Test logrotate installation'
|
||||||
|
|
||||||
case os[:name]
|
control 'logrotate-pkg.pkg.installed' do
|
||||||
when 'redhat', 'centos', 'fedora', 'amazon'
|
title 'The required package should be installed'
|
||||||
pkg = 'cronie'
|
|
||||||
|
pkg =
|
||||||
|
case platform[:name]
|
||||||
|
when 'redhat', 'centos', 'fedora', 'amazon', 'oracle'
|
||||||
|
'cronie'
|
||||||
else
|
else
|
||||||
pkg = 'logrotate'
|
'logrotate'
|
||||||
end
|
end
|
||||||
|
|
||||||
describe package(pkg) do
|
describe package(pkg) do
|
||||||
it { should be_installed }
|
it { should be_installed }
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
control 'logrotate-config.file.managed' do
|
||||||
|
title 'Verify the configuration file'
|
||||||
|
|
||||||
describe file('/etc/logrotate.conf') do
|
describe file('/etc/logrotate.conf') do
|
||||||
it { should exist }
|
it { should exist }
|
||||||
|
@ -18,6 +27,10 @@ describe file('/etc/logrotate.conf') do
|
||||||
it { should be_grouped_into 'root' }
|
it { should be_grouped_into 'root' }
|
||||||
its('mode') { should cmp '0644' }
|
its('mode') { should cmp '0644' }
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
control 'logrotate-directory.file.directory' do
|
||||||
|
title 'Verify the `.d` directory'
|
||||||
|
|
||||||
describe file('/etc/logrotate.d') do
|
describe file('/etc/logrotate.d') do
|
||||||
it { should be_directory }
|
it { should be_directory }
|
||||||
|
@ -25,12 +38,22 @@ describe file('/etc/logrotate.d') do
|
||||||
it { should be_grouped_into 'root' }
|
it { should be_grouped_into 'root' }
|
||||||
its('mode') { should cmp '0755' }
|
its('mode') { should cmp '0755' }
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
case os[:name]
|
|
||||||
when 'redhat', 'centos', 'fedora', 'amazon'
|
control 'logrotate.service.running' do
|
||||||
service = 'crond'
|
title 'The service should be installed, enabled and running'
|
||||||
|
|
||||||
|
only_if('Disabled on Arch Linux') do
|
||||||
|
!%w[arch].include?(platform[:name])
|
||||||
|
end
|
||||||
|
|
||||||
|
service =
|
||||||
|
case platform[:name]
|
||||||
|
when 'redhat', 'centos', 'fedora', 'amazon', 'oracle'
|
||||||
|
'crond'
|
||||||
else
|
else
|
||||||
service = 'cron'
|
'cron'
|
||||||
end
|
end
|
||||||
|
|
||||||
describe service(service) do
|
describe service(service) do
|
||||||
|
@ -38,3 +61,4 @@ describe service(service) do
|
||||||
it { should be_enabled }
|
it { should be_enabled }
|
||||||
it { should be_running }
|
it { should be_running }
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in a new issue