2021-04-01 23:00:17 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Prepare platform "finger"
|
|
|
|
platform_finger = system.platform[:finger].split('.').first.to_s
|
|
|
|
|
2021-04-01 23:00:17 +02:00
|
|
|
control 'nsd.service.running' do
|
2021-04-01 23:00:17 +02:00
|
|
|
title 'The service should be installed, enabled and running'
|
|
|
|
|
|
|
|
# Overide by `platform_finger`
|
|
|
|
service_name =
|
|
|
|
case platform_finger
|
|
|
|
when 'centos-6', 'amazonlinux-1'
|
|
|
|
'crond'
|
|
|
|
else
|
2021-04-02 00:22:15 +02:00
|
|
|
'nsd'
|
2021-04-01 23:00:17 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
describe service(service_name) do
|
|
|
|
it { should be_installed }
|
|
|
|
it { should be_enabled }
|
|
|
|
it { should be_running }
|
|
|
|
end
|
2021-04-03 13:34:28 +02:00
|
|
|
|
|
|
|
describe command('nslookup -port=53530 ns1.example.test 127.0.0.1') do
|
|
|
|
its('stdout') { should match "192.168.0.1" }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe command('nslookup -port=53530 ns2.example.test 127.0.0.1') do
|
|
|
|
its('stdout') { should match "192.168.0.2" }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe command('nslookup -port=53530 example.test 127.0.0.1') do
|
|
|
|
its('stdout') { should match "192.168.0.10" }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe command('nslookup -port=53530 www.example.test 127.0.0.1') do
|
|
|
|
its('stdout') { should match "192.168.0.10" }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe command('nslookup -port=53530 mail.example.test 127.0.0.1') do
|
|
|
|
its('stdout') { should match "192.168.0.11" }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe command('nslookup -port=53530 192.168.0.1 127.0.0.1') do
|
|
|
|
its('stdout') { should match "ns1.example.test" }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe command('nslookup -port=53530 192.168.0.2 127.0.0.1') do
|
|
|
|
its('stdout') { should match "ns2.example.test" }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe command('nslookup -port=53530 192.168.0.10 127.0.0.1') do
|
|
|
|
its('stdout') { should match "example.test" }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe command('nslookup -port=53530 192.168.0.11 127.0.0.1') do
|
|
|
|
its('stdout') { should match "mail.example.test" }
|
|
|
|
end
|
2021-04-01 23:00:17 +02:00
|
|
|
end
|