forked from puppetlabs/puppetlabs-ntp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathntp_service_spec.rb
65 lines (58 loc) · 1.45 KB
/
ntp_service_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
require 'spec_helper_acceptance'
case fact('osfamily')
when 'RedHat', 'FreeBSD', 'Linux', 'Gentoo'
servicename = 'ntpd'
when 'Solaris'
servicename = 'network/ntp'
when 'AIX'
servicename = 'xntpd'
else
servicename = 'ntp'
end
describe 'ntp::service class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
describe 'basic test' do
it 'sets up the service' do
apply_manifest(%{
class { 'ntp': }
}, :catch_failures => true)
end
describe service(servicename) do
it { should be_enabled }
it { should be_running }
end
end
describe 'service parameters' do
it 'starts the service' do
pp = <<-EOS
class { 'ntp':
service_enable => true,
service_ensure => running,
service_manage => true,
service_name => '#{servicename}'
}
EOS
apply_manifest(pp, :catch_failures => true)
end
describe service(servicename) do
it { should be_running }
it { should be_enabled }
end
end
describe 'service is unmanaged' do
it 'shouldnt stop the service' do
pp = <<-EOS
class { 'ntp':
service_enable => false,
service_ensure => stopped,
service_manage => false,
service_name => '#{servicename}'
}
EOS
apply_manifest(pp, :catch_failures => true)
end
describe service(servicename) do
it { should be_running }
it { should be_enabled }
end
end
end