-
Notifications
You must be signed in to change notification settings - Fork 124
Expand file tree
/
Copy pathserver_spec.rb
More file actions
101 lines (86 loc) · 2.37 KB
/
server_spec.rb
File metadata and controls
101 lines (86 loc) · 2.37 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
require 'spec_helper'
describe 'rsync::server', :type => :class do
let(:facts) do
{
:concat_basedir => '/dne',
:osfamily => 'Debian',
}
end
describe 'when using default params' do
it {
is_expected.to contain_class('xinetd')
is_expected.to contain_xinetd__service('rsync').with({ 'bind' => '0.0.0.0' })
is_expected.not_to contain_service('rsync')
is_expected.not_to contain_file('/etc/rsync-motd')
is_expected.to contain_concat__fragment('rsyncd_conf_header').with({
:order => '00_header',
})
is_expected.to contain_concat__fragment('rsyncd_conf_header').with_content(/^use chroot\s*=\s*yes$/)
is_expected.not_to contain_concat__fragment('rsyncd_conf_header').with_content(/^address\s*=.*$/)
}
end
describe 'when disabling xinetd' do
let :params do
{ :use_xinetd => false }
end
it {
is_expected.not_to contain_class('xinetd')
is_expected.not_to contain_xinetd__service('rsync')
is_expected.to contain_service('rsync')
}
end
describe 'when setting an motd' do
let :params do
{ :motd_file => true }
end
it {
is_expected.to contain_file('/etc/rsync-motd')
}
end
describe 'when overriding use_chroot' do
let :params do
{ :use_chroot => 'no' }
end
it {
is_expected.to contain_concat__fragment('rsyncd_conf_header').with_content(/^use chroot\s*=\s*no$/)
}
end
describe 'when overriding address' do
let :params do
{ :address => '10.0.0.42' }
end
it {
is_expected.to contain_concat__fragment('rsyncd_conf_header').with_content(/^address\s*=\s*10.0.0.42$/)
}
end
describe 'when overriding uid' do
let :params do
{ :uid => 'testuser' }
end
it {
is_expected.to contain_concat__fragment('rsyncd_conf_header').with_content(/^uid\s*=\s*testuser$/)
}
end
describe 'when overriding gid' do
let :params do
{ :gid => 'testgroup' }
end
it {
is_expected.to contain_concat__fragment('rsyncd_conf_header').with_content(/^gid\s*=\s*testgroup$/)
}
end
describe 'on SuSE, use_xinetd => false' do
let(:params) do
{
:use_xinetd => false,
}
end
let(:facts) do
{
:osfamily => 'SuSE',
:concat_basedir => '/dne',
}
end
it{ is_expected.to contain_service('rsyncd') }
end
end