Skip to content

Commit

Permalink
test: add tests for records in zones and for replace_file option
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Delacour committed May 3, 2022
1 parent dd906f9 commit 28a44ea
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions spec/defines/dns_zone_spec.rb
Expand Up @@ -72,6 +72,19 @@
])
end

context 'when replace_file => true' do
let(:params) { { replace_file: true } }

it "should create zone file with replace => true" do
should contain_file("#{zonefilepath}/db.example.com").with({
:owner => user_name,
:group => user_name,
:mode => '0644',
:replace => 'true',
}).that_notifies('Class[Dns::Service]')
end
end

context 'when reverse => true' do
let(:title) { '1.168.192.in-addr.arpa' }
let(:params) {{ :reverse => true }}
Expand Down Expand Up @@ -111,6 +124,27 @@
end
end

context 'with records' do
let(:params) { { records: ['host1 IN A 192.0.2.10', 'vm-host1 IN CNAME host1', 'host2 IN A 192.0.2.11']} }

it "should have valid zone file contents" do
verify_exact_contents(catalogue, "#{zonefilepath}/db.example.com", [
'$TTL 10800',
'@ IN SOA puppetmaster.example.com. root.example.com. (',
' 1 ;Serial',
' 86400 ;Refresh',
' 3600 ;Retry',
' 604800 ;Expire',
' 3600 ;Negative caching TTL',
')',
'@ IN NS puppetmaster.example.com.',
'host1 IN A 192.0.2.10',
'vm-host1 IN CNAME host1',
'host2 IN A 192.0.2.11',
])
end
end

context 'when allow_transfer defined' do
let(:params) {rndc_policy_params.merge({ :allow_transfer => ['192.168.1.2'] })}

Expand Down

0 comments on commit 28a44ea

Please sign in to comment.