-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathdns_logging_category_spec.rb
89 lines (76 loc) · 2.29 KB
/
dns_logging_category_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
82
83
84
85
86
87
88
89
require 'spec_helper'
describe 'dns::logging::category' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { override_facts(os_facts, networking: { fqdn: 'puppetmaster.example.com' }) }
let(:pre_condition) { 'include dns' }
let(:title) { 'test' }
let(:logdir) { '/var/log/named' }
describe 'without channels set' do
it { is_expected.not_to compile }
end
describe 'with channels set' do
let(:params) { { 'channels' => ['test_channel'] } }
it { is_expected.to compile.with_all_deps }
it 'should have valid category contents' do
verify_concat_fragment_exact_contents(
catalogue,
"named.conf-logging-category-#{title}.dns",
[
' category test {',
' test_channel;',
' };',
]
)
end
it {
is_expected.to contain_concat_fragment(
"named.conf-logging-category-#{title}.dns"
).with('order' => 55)
}
it { is_expected.to contain_file(logdir).with_ensure('directory') }
it {
is_expected.to contain_concat_fragment(
'named.conf+50-logging-header.dns'
).with('order' => 50).with('content' => "logging {\n")
}
it {
is_expected.to contain_concat_fragment(
'named.conf+60-logging-footer.dns'
).with('order' => 60).with('content' => "};\n")
}
end
describe 'when order => 59' do
let(:params) do
{
'channels' => ['test_channel'],
'order' => 59,
}
end
it {
is_expected.to contain_concat_fragment(
"named.conf-logging-category-#{title}.dns"
).with('order' => 59)
}
end
describe 'fail when order => 50' do
let(:params) do
{
'channels' => ['test_channel'],
'order' => 50,
}
end
it { is_expected.not_to compile }
end
describe 'fail when order => 60' do
let(:params) do
{
'channels' => ['test_channel'],
'order' => 60,
}
end
it { is_expected.not_to compile }
end
end
end
end