Skip to content

Commit

Permalink
tidy up smartd.conf content tests based on megaraid facts
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Hoblitt committed Sep 14, 2013
1 parent 819db0b commit 2a24156
Showing 1 changed file with 50 additions and 69 deletions.
119 changes: 50 additions & 69 deletions spec/classes/smartd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -259,78 +259,59 @@
end


let(:facts) { {:osfamily=> 'RedHat', :lsbmajordistrelease => 6} }

context 'without params' do
it do
should include_class('smartd')
should include_class('smartd::params')
should contain_package('smartmontools')
should contain_service('smartd')
should contain_file('/etc/smartd.conf')\
.with_content(<<-END.gsub(/^\s+/, ""))
# Managed by Puppet -- do not edit!
DEFAULT -m root -M daily
DEVICESCAN
END
end
end

context 'without params + megaraid facts' do
let(:facts) do
{
:osfamily=> 'RedHat', :lsbmajordistrelease => 6,
:megaraid_adapters => '1',
:megaraid_virtual_drives => '/dev/sdb,/dev/sda',
:megaraid_physical_drives => '2,1',
}
end

it do
should include_class('smartd')
should include_class('smartd::params')
should contain_package('smartmontools')
should contain_service('smartd')
should contain_file('/etc/smartd.conf')\
.with_content(<<-END.gsub(/^\s+/, ""))
# Managed by Puppet -- do not edit!
DEFAULT -m root -M daily
/dev/sda -d sat+megaraid,1
/dev/sda -d sat+megaraid,2
DEVICESCAN
END
end
end

context 'without params + megaraid facts' do
let(:facts) do
{
:osfamily=> 'RedHat', :lsbmajordistrelease => 6,
:megaraid_adapters => '1',
:megaraid_virtual_drives => '/dev/sdb,/dev/sda',
:megaraid_physical_drives => '2,1',
}
end
describe 'megaraid support' do

context 'without params + megaraid facts' do
let(:facts) do
{
:osfamily=> 'RedHat',
:megaraid_adapters => '1',
:megaraid_virtual_drives => '/dev/sdb,/dev/sda',
:megaraid_physical_drives => '2,1',
}
end

let(:params) do
{
:device_opts => { 'megaraid' => '-I 194'},
}
it do
should contain_file('/etc/smartd.conf')\
.with_content(<<-END.gsub(/^\s+/, ""))
# Managed by Puppet -- do not edit!
DEFAULT -m root -M daily
/dev/sda -d sat+megaraid,1
/dev/sda -d sat+megaraid,2
DEVICESCAN
END
end
end

it do
should include_class('smartd')
should include_class('smartd::params')
should contain_package('smartmontools')
should contain_service('smartd')
should contain_file('/etc/smartd.conf')\
.with_content(<<-END.gsub(/^\s+/, ""))
# Managed by Puppet -- do not edit!
DEFAULT -m root -M daily
/dev/sda -d sat+megaraid,1 -I 194
/dev/sda -d sat+megaraid,2 -I 194
DEVICESCAN
END
context 'without params + megaraid facts' do
let(:facts) do
{
:osfamily=> 'RedHat',
:megaraid_adapters => '1',
:megaraid_virtual_drives => '/dev/sdb,/dev/sda',
:megaraid_physical_drives => '2,1',
}
end
let(:params) do
{
:device_opts => { 'megaraid' => '-I 194'},
}
end

it do
should include_class('smartd')
should include_class('smartd::params')
should contain_package('smartmontools')
should contain_service('smartd')
should contain_file('/etc/smartd.conf')\
.with_content(<<-END.gsub(/^\s+/, ""))
# Managed by Puppet -- do not edit!
DEFAULT -m root -M daily
/dev/sda -d sat+megaraid,1 -I 194
/dev/sda -d sat+megaraid,2 -I 194
DEVICESCAN
END
end
end
end
end

0 comments on commit 2a24156

Please sign in to comment.