-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add sysstat::params class and improve test coverage
- Loading branch information
Joshua Hoblitt
committed
Aug 29, 2013
1 parent
66d1367
commit 95cb003
Showing
7 changed files
with
99 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# == Class: sysstat::params | ||
# | ||
# This class should be considered private. | ||
# | ||
# === Authors | ||
# | ||
# Joshua Hoblitt <[email protected]> | ||
# | ||
# === Copyright | ||
# | ||
# Copyright (C) 2013 Joshua Hoblitt | ||
# | ||
class sysstat::params { | ||
case $::osfamily { | ||
'redhat': { | ||
$sysstat_package = 'sysstat' | ||
} | ||
default: { | ||
fail("Module ${module_name} is not supported on ${::operatingsystem}") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require 'spec_helper' | ||
|
||
describe 'sysstat::install', :type => :class do | ||
let :pre_condition do | ||
'include sysstat::params' | ||
end | ||
|
||
describe 'for osfamily RedHat' do | ||
let :facts do | ||
{ | ||
:osfamily => 'RedHat', | ||
} | ||
end | ||
|
||
it { should include_class('sysstat::install') } | ||
it { should contain_package('sysstat').with_ensure('present') } | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'spec_helper' | ||
|
||
describe 'sysstat::params', :type => :class do | ||
describe 'for osfamily RedHat' do | ||
let :facts do | ||
{ | ||
:osfamily => 'RedHat', | ||
} | ||
end | ||
|
||
it { should include_class('sysstat::params') } | ||
end | ||
|
||
describe 'unsupported osfamily' do | ||
let :facts do | ||
{ | ||
:osfamily => 'Debian', | ||
:operatingsystem => 'Debian', | ||
} | ||
end | ||
|
||
it 'should fail' do | ||
expect { should include_class('sysstat::params') }. | ||
to raise_error(Puppet::Error, /not supported on Debian/) | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require 'spec_helper' | ||
|
||
describe 'sysstat::service', :type => :class do | ||
|
||
it do | ||
should contain_service('sysstat').with({ | ||
:hasstatus => 'false', | ||
:hasrestart => 'true', | ||
:enable => 'true', | ||
}) | ||
end | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
require 'spec_helper' | ||
|
||
describe 'sysstat', :type => :class do | ||
it { should contain_class('sysstat') } | ||
it { should contain_class('sysstat::install') } | ||
it { should contain_package('sysstat').with_ensure('present') } | ||
it { should contain_class('sysstat::service') } | ||
|
||
describe 'for osfamily RedHat' do | ||
let :facts do | ||
{ | ||
:osfamily => 'RedHat', | ||
} | ||
end | ||
|
||
it { should include_class('sysstat') } | ||
it { should include_class('sysstat::params') } | ||
it { should include_class('sysstat::install') } | ||
it { should include_class('sysstat::service') } | ||
end | ||
|
||
end |