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
|
2023-02-17 21:53:30 +01:00
|
|
|
its('stdout') { should match '192.168.0.1' }
|
2021-04-03 13:34:28 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
describe command('nslookup -port=53530 ns2.example.test 127.0.0.1') do
|
2023-02-17 21:53:30 +01:00
|
|
|
its('stdout') { should match '192.168.0.2' }
|
2021-04-03 13:34:28 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
describe command('nslookup -port=53530 example.test 127.0.0.1') do
|
2023-02-17 21:53:30 +01:00
|
|
|
its('stdout') { should match '192.168.0.10' }
|
2021-04-03 13:34:28 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
describe command('nslookup -port=53530 www.example.test 127.0.0.1') do
|
2023-02-17 21:53:30 +01:00
|
|
|
its('stdout') { should match '192.168.0.10' }
|
2021-04-03 13:34:28 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
describe command('nslookup -port=53530 mail.example.test 127.0.0.1') do
|
2023-02-17 21:53:30 +01:00
|
|
|
its('stdout') { should match '192.168.0.11' }
|
2021-04-03 13:34:28 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
describe command('nslookup -port=53530 192.168.0.1 127.0.0.1') do
|
2023-02-17 21:53:30 +01:00
|
|
|
its('stdout') { should match 'ns1.example.test' }
|
2021-04-03 13:34:28 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
describe command('nslookup -port=53530 192.168.0.2 127.0.0.1') do
|
2023-02-17 21:53:30 +01:00
|
|
|
its('stdout') { should match 'ns2.example.test' }
|
2021-04-03 13:34:28 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
describe command('nslookup -port=53530 192.168.0.10 127.0.0.1') do
|
2023-02-17 21:53:30 +01:00
|
|
|
its('stdout') { should match 'example.test' }
|
2021-04-03 13:34:28 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
describe command('nslookup -port=53530 192.168.0.11 127.0.0.1') do
|
2023-02-17 21:53:30 +01:00
|
|
|
its('stdout') { should match 'mail.example.test' }
|
2021-04-03 13:34:28 +02:00
|
|
|
end
|
2021-04-01 23:00:17 +02:00
|
|
|
end
|