forked from voxpupuli/puppet-smokeping
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init_spec.rb
78 lines (66 loc) · 2.09 KB
/
init_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
require 'spec_helper'
describe 'smokeping' do
let :node do
'agent.example.com'
end
on_supported_os.each do |os, facts|
context "on #{os} " do
let :facts do
facts
end
let :params do
{
cgiurl: 'http://some.url/smokeping.cgi',
master_url: 'http://somewhere/cgi-bin/smokeping.cgi',
}
end
context 'with all defaults' do
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('smokeping') }
it { is_expected.to contain_class('smokeping::install') }
it { is_expected.to contain_class('smokeping::service') }
it { is_expected.to contain_class('smokeping::config') }
case facts[:osfamily]
when 'RedHat'
it { is_expected.to contain_file('/var/lib/smokeping/images').with(
ensure: 'directory',
owner: 'apache',
group: 'apache',
recurse: true,
) }
when 'Debian'
it { is_expected.to contain_file('/var/cache/smokeping/images').with(
ensure: 'directory',
owner: 'www-data',
group: 'www-data',
recurse: true,
) }
end
end
context "change img_cachedir" do
let :params do
{
cgiurl: 'http://some.url/smokeping.cgi',
master_url: 'http://somewhere/cgi-bin/smokeping.cgi',
path_imgcache: '/smokeping/images',
}
end
it { is_expected.to contain_file('/smokeping/images').with(
ensure: 'directory',
recurse: true,
) }
context "don't manage img_cachedir" do
let :params do
{
cgiurl: 'http://some.url/smokeping.cgi',
master_url: 'http://somewhere/cgi-bin/smokeping.cgi',
path_imgcache: '/smokeping/images',
manage_imgcache: false,
}
end
it { is_expected.not_to contain_file('/smokeping/images') }
end
end
end
end
end