Skip to content

Commit b432117

Browse files
committed
update testing to know conf_path is different for new Debian and Ubuntu
1 parent c7f93cb commit b432117

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

spec/classes/ntp_spec.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
let(:conf_path) do
1010
if os.include?('solaris')
1111
'/etc/inet/ntp.conf'
12+
elsif f[:os]['name'] == 'Debian' && f[:os]['release']['major'].to_f >= 12
13+
'/etc/ntpsec/ntp.conf'
14+
elsif f[:os]['name'] == 'Ubuntu' && f[:os]['release']['major'].to_f >= 24.04
15+
'/etc/ntpsec/ntp.conf'
1216
else
1317
'/etc/ntp.conf'
1418
end
@@ -132,31 +136,31 @@
132136
case f[:os]['family']
133137
when 'RedHat'
134138
it 'uses the centos ntp servers' do
135-
expect(subject).to contain_file('/etc/ntp.conf').with('content' => %r{server \d.centos.pool.ntp.org})
139+
expect(subject).to contain_file(conf_path).with('content' => %r{server \d.centos.pool.ntp.org})
136140
end
137141

138142
it do
139143
expect(subject).to contain_file('/etc/ntp/step-tickers').with('content' => %r{\d.centos.pool.ntp.org})
140144
end
141145
when 'Debian'
142146
it 'uses the debian ntp servers' do
143-
expect(subject).to contain_file('/etc/ntp.conf').with('content' => %r{server \d.debian.pool.ntp.org iburst\n})
147+
expect(subject).to contain_file(conf_path).with('content' => %r{server \d.debian.pool.ntp.org iburst\n})
144148
end
145149
when 'Suse'
146150
it 'uses the opensuse ntp servers' do
147-
expect(subject).to contain_file('/etc/ntp.conf').with('content' => %r{server \d.opensuse.pool.ntp.org})
151+
expect(subject).to contain_file(conf_path).with('content' => %r{server \d.opensuse.pool.ntp.org})
148152
end
149153
when 'FreeBSD'
150154
it 'uses the freebsd ntp servers' do
151-
expect(subject).to contain_file('/etc/ntp.conf').with('content' => %r{server \d.freebsd.pool.ntp.org iburst maxpoll 9})
155+
expect(subject).to contain_file(conf_path).with('content' => %r{server \d.freebsd.pool.ntp.org iburst maxpoll 9})
152156
end
153157
when 'Solaris'
154158
it 'uses the generic NTP pool servers' do
155159
expect(subject).to contain_file('/etc/inet/ntp.conf').with('content' => %r{server \d.pool.ntp.org})
156160
end
157161
when 'AIX'
158162
it 'uses the generic NTP pool servers on AIX' do
159-
expect(subject).to contain_file('/etc/ntp.conf').with('content' => %r{server \d.pool.ntp.org})
163+
expect(subject).to contain_file(conf_path).with('content' => %r{server \d.pool.ntp.org})
160164
end
161165
else
162166
it {

0 commit comments

Comments
 (0)