Skip to content

Commit 242f718

Browse files
committed
add spec tests for Debian
1 parent aee3c03 commit 242f718

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

spec/classes/chrony_spec.rb

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,10 @@
415415
)
416416
end
417417

418+
it 'does not create /etc/default/chrony' do
419+
is_expected.not_to contain_file('/etc/default/chrony')
420+
end
421+
418422
if (facts[:os]['release']['major'] = '8')
419423
context 'on RedHat 8 family with default parameters' do
420424
it 'contains an empty OPTIONS line' do
@@ -439,9 +443,33 @@
439443
with_content(%r{^OPTIONS="-4 -u chrony"$})
440444
end
441445
end
446+
when 'Debian'
447+
it 'does not create /etc/sysconfig/chronyd' do
448+
is_expected.not_to contain_file('/etc/sysconfig/chronyd')
449+
end
450+
451+
context 'with no options parameter' do
452+
it {
453+
is_expected.not_to contain_file('/etc/default/chrony')
454+
}
455+
end
456+
457+
context 'with custom options parameter' do
458+
let(:params) { { options: '-4 -u chrony' } }
459+
460+
it 'contains the custom OPTIONS line' do
461+
is_expected.to contain_file('/etc/default/chrony').
462+
with_content(%r{^DAEMON_OPTS="-4 -u chrony"$}).
463+
with_ensure('file').
464+
with_owner('0').
465+
with_group('0').
466+
with_mode('0644')
467+
end
468+
end
442469
else
443-
it 'on non-RedHat families' do
470+
it 'on non-RedHat/Debian families' do
444471
is_expected.not_to contain_file('/etc/sysconfig/chronyd')
472+
is_expected.not_to contain_file('/etc/default/chrony')
445473
end
446474
end
447475
end

0 commit comments

Comments
 (0)