Skip to content

Commit

Permalink
Use view internal to improve test case coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
smoeding committed Nov 16, 2023
1 parent 5237fdf commit b50bbfb
Showing 1 changed file with 43 additions and 43 deletions.
86 changes: 43 additions & 43 deletions spec/defines/view_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,35 @@
}'
end

let(:title) { 'foo' }
let(:title) { 'internal' }

on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) { facts }

context 'with default parameters' do
it {
is_expected.to contain_concat__fragment('named.conf.views-foo-00')
is_expected.to contain_concat__fragment('named.conf.views-internal-00')
.with_target('named.conf.views')
.with_content("\nview \"foo\" {\n match-clients {\n any;\n };\n\n allow-query {\n any;\n };\n\n recursion yes;\n")
.with_content("\nview \"internal\" {\n match-clients {\n any;\n };\n\n allow-query {\n any;\n };\n\n recursion yes;\n")
.with_order('10')

is_expected.not_to contain_bind__zone__hint('foo/.')
is_expected.not_to contain_bind__zone__mirror('foo/.')
is_expected.not_to contain_bind__zone__hint('internal/.')
is_expected.not_to contain_bind__zone__mirror('internal/.')

is_expected.to contain_bind__zone__primary('foo/localhost')
is_expected.to contain_bind__zone__primary('internal/localhost')
.with_zone('localhost')
.with_view('foo')
.with_view('internal')
.with_file('/etc/bind/db.localhost')
.with_order('15')

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

is_expected.to contain_concat__fragment('named.conf.views-foo-99')
is_expected.to contain_concat__fragment('named.conf.views-internal-99')
.with_target('named.conf.views')
.with_content('};')
.with_order('10')
Expand All @@ -48,12 +48,12 @@
end

it {
is_expected.to contain_concat__fragment('named.conf.views-foo-00')
is_expected.to contain_concat__fragment('named.conf.views-internal-00')
.with_target('named.conf.views')
.with_content("\nview \"foo\" {\n match-clients {\n any;\n };\n\n allow-query {\n any;\n };\n\n recursion yes;\n")
.with_content("\nview \"internal\" {\n match-clients {\n any;\n };\n\n allow-query {\n any;\n };\n\n recursion yes;\n")
.with_order('20')

is_expected.to contain_concat__fragment('named.conf.views-foo-99')
is_expected.to contain_concat__fragment('named.conf.views-internal-99')
.with_target('named.conf.views')
.with_content('};')
.with_order('20')
Expand All @@ -66,7 +66,7 @@
end

it {
is_expected.to contain_concat__fragment('named.conf.views-foo-00')
is_expected.to contain_concat__fragment('named.conf.views-internal-00')
.with_target('named.conf.views')
.with_content(%r{match-clients {\n none;\n };\n})
.with_order('10')
Expand All @@ -79,9 +79,9 @@
end

it {
is_expected.to contain_concat__fragment('named.conf.views-foo-00')
is_expected.to contain_concat__fragment('named.conf.views-internal-00')
.with_target('named.conf.views')
.with_content("\nview \"foo\" {\n match-clients {\n any;\n };\n match_destinations {\n none;\n };\n\n allow-query {\n any;\n };\n\n recursion yes;\n")
.with_content("\nview \"internal\" {\n match-clients {\n any;\n };\n match_destinations {\n none;\n };\n\n allow-query {\n any;\n };\n\n recursion yes;\n")
.with_order('10')
}
end
Expand All @@ -92,9 +92,9 @@
end

it {
is_expected.to contain_concat__fragment('named.conf.views-foo-00')
is_expected.to contain_concat__fragment('named.conf.views-internal-00')
.with_target('named.conf.views')
.with_content("\nview \"foo\" {\n match-clients {\n any;\n };\n match-recursive-only yes;\n\n allow-query {\n any;\n };\n\n recursion yes;\n")
.with_content("\nview \"internal\" {\n match-clients {\n any;\n };\n match-recursive-only yes;\n\n allow-query {\n any;\n };\n\n recursion yes;\n")
.with_order('10')
}
end
Expand All @@ -105,9 +105,9 @@
end

it {
is_expected.to contain_concat__fragment('named.conf.views-foo-00')
is_expected.to contain_concat__fragment('named.conf.views-internal-00')
.with_target('named.conf.views')
.with_content("\nview \"foo\" {\n match-clients {\n any;\n };\n\n allow-query {\n none;\n };\n\n recursion yes;\n")
.with_content("\nview \"internal\" {\n match-clients {\n any;\n };\n\n allow-query {\n none;\n };\n\n recursion yes;\n")
.with_order('10')
}
end
Expand All @@ -118,9 +118,9 @@
end

it {
is_expected.to contain_concat__fragment('named.conf.views-foo-00')
is_expected.to contain_concat__fragment('named.conf.views-internal-00')
.with_target('named.conf.views')
.with_content("\nview \"foo\" {\n match-clients {\n any;\n };\n\n allow-query {\n any;\n };\n\n allow-query-on {\n eth0;\n };\n\n recursion yes;\n")
.with_content("\nview \"internal\" {\n match-clients {\n any;\n };\n\n allow-query {\n any;\n };\n\n allow-query-on {\n eth0;\n };\n\n recursion yes;\n")
.with_order('10')
}
end
Expand All @@ -131,9 +131,9 @@
end

it {
is_expected.to contain_concat__fragment('named.conf.views-foo-00')
is_expected.to contain_concat__fragment('named.conf.views-internal-00')
.with_target('named.conf.views')
.with_content("\nview \"foo\" {\n match-clients {\n any;\n };\n\n allow-query {\n any;\n };\n\n recursion no;\n")
.with_content("\nview \"internal\" {\n match-clients {\n any;\n };\n\n allow-query {\n any;\n };\n\n recursion no;\n")
.with_order('10')
}
end
Expand All @@ -144,9 +144,9 @@
end

it {
is_expected.to contain_concat__fragment('named.conf.views-foo-00')
is_expected.to contain_concat__fragment('named.conf.views-internal-00')
.with_target('named.conf.views')
.with_content("\nview \"foo\" {\n match-clients {\n any;\n };\n\n allow-query {\n any;\n };\n\n recursion yes;\n\n allow-recursion {\n any;\n };\n")
.with_content("\nview \"internal\" {\n match-clients {\n any;\n };\n\n allow-query {\n any;\n };\n\n recursion yes;\n\n allow-recursion {\n any;\n };\n")
.with_order('10')
}
end
Expand All @@ -157,9 +157,9 @@
end

it {
is_expected.to contain_concat__fragment('named.conf.views-foo-00')
is_expected.to contain_concat__fragment('named.conf.views-internal-00')
.with_target('named.conf.views')
.with_content("\nview \"foo\" {\n match-clients {\n any;\n };\n\n allow-query {\n any;\n };\n\n recursion yes;\n\n allow-recursion-on {\n eth0;\n };\n")
.with_content("\nview \"internal\" {\n match-clients {\n any;\n };\n\n allow-query {\n any;\n };\n\n recursion yes;\n\n allow-recursion-on {\n eth0;\n };\n")
.with_order('10')
}
end
Expand All @@ -170,9 +170,9 @@
end

it {
is_expected.to contain_concat__fragment('named.conf.views-foo-00')
is_expected.to contain_concat__fragment('named.conf.views-internal-00')
.with_target('named.conf.views')
.with_content("\nview \"foo\" {\n match-clients {\n any;\n };\n\n allow-query {\n any;\n };\n\n recursion yes;\n\n allow-query-cache {\n any;\n };\n")
.with_content("\nview \"internal\" {\n match-clients {\n any;\n };\n\n allow-query {\n any;\n };\n\n recursion yes;\n\n allow-query-cache {\n any;\n };\n")
.with_order('10')
}
end
Expand All @@ -183,9 +183,9 @@
end

it {
is_expected.to contain_concat__fragment('named.conf.views-foo-00')
is_expected.to contain_concat__fragment('named.conf.views-internal-00')
.with_target('named.conf.views')
.with_content("\nview \"foo\" {\n match-clients {\n any;\n };\n\n allow-query {\n any;\n };\n\n recursion yes;\n\n allow-query-cache-on {\n eth0;\n };\n")
.with_content("\nview \"internal\" {\n match-clients {\n any;\n };\n\n allow-query {\n any;\n };\n\n recursion yes;\n\n allow-query-cache-on {\n eth0;\n };\n")
.with_order('10')
}
end
Expand All @@ -196,9 +196,9 @@
end

it {
is_expected.to contain_concat__fragment('named.conf.views-foo-00')
is_expected.to contain_concat__fragment('named.conf.views-internal-00')
.with_target('named.conf.views')
.with_content("\nview \"foo\" {\n match-clients {\n any;\n };\n\n allow-query {\n any;\n };\n\n recursion yes;\n\n allow-transfer {\n any;\n };\n")
.with_content("\nview \"internal\" {\n match-clients {\n any;\n };\n\n allow-query {\n any;\n };\n\n recursion yes;\n\n allow-transfer {\n any;\n };\n")
.with_order('10')
}
end
Expand All @@ -209,9 +209,9 @@
end

it {
is_expected.to contain_bind__zone__hint('foo/.')
is_expected.to contain_bind__zone__hint('internal/.')
.with_zone('.')
.with_view('foo')
.with_view('internal')
.with_file('/etc/bind/db.root')
.with_comment('Prime server with knowledge of the root servers')
}
Expand All @@ -223,7 +223,7 @@
end

it {
is_expected.not_to contain_bind__zone__hint('foo/.')
is_expected.not_to contain_bind__zone__hint('internal/.')
}
end

Expand All @@ -233,9 +233,9 @@
end

it {
is_expected.to contain_bind__zone__primary('foo/localhost')
is_expected.to contain_bind__zone__primary('internal/localhost')
.with_zone('localhost')
.with_view('foo')
.with_view('internal')
.with_file('/etc/bind/db.localhost')
.with_order('15')
}
Expand All @@ -247,7 +247,7 @@
end

it {
is_expected.not_to contain_bind__zone__primary('foo/localhost')
is_expected.not_to contain_bind__zone__primary('internal/localhost')
}
end

Expand All @@ -257,9 +257,9 @@
end

it {
is_expected.to contain_bind__zone__primary('foo/127.in-addr.arpa')
is_expected.to contain_bind__zone__primary('internal/127.in-addr.arpa')
.with_zone('127.in-addr.arpa')
.with_view('foo')
.with_view('internal')
.with_file('/etc/bind/db.127')
.with_order('15')
}
Expand All @@ -271,7 +271,7 @@
end

it {
is_expected.not_to contain_bind__zone__primary('foo/127.in-addr.arpa')
is_expected.not_to contain_bind__zone__primary('internal/127.in-addr.arpa')
}
end
end
Expand Down

0 comments on commit b50bbfb

Please sign in to comment.