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