Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Debian based os support #23

Merged
merged 9 commits into from
Jun 30, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adds Debian specific specs
  • Loading branch information
petems committed Jun 30, 2016
commit f66a6d2245971c1a321816605097a0f6df8515b1
239 changes: 239 additions & 0 deletions spec/classes/ipmi_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,243 @@

end

describe 'for osfamily Debian' do
let :facts do
{
:osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
}
end

describe 'no params' do
it { should create_class('ipmi') }
it { should contain_class('ipmi::params') }
it { should contain_class('ipmi::install') }
it { should contain_class('ipmi::config') }
it do
should contain_augeas('/etc/default/openipmi').with({
'context' => '/files/etc/default/openipmi',
'changes' => [
'set IPMI_WATCHDOG no',
],
})
end
it do
should contain_class('ipmi::service::ipmi').with({
:ensure => 'running',
:enable => true,
})
end
it do
should contain_class('ipmi::service::ipmievd').with({
:ensure => 'stopped',
:enable => false,
})
end
end

describe 'service_ensure => running' do
let(:params) {{ :service_ensure => 'running' }}

it { should create_class('ipmi') }
it { should contain_class('ipmi::params') }
it { should contain_class('ipmi::install') }
it { should contain_class('ipmi::config') }
it do
should contain_augeas('/etc/default/openipmi').with({
'context' => '/files/etc/default/openipmi',
'changes' => [
'set IPMI_WATCHDOG no',
],
})
end
it do
should contain_class('ipmi::service::ipmi').with({
:ensure => 'running',
:enable => true,
})
end
it do
should contain_class('ipmi::service::ipmievd').with({
:ensure => 'stopped',
:enable => false,
})
end
end

describe 'service_ensure => stopped' do
let(:params) {{ :service_ensure => 'stopped' }}

it { should create_class('ipmi') }
it { should contain_class('ipmi::params') }
it { should contain_class('ipmi::install') }
it { should contain_class('ipmi::config') }
it do
should contain_augeas('/etc/default/openipmi').with({
'context' => '/files/etc/default/openipmi',
'changes' => [
'set IPMI_WATCHDOG no',
],
})
end
it do
should contain_class('ipmi::service::ipmi').with({
:ensure => 'stopped',
:enable => false,
})
end
it do
should contain_class('ipmi::service::ipmievd').with({
:ensure => 'stopped',
:enable => false,
})
end
end

describe 'service_ensure => invalid-string' do
let(:params) {{ :service_ensure => 'invalid-string' }}

it 'should fail' do
expect {
should contain_class('ipmi')
}.to raise_error(Puppet::Error, /does not match/)
end
end

describe 'ipmievd_service_ensure => running' do
let(:params) {{ :ipmievd_service_ensure => 'running' }}

it { should create_class('ipmi') }
it { should contain_class('ipmi::params') }
it { should contain_class('ipmi::install') }
it { should contain_class('ipmi::config') }
it do
should contain_augeas('/etc/default/openipmi').with({
'context' => '/files/etc/default/openipmi',
'changes' => [
'set IPMI_WATCHDOG no',
],
})
end
it do
should contain_class('ipmi::service::ipmi').with({
:ensure => 'running',
:enable => true,
})
end
it do
should contain_class('ipmi::service::ipmievd').with({
:ensure => 'running',
:enable => true,
})
end
end

describe 'ipmievd_service_ensure => stopped' do
let(:params) {{ :ipmievd_service_ensure => 'stopped' }}

it { should create_class('ipmi') }
it { should contain_class('ipmi::params') }
it { should contain_class('ipmi::install') }
it { should contain_class('ipmi::config') }
it do
should contain_augeas('/etc/default/openipmi').with({
'context' => '/files/etc/default/openipmi',
'changes' => [
'set IPMI_WATCHDOG no',
],
})
end
it do
should contain_class('ipmi::service::ipmi').with({
:ensure => 'running',
:enable => true,
})
end
it do
should contain_class('ipmi::service::ipmievd').with({
:ensure => 'stopped',
:enable => false,
})
end
end

describe 'ipmievd_service_ensure => invalid-string' do
let(:params) {{ :ipmievd_service_ensure => 'invalid-string' }}

it 'should fail' do
expect {
should contain_class('ipmi')
}.to raise_error(Puppet::Error, /does not match/)
end
end

describe 'watchdog => true' do
let(:params) {{ :watchdog => true }}

it { should contain_class('ipmi::params') }
it { should contain_class('ipmi::install') }
it { should contain_class('ipmi::config') }
it do
should contain_augeas('/etc/default/openipmi').with({
'context' => '/files/etc/default/openipmi',
'changes' => [
'set IPMI_WATCHDOG yes',
],
})
end
it do
should contain_class('ipmi::service::ipmi').with({
:ensure => 'running',
:enable => true,
})
end
it do
should contain_class('ipmi::service::ipmievd').with({
:ensure => 'stopped',
:enable => false,
})
end
end

describe 'watchdog => false' do
let(:params) {{ :watchdog => false }}

it { should contain_class('ipmi::params') }
it { should contain_class('ipmi::install') }
it { should contain_class('ipmi::config') }
it do
should contain_augeas('/etc/default/openipmi').with({
'context' => '/files/etc/default/openipmi',
'changes' => [
'set IPMI_WATCHDOG no',
],
})
end
it do
should contain_class('ipmi::service::ipmi').with({
:ensure => 'running',
:enable => true,
})
end
it do
should contain_class('ipmi::service::ipmievd').with({
:ensure => 'stopped',
:enable => false,
})
end
end

describe 'watchdog => invalid-string' do
let(:params) {{ :watchdog => 'invalid-string' }}

it 'should fail' do
expect {
should contain_class('ipmi')
}.to raise_error(Puppet::Error, /is not a boolean/)
end
end

end

end