1
0
Fork 0

test(base): update from `template-formula` and Arch Linux exclusion

This commit is contained in:
Imran Iqbal 2021-02-22 16:30:01 +00:00
parent b2e67d64fa
commit 09d4f5a034
No known key found for this signature in database
GPG Key ID: 6D8629439D2B7819
1 changed files with 52 additions and 28 deletions

View File

@ -2,39 +2,63 @@
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'
else pkg =
pkg = 'logrotate' case platform[:name]
end when 'redhat', 'centos', 'fedora', 'amazon', 'oracle'
describe package(pkg) do 'cronie'
it { should be_installed } else
'logrotate'
end
describe package(pkg) do
it { should be_installed }
end
end end
describe file('/etc/logrotate.conf') do control 'logrotate-config.file.managed' do
it { should exist } title 'Verify the configuration file'
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' } describe file('/etc/logrotate.conf') do
its('mode') { should cmp '0644' } it { should exist }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its('mode') { should cmp '0644' }
end
end end
describe file('/etc/logrotate.d') do control 'logrotate-directory.file.directory' do
it { should be_directory } title 'Verify the `.d` directory'
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' } describe file('/etc/logrotate.d') do
its('mode') { should cmp '0755' } it { should be_directory }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its('mode') { should cmp '0755' }
end
end end
case os[:name]
when 'redhat', 'centos', 'fedora', 'amazon'
service = 'crond'
else
service = 'cron'
end
describe service(service) do control 'logrotate.service.running' do
it { should be_installed } title 'The service should be installed, enabled and running'
it { should be_enabled }
it { should be_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
'cron'
end
describe service(service) do
it { should be_installed }
it { should be_enabled }
it { should be_running }
end
end end