Skip to content

Commit

Permalink
add mdmonitor service
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Hoblitt committed Nov 7, 2013
1 parent 95bc3f7 commit 3938fcf
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
ensure => present,
}

Package[$mdadm::params::mdadm_package] ->
class { 'mdadm::mdmonitor': }

Package[$mdadm::params::mdadm_package] ->
class { 'mdadm::raid_check':
options => $raid_check_options,
}
Expand Down
12 changes: 12 additions & 0 deletions manifests/mdmonitor.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# == Class: mdadm::mdmonitor
#
# This class should be considered private.
#
class mdadm::mdmonitor {
service { 'mdmonitor':
ensure => 'running',
hasrestart => true,
hasstatus => true,
enable => true,
}
}
23 changes: 17 additions & 6 deletions spec/classes/mdadm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,25 @@

describe 'mdadm', :type => :class do

shared_examples 'mdadm' do
it { should contain_package('mdadm').with_ensure('present') }
it { should include_class('mdadm::params') }
it { should contain_class('mdadm::mdmonitor') }
it do
should contain_service('mdmonitor').with({
:ensure => 'running',
:hasrestart => true,
:hasstatus => true,
:enable => true,
})
end
end

context 'on osfamily RedHat' do
let(:facts) {{ :osfamily => 'RedHat' }}

context 'no params' do
it { should contain_package('mdadm').with_ensure('present') }
it { should include_class('mdadm::params') }
it_behaves_like 'mdadm'
it do
should contain_file('/etc/sysconfig/raid-check').
with_content(/ENABLED="yes"/).
Expand All @@ -23,8 +36,7 @@
context '{}' do
let(:params) {{ :raid_check_options => {} }}

it { should contain_package('mdadm').with_ensure('present') }
it { should include_class('mdadm::params') }
it_behaves_like 'mdadm'
it do
should contain_file('/etc/sysconfig/raid-check').
with_content(/ENABLED="yes"/).
Expand All @@ -50,8 +62,7 @@
}
end

it { should contain_package('mdadm').with_ensure('present') }
it { should include_class('mdadm::params') }
it_behaves_like 'mdadm'
it do
should contain_file('/etc/sysconfig/raid-check').
with_content(/ENABLED="foo"/).
Expand Down

0 comments on commit 3938fcf

Please sign in to comment.