feat: use dig for tests

This commit is contained in:
Adrien Waksberg 2018-03-17 00:33:54 +01:00
parent c7bb61ec31
commit 5634103cfd
2 changed files with 18 additions and 9 deletions

View file

@ -33,3 +33,7 @@
roles: roles:
- ansible-role-bind - ansible-role-bind
tasks:
- apt:
name: dnsutils

View file

@ -3,9 +3,9 @@ require 'serverspec'
set :backend, :exec set :backend, :exec
puts puts
puts "================================" puts '================================'
puts %x(ansible --version) puts %x(ansible --version)
puts "================================" puts '================================'
%w[ %w[
bind9 bind9
@ -56,17 +56,22 @@ describe port(53) do
it { should be_listening.with('udp') } it { should be_listening.with('udp') }
end end
describe command('host hello.test.local 127.0.0.1') do describe command('dig +nocmd +noall +answer hello.test.local @127.0.0.1') do
its(:exit_status) { should eq 0 } its(:exit_status) { should eq 0 }
its(:stdout) { should contain('1.2.3.4') } its(:stdout) { should contain(/hello\.test\.local\.\s+300\s+IN\s+A\s+1\.2\.3\.4/) }
end end
describe command('host hello.hello.local 127.0.0.1') do describe command('dig +nocmd +noall +answer -t mx test.local @127.0.0.1') do
its(:exit_status) { should eq 0 } its(:exit_status) { should eq 0 }
its(:stdout) { should contain('4.3.2.1') } its(:stdout) { should contain(/test\.local\.\s+3600\s+IN\s+MX\s+20 mail\.test\.local\./) }
end end
describe command('host -t TXT hello.local 127.0.0.1') do describe command('dig +nocmd +noall +answer hello.hello.local @127.0.0.1') do
its(:exit_status) { should eq 0 } its(:exit_status) { should eq 0 }
its(:stdout) { should contain('hello.local descriptive text') } its(:stdout) { should contain(/hello\.hello\.local\.\s+3600\s+IN\s+A\s+4\.3\.2\.1/) }
end
describe command('dig +nocmd +noall +answer -t txt hello.local @127.0.0.1') do
its(:exit_status) { should eq 0 }
its(:stdout) { should contain('"0L4M99yv8ZLptmS2GP6goHXZgTdFIyYCdfziQgoENcloUI3KshDscsoh6H6I2LA"') }
end end