forked from theforeman/puppet-puppet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpuppet_agent_service_daemon_spec.rb
74 lines (64 loc) · 1.96 KB
/
puppet_agent_service_daemon_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
require 'spec_helper'
describe 'puppet::agent::service::daemon' do
on_os_under_test.each do |os, facts|
context "on #{os}" do
if Puppet.version < '4.0'
confdir = '/etc/puppet'
additional_facts = {}
else
confdir = '/etc/puppetlabs/puppet'
additional_facts = {:rubysitedir => '/opt/puppetlabs/puppet/lib/ruby/site_ruby/2.1.0'}
end
if facts[:osfamily] == 'FreeBSD'
confdir = '/usr/local/etc/puppet'
end
let :facts do
facts.merge(additional_facts)
end
describe 'when runmode => daemon' do
let :pre_condition do
"class {'puppet': agent => true}"
end
it do
should contain_service('puppet').with({
:ensure => 'running',
:name => 'puppet',
:hasstatus => 'true',
:enable => 'true',
})
end
describe 'when runmode is not daemon' do
let :pre_condition do
"class {'puppet': agent => true, runmode => 'cron'}"
end
it do
case os
when /\A(windows|archlinux)/
should raise_error(Puppet::Error, /Runmode of cron not supported on #{facts[:kernel]} operating systems!/)
else
should contain_service('puppet').with({
:ensure => 'stopped',
:name => 'puppet',
:hasstatus => 'true',
:enable => 'false',
})
end
end
end
end
describe 'with custom service_name' do
let :pre_condition do
"class {'puppet': agent => true, service_name => 'pe-puppet'}"
end
it do
should contain_service('puppet').with({
:ensure => 'running',
:name => 'pe-puppet',
:hasstatus => 'true',
:enable => 'true',
})
end
end
end
end
end