forked from theforeman/puppet-foreman
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforeman_service_spec.rb
More file actions
72 lines (61 loc) · 1.77 KB
/
foreman_service_spec.rb
File metadata and controls
72 lines (61 loc) · 1.77 KB
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
require 'spec_helper'
describe 'foreman::service' do
context 'with inherited parameters' do
let :facts do
on_supported_os['redhat-7-x86_64'].merge({:concat_basedir => '/doesnotexist'})
end
let :pre_condition do
'include ::foreman'
end
it 'should restart passenger' do
should contain_exec('restart_foreman').with({
:command => '/bin/touch /usr/share/foreman/tmp/restart.txt',
:refreshonly => true,
:cwd => '/usr/share/foreman',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
})
end
it { should contain_service('foreman').with({
'ensure' => 'stopped',
'enable' => false,
'hasstatus' => true,
})}
end
context 'with passenger' do
let :params do
{
:passenger => true,
:app_root => '/usr/share/foreman',
}
end
it 'should restart passenger' do
should contain_exec('restart_foreman').with({
:command => '/bin/touch /usr/share/foreman/tmp/restart.txt',
:refreshonly => true,
:cwd => '/usr/share/foreman',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
})
end
it { should contain_service('foreman').with({
'ensure' => 'stopped',
'enable' => false,
'hasstatus' => true,
})}
end
context 'without passenger' do
let :params do
{
:passenger => false,
:app_root => '/usr/share/foreman',
}
end
it 'should not restart passenger' do
should_not contain_exec('restart_foreman')
end
it { should contain_service('foreman').with({
'ensure' => 'running',
'enable' => true,
'hasstatus' => true,
})}
end
end