/
graphite_spec.rb
81 lines (71 loc) · 2.71 KB
/
graphite_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
require 'spec_helper'
describe('icingaweb2::module::graphite', type: :class) do
let(:pre_condition) do
[
"class { 'icingaweb2': db_type => 'mysql', db_password => 'secret' }",
]
end
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
context "#{os} with git_revision 'v0.9.0'" do
let(:params) { { git_revision: 'v0.9.0', url: 'http://localhost' } }
it {
is_expected.to contain_icingaweb2__module('graphite')
.with_install_method('git')
.with_git_revision('v0.9.0')
}
it {
is_expected.to contain_icingaweb2__inisection('module-graphite-graphite')
.with_section_name('graphite')
.with_target('/etc/icingaweb2/modules/graphite/config.ini')
.with_settings('url' => 'http://localhost')
}
end
context "#{os} with all parameters set" do
let(:params) do
{
git_revision: 'v0.9.0',
url: 'http://localhost',
insecure: false,
user: 'foo',
password: 'bar',
graphite_writer_host_name_template: 'foobar',
graphite_writer_service_name_template: 'barfoo',
customvar_obscured_check_command: 'baz',
default_time_range: 10,
default_time_range_unit: 'hours',
disable_no_graphs: true,
}
end
it {
is_expected.to contain_icingaweb2__module('graphite')
.with_install_method('git')
.with_git_revision('v0.9.0')
}
it {
is_expected.to contain_icingaweb2__inisection('module-graphite-graphite')
.with_section_name('graphite')
.with_target('/etc/icingaweb2/modules/graphite/config.ini')
.with_settings('url' => 'http://localhost', 'insecure' => false, 'user' => 'foo', 'password' => 'bar')
}
it {
is_expected.to contain_icingaweb2__inisection('module-graphite-ui')
.with_section_name('ui')
.with_target('/etc/icingaweb2/modules/graphite/config.ini')
.with_settings('default_time_range' => 10, 'default_time_range_unit' => 'hours', 'disable_no_graphs_found' => true)
}
it {
is_expected.to contain_icingaweb2__inisection('module-graphite-icinga')
.with_section_name('icinga')
.with_target('/etc/icingaweb2/modules/graphite/config.ini')
.with_settings('graphite_writer_host_name_template' => 'foobar',
'graphite_writer_service_name_template' => 'barfoo',
'customvar_obscured_check_command' => 'baz')
}
end
end
end
end