forked from LMAX-Exchange/puppet-linuxptp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinuxptp_spec.rb
More file actions
59 lines (56 loc) · 2.26 KB
/
linuxptp_spec.rb
File metadata and controls
59 lines (56 loc) · 2.26 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
require 'spec_helper'
describe 'linuxptp' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
facts.merge({})
end
let(:params) do
{}
end
context 'single instance defaults for all parameters' do
let(:params) do
super().merge({interfaces: ['eth0']})
end
it { should compile }
it { should contain_class('linuxptp') }
it { should contain_package('linuxptp').with_ensure('present') }
it { should contain_file('/etc/sysconfig/ptp4l').with_content(/OPTIONS="-f \/etc\/ptp4l.conf -i eth0 "/) }
it { should contain_file('/etc/sysconfig/phc2sys').with_content(/OPTIONS="-a -r -u 0"/) }
it { should contain_linuxptp__ptp4l('default').with_filename('/etc/ptp4l.conf') }
it { should contain_service('ptp4l').with_ensure('running') }
it { should contain_service('phc2sys').with_ensure('running') }
it { should contain_service('ptp4l').with_enable(true) }
it { should contain_service('phc2sys').with_enable(true) }
context 'with manage_logrotate_rule=false' do
let(:params) do
super().merge(manage_logrotate_rule: false)
end
it { should_not contain_logrotate__rule('linuxptp') }
end
end
context 'multi instance defaults' do
let(:params) do
super().merge({single_instance: false})
end
it { should contain_file('/var/run/ptp4l').with_ensure('directory') }
it { should contain_file('/etc/ptp4l').with_ensure('directory') }
it { should contain_file('/var/log/linuxptp').with_ensure('directory') }
it do
should contain_logrotate__rule('linuxptp').with(
'path' => '/var/log/linuxptp/*.log',
'compress' => true,
'copytruncate' => true,
'missingok' => true,
'rotate_every' => 'day',
'rotate' => 7
)
end
it { should contain_service('ptp4l').with_ensure('stopped') }
it { should contain_service('phc2sys').with_ensure('stopped') }
it { should contain_service('ptp4l').with_enable(false) }
it { should contain_service('phc2sys').with_enable(false) }
end
end
end
end