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
82
83
84
85
86
|
require 'spec_helper'
describe 'munin::client::base' do
let :default_facts do
{
:fqdn => 'munin-node.example.org',
}
end
let :pre_condition do
'include munin::client'
end
context 'on Debian' do
let :facts do
{ :osfamily => 'Debian' }.merge(default_facts)
end
it 'should compile' do
should contain_class('munin::client::base')
end
it 'should set up munin-node' do
should contain_service('munin-node').with({
:ensure => 'running',
:enable => true,
:hasstatus => true,
:hasrestart => true,
})
should contain_file('/etc/munin').with({
:ensure => 'directory',
:mode => '0755',
:owner => 'root',
:group => 0,
})
should contain_file('/etc/munin/munin-node.conf').
with_content(/^host_name munin-node.example.org$/).
with_content(/^allow \^127\\\.0\\\.0\\\.1\$$/).
with_content(/^host \*$/).
with_content(/^port 4949$/)
should contain_munin__register('munin-node.example.org').with({
:host => 'munin-node.example.org',
:port => '4949',
:use_ssh => false,
:config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'],
:export_tag => 'munin',
})
should contain_class('munin::plugins::base')
end
it 'should contain the Debian specific values' do
should contain_file('/etc/munin/munin-node.conf').
with_content(/^log_file \/var\/log\/munin\/munin-node.log$/).
with_content(/^group root$/)
end
end
context 'on CentOS' do
let :facts do
{ :osfamily => 'CentOS' }.merge(default_facts)
end
it 'should contain the CentOS specific values' do
should contain_file('/etc/munin/munin-node.conf').
with_content(/^log_file \/var\/log\/munin-node\/munin-node.log$/).
with_content(/^group root$/)
end
end
# Disabled because the required openbsd module is not in the requirements
context 'on OpenBSD', :if => false do
let :facts do
{ :osfamily => 'OpenBSD' }.merge(default_facts)
end
it 'should contain the config OpenBSD specific values' do
should contain_file('/etc/munin/munin-node.conf').
with_content(/^log_file \/var\/log\/munin-node\/munin-node.log$/).
with_content(/^group 0$/)
end
end
end
|