-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from LarsFronius/master
Several fixes
- Loading branch information
Showing
4 changed files
with
69 additions
and
46 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 |
---|---|---|
|
@@ -28,6 +28,7 @@ | |
purge => true, | ||
recurse => true, | ||
force => true, | ||
require => Package['sensu'] | ||
} | ||
} | ||
|
||
|
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,50 +1,70 @@ | ||
require 'spec_helper' | ||
|
||
describe 'sensu::check', :type => :define do | ||
let(:title) { 'mycheck' } | ||
context 'without whitespace in name' do | ||
let(:title) { 'mycheck' } | ||
|
||
context 'defaults' do | ||
let(:params) { { :command => '/etc/sensu/somecommand.rb' } } | ||
context 'defaults' do | ||
let(:params) { { :command => '/etc/sensu/somecommand.rb' } } | ||
|
||
it { should contain_sensu_check('mycheck').with( | ||
'command' => '/etc/sensu/somecommand.rb', | ||
'handlers' => [], | ||
'interval' => '60', | ||
'subscribers' => [] | ||
) } | ||
it { should contain_sensu_check('mycheck').with( | ||
'command' => '/etc/sensu/somecommand.rb', | ||
'handlers' => [], | ||
'interval' => '60', | ||
'subscribers' => [] | ||
) } | ||
|
||
end | ||
end | ||
|
||
context 'setting params' do | ||
let(:params) { { | ||
:command => '/etc/sensu/command2.rb', | ||
:handlers => ['/handler1', '/handler2'], | ||
:interval => '10', | ||
:subscribers => ['all'], | ||
:custom => { 'a' => 'b', 'array' => [ 'c', 'd']}, | ||
:type => 'metric', | ||
:standalone => true, | ||
:low_flap_threshold => 10, | ||
:high_flap_threshold => 15 | ||
} } | ||
|
||
it { should contain_sensu_check('mycheck').with( | ||
'command' => '/etc/sensu/command2.rb', | ||
'handlers' => ['/handler1', '/handler2'], | ||
'interval' => '10', | ||
'subscribers' => ['all'], | ||
'custom' => { 'a' => 'b', 'array' => [ 'c', 'd']}, | ||
'type' => 'metric', | ||
'standalone' => true, | ||
'low_flap_threshold' => '10', | ||
'high_flap_threshold' => '15' | ||
) } | ||
end | ||
|
||
context 'ensure absent' do | ||
let(:params) { { :command => '/etc/sensu/somecommand.rb', :ensure => 'absent' } } | ||
|
||
context 'setting params' do | ||
let(:params) { { | ||
:command => '/etc/sensu/command2.rb', | ||
:handlers => ['/handler1', '/handler2'], | ||
:interval => '10', | ||
:subscribers => ['all'], | ||
:custom => { 'a' => 'b', 'array' => [ 'c', 'd']}, | ||
:type => 'metric', | ||
:standalone => true, | ||
:low_flap_threshold => 10, | ||
:high_flap_threshold => 15 | ||
} } | ||
|
||
it { should contain_sensu_check('mycheck').with( | ||
'command' => '/etc/sensu/command2.rb', | ||
'handlers' => ['/handler1', '/handler2'], | ||
'interval' => '10', | ||
'subscribers' => ['all'], | ||
'custom' => { 'a' => 'b', 'array' => [ 'c', 'd']}, | ||
'type' => 'metric', | ||
'standalone' => true, | ||
'low_flap_threshold' => '10', | ||
'high_flap_threshold' => '15' | ||
) } | ||
it { should contain_sensu_check('mycheck').with_ensure('absent') } | ||
end | ||
end | ||
|
||
context 'ensure absent' do | ||
let(:params) { { :command => '/etc/sensu/somecommand.rb', :ensure => 'absent' } } | ||
context 'with whitespace in name' do | ||
let(:title) { 'mycheck foobar' } | ||
context 'defaults' do | ||
let(:params) { { :command => '/etc/sensu/somecommand.rb' } } | ||
|
||
it { should contain_sensu_check('mycheck_foobar').with( | ||
'command' => '/etc/sensu/somecommand.rb', | ||
'handlers' => [], | ||
'interval' => '60', | ||
'subscribers' => [] | ||
) } | ||
|
||
it { should contain_file('/etc/sensu/conf.d/checks/mycheck_foobar.json') } | ||
|
||
end | ||
|
||
it { should contain_sensu_check('mycheck').with_ensure('absent') } | ||
end | ||
|
||
end |