Skip to content

Commit

Permalink
Add tests for gentoo
Browse files Browse the repository at this point in the history
  • Loading branch information
chrekh committed Jul 12, 2020
1 parent 60a7be8 commit 1fed42a
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions spec/classes/chrony_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,27 @@
it { is_expected.to contain_file('/etc/chrony.keys').with_replace(true) }
it { is_expected.to contain_file('/etc/chrony.keys').with_content("0 xyzzy\n") }
end
when 'Gentoo'
context 'using defaults' do
it do
is_expected.to contain_file('/etc/chrony/chrony.conf')
.without_content(%r{^\s*cmdallow})
.with_content(%r{^\s*server 0.pool.ntp.org iburst$})
.with_content(%r{^\s*server 1.pool.ntp.org iburst$})
.with_content(%r{^\s*server 2.pool.ntp.org iburst$})
.with_content(%r{^\s*server 3.pool.ntp.org iburst$})
.with_content(%r{^\s*rtconutc$})
.with_content(%r{^\s*driftfile /var/lib/chrony/drift$})
.with_content(%r{^\s*rtcsync$})
.without_content(%r{^\s*dumpdir})
is_expected.to contain_file('/etc/chrony/chrony.keys')
.with_mode('0644')
.with_owner('0')
.with_group('0')
.with_replace(true)
.with_content("0 xyzzy\n")
end
end
when 'RedHat'
context 'using defaults' do
it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*bindcmdaddress ::1$}) }
Expand Down Expand Up @@ -147,7 +168,7 @@
it { is_expected.to contain_file('/etc/chrony.keys').with_replace(true) }
it { is_expected.to contain_file('/etc/chrony.keys').with_content("0 sunny\n") }
end
when 'Debian'
when 'Debian', 'Gentoo'
context 'with some params passed in' do
it { is_expected.to contain_file('/etc/chrony/chrony.conf').with_content(%r{^\s*leapsectz right/UTC$}) }
it { is_expected.to contain_file('/etc/chrony/chrony.conf').with_content(%r{^\s*leapsecmode slew$}) }
Expand Down Expand Up @@ -180,7 +201,7 @@
case facts[:osfamily]
when 'Archlinux', 'RedHat'
it { is_expected.not_to contain_file('/etc/chrony.conf').with_content(%r{stratumweight}) }
when 'Debian'
when 'Debian', 'Gentoo'
it { is_expected.not_to contain_file('/etc/chrony/chrony.conf').with_content(%r{stratumweight}) }
end
end
Expand All @@ -194,7 +215,7 @@
case facts[:osfamily]
when 'Archlinux', 'RedHat'
it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^stratumweight 0$}) }
when 'Debian'
when 'Debian', 'Gentoo'
it { is_expected.to contain_file('/etc/chrony/chrony.conf').with_content(%r{^stratumweight 0$}) }
end
end
Expand All @@ -220,7 +241,7 @@
it { is_expected.to contain_file('/etc/chrony.keys').with_replace(false) }
it { is_expected.to contain_file('/etc/chrony.keys').with_content('') }
end
when 'Debian'
when 'Debian', 'Gentoo'
context 'unmanaged chrony.keys file' do
it { is_expected.to contain_file('/etc/chrony/chrony.keys').with_replace(false) }
it { is_expected.to contain_file('/etc/chrony/chrony.keys').with_content('') }
Expand All @@ -239,7 +260,7 @@
case facts[:osfamily]
when 'Archlinux', 'Redhat'
it { is_expected.to contain_file('/etc/chrony.conf').with_content(%r{^\s*hwtimestamp eth0 minpoll 1 maxpoll 7$}) }
when 'Debian'
when 'Debian', 'Gentoo'
it { is_expected.to contain_file('/etc/chrony/chrony.conf').with_content(%r{^\s*hwtimestamp eth0 minpoll 1 maxpoll 7$}) }
end
end
Expand Down Expand Up @@ -285,7 +306,7 @@
)
end
end
when 'RedHat'
when 'RedHat', 'Gentoo'
context 'using defaults' do
it do
is_expected.to contain_service('chronyd').with(
Expand Down

0 comments on commit 1fed42a

Please sign in to comment.