1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
require 'spec_helper'
describe 'logrotate::base' do
it do
should contain_package('logrotate').with_ensure('latest')
should contain_file('/etc/logrotate.conf').with({
'ensure' => 'file',
'owner' => 'root',
'group' => 'root',
'mode' => '0444',
'source' => 'puppet:///modules/logrotate/etc/logrotate.conf',
'require' => 'Package[logrotate]',
})
should contain_file('/etc/logrotate.d').with({
'ensure' => 'directory',
'owner' => 'root',
'group' => 'root',
'mode' => '0755',
'require' => 'Package[logrotate]',
})
should contain_file('/etc/cron.daily/logrotate').with({
'ensure' => 'file',
'owner' => 'root',
'group' => 'root',
'mode' => '0555',
'source' => 'puppet:///modules/logrotate/etc/cron.daily/logrotate',
'require' => 'Package[logrotate]',
})
end
context 'on Debian' do
let(:facts) { {:osfamily => 'Debian'} }
it { should include_class('logrotate::defaults::debian') }
end
context 'on RedHat' do
let(:facts) { {:osfamily => 'RedHat'} }
it { should include_class('logrotate::defaults::redhat') }
end
context 'on SuSE' do
let(:facts) { {:osfamily => 'SuSE'} }
it { should include_class('logrotate::defaults::suse') }
end
context 'on Gentoo' do
let(:facts) { {:operatingsystem => 'Gentoo'} }
it { should_not include_class('logrotate::defaults::debian') }
it { should_not include_class('logrotate::defaults::redhat') }
it { should_not include_class('logrotate::defaults::suse') }
end
end
|