Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for gentoo #86

Merged
merged 1 commit into from
Jul 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions spec/classes/chrony_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,29 @@
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})
end
it do
is_expected.to contain_file('/etc/chrony/chrony.keys')
ekohl marked this conversation as resolved.
Show resolved Hide resolved
.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 +170,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 +203,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 +217,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 +243,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 +262,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 +308,7 @@
)
end
end
when 'RedHat'
when 'RedHat', 'Gentoo'
context 'using defaults' do
it do
is_expected.to contain_service('chronyd').with(
Expand Down