Skip to content

Commit

Permalink
More updates to improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
smoeding committed Nov 16, 2023
1 parent 18a666f commit 93e9fdd
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
36 changes: 36 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@
.with_mode('0640')
.that_comes_before('Concat::Fragment[bind::key::rndc-key]')
.that_notifies('Service[bind]')

is_expected.to contain_concat__fragment('bind::key::rndc-key')
.with_target('named.conf.keys')
.with_order('10')
.with_content("include \"/etc/bind/rndc.key\";")
}

#
Expand Down Expand Up @@ -278,6 +283,12 @@
it {
is_expected.to contain_bind__config('named.conf')

is_expected.to contain_file('/etc/bind/named.conf')
.with_ensure('file')
.with_owner('root')
.with_group('bind')
.with_mode('0640')

is_expected.to contain_file('/etc/bind/named.conf.local')
.with_ensure('file')
.with_owner('root')
Expand Down Expand Up @@ -343,9 +354,13 @@
.with_file('/etc/bind/db.localhost')
.with_order('15')

is_expected.to contain_concat__fragment('named.conf.zones-localhost')

is_expected.to contain_bind__zone__primary('127.in-addr.arpa')
.with_file('/etc/bind/db.127')
.with_order('15')

is_expected.to contain_concat__fragment('named.conf.zones-127.in-addr.arpa')
}
end

Expand Down Expand Up @@ -487,6 +502,8 @@
is_expected.to contain_bind__zone__hint('.')
.with_file('/etc/bind/db.root')
.with_comment('Prime server with knowledge of the root servers')

is_expected.to contain_concat__fragment('named.conf.zones-.')
}
end

Expand Down Expand Up @@ -623,6 +640,10 @@
.with_omit_empty_list(true)
.with_final_empty_line(false)

is_expected.to contain_concat__fragment('bind::named.conf.options::forwarders')
.with_target('named.conf.options')
.with_order('20')

is_expected.to contain_concat__fragment('named.conf.options-forward')
.with_target('named.conf.options')
.with_order('21')
Expand Down Expand Up @@ -660,6 +681,13 @@
.with_address_match_list(['192.0.2.42'])
.with_target('named.conf.options')
.with_order('40')
.with_initial_empty_line(true)
.with_final_empty_line(false)

is_expected.to contain_concat__fragment('bind::named.conf.options::blackhole')
.with_target('named.conf.options')
.with_order('40')
.with_content("\n blackhole { 192.0.2.42; };\n")
}
end

Expand All @@ -674,6 +702,10 @@
.with_target('named.conf.options')
.with_order('30')

is_expected.to contain_concat__fragment('bind::named.conf.options::allow-query')
.with_target('named.conf.options')
.with_order('30')

is_expected.not_to contain_bind__aml('allow-query-cache')
}
end
Expand All @@ -690,6 +722,10 @@
.with_address_match_list(['any'])
.with_target('named.conf.options')
.with_order('31')

is_expected.to contain_concat__fragment('bind::named.conf.options::allow-query-cache')
.with_target('named.conf.options')
.with_order('31')
}
end

Expand Down
6 changes: 6 additions & 0 deletions spec/defines/view_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@
.with_view('internal')
.with_file('/etc/bind/db.root')
.with_comment('Prime server with knowledge of the root servers')

is_expected.to contain_concat__fragment('named.conf.views-internal-50-.')
}
end

Expand All @@ -238,6 +240,8 @@
.with_view('internal')
.with_file('/etc/bind/db.localhost')
.with_order('15')

is_expected.to contain_concat__fragment('named.conf.views-internal-50-localhost')
}
end

Expand All @@ -262,6 +266,8 @@
.with_view('internal')
.with_file('/etc/bind/db.127')
.with_order('15')

is_expected.to contain_concat__fragment('named.conf.views-internal-50-127.in-addr.arpa')
}
end

Expand Down

0 comments on commit 93e9fdd

Please sign in to comment.