Skip to content

Commit dd672d3

Browse files
author
Kyrill Poole
committed
added flapjack spec
1 parent f4e2a56 commit dd672d3

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

spec/classes/sensu_flapjack_spec.rb

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
require 'spec_helper'
2+
3+
describe 'sensu' do
4+
let(:facts) { { :fqdn => 'testhost.domain.com', :osfamily => 'RedHat' } }
5+
6+
context 'flapjack config' do
7+
8+
context 'default settings' do
9+
it { should contain_sensu_flapjack_config('testhost.domain.com').with(
10+
:host => 'localhost',
11+
:port => 6379
12+
)}
13+
end # default settings
14+
15+
context 'be configurable' do
16+
let(:params) { {
17+
:flapjack_redis_host => 'flapjack.domain.com',
18+
:flapjack_redis_port => 1234,
19+
:flapjack_redis_db => 2
20+
} }
21+
22+
it { should contain_sensu_flapjack_config('testhost.domain.com').with(
23+
:host => 'flapjack.domain.com',
24+
:port => 1234,
25+
:db => 2
26+
)}
27+
end # be configurable
28+
29+
context 'with server' do
30+
let(:params) { { :server => true } }
31+
it { should contain_file('/etc/sensu/conf.d/flapjack.json').with_ensure('present') }
32+
end # with server
33+
34+
context 'with api' do
35+
let(:params) { { :api => true } }
36+
it { should contain_file('/etc/sensu/conf.d/flapjack.json').with_ensure('present') }
37+
end # with api
38+
39+
context 'purge configs' do
40+
let(:params) { {
41+
:purge_config => true,
42+
:server => false,
43+
:api => false,
44+
} }
45+
46+
it { should contain_file('/etc/sensu/conf.d/flapjack.json').with_ensure('absent') }
47+
end # purge configs
48+
49+
end #flapjack config
50+
51+
end

0 commit comments

Comments
 (0)