-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbind_spec.rb
94 lines (76 loc) · 2.01 KB
/
bind_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
90
91
92
93
94
# frozen_string_literal: true
# SPDX-License-Identifier: AGPL-3.0-or-later
require 'spec_helper_acceptance'
describe 'bind' do
context 'when using defaults' do
let(:pp) do
<<~MANIFEST
include bind
MANIFEST
end
it_behaves_like 'an idempotent resource after the initial run'
describe package(PACKAGE_NAME) do
it { is_expected.to be_installed }
end
describe service(SERVICE_NAME) do
it { is_expected.to be_enabled }
it { is_expected.to be_running }
end
it_behaves_like 'a DNS server'
describe 'the default zones' do
it 'are valid' do
[
{ name: 'localhost', file: 'local' },
{ name: '127.in-addr.arpa', file: '127' },
{ name: '0.in-addr.arpa', file: '0' },
{ name: '255.in-addr.arpa', file: '255' },
].each do |zone|
run_shell("named-checkzone #{zone[:name]} #{File.join(CONFIG_DIR, 'db.' + zone[:file])}")
end
end
end
end
context 'when stopping the service' do
let(:pp) do
<<-MANIFEST
class { 'bind':
service_ensure => stopped,
}
MANIFEST
end
it_behaves_like 'an idempotent resource'
describe service(SERVICE_NAME) do
it { is_expected.not_to be_running }
end
end
context 'when disabling the service' do
let(:pp) do
<<-MANIFEST
class { 'bind':
service_enable => false,
}
MANIFEST
end
it_behaves_like 'an idempotent resource'
describe service(SERVICE_NAME) do
it { is_expected.not_to be_enabled }
end
end
context 'when uninstalling' do
let(:pp) do
<<-MANIFEST
class { 'bind':
package_ensure => absent,
}
MANIFEST
end
it_behaves_like 'an idempotent resource'
describe package(PACKAGE_NAME) do
it { is_expected.not_to be_installed }
end
describe service(SERVICE_NAME) do
it { is_expected.not_to be_enabled }
it { is_expected.not_to be_running }
end
end
end