Revision 7f31fd4a
Added by Damian Lukowski about 7 years ago
spec/defines/dns_zone_spec.rb | ||
---|---|---|
'include dns'
|
||
end
|
||
|
||
it { is_expected.to compile.with_all_deps }
|
||
|
||
it "should have valid zone configuration" do
|
||
verify_concat_fragment_exact_contents(catalogue, 'dns_zones+10_example.com.dns', [
|
||
verify_concat_fragment_exact_contents(catalogue, 'dns_zones+10__GLOBAL__example.com.dns', [
|
||
'zone "example.com" {',
|
||
' type master;',
|
||
' file "/var/named/dynamic/db.example.com";',
|
||
... | ... | |
let(:params) {{ :allow_transfer => ['192.168.1.2'] }}
|
||
|
||
it "should have valid zone configuration with allow-transfer" do
|
||
verify_concat_fragment_exact_contents(catalogue, 'dns_zones+10_example.com.dns', [
|
||
verify_concat_fragment_exact_contents(catalogue, 'dns_zones+10__GLOBAL__example.com.dns', [
|
||
'zone "example.com" {',
|
||
' type master;',
|
||
' file "/var/named/dynamic/db.example.com";',
|
||
... | ... | |
let(:params) {{ :allow_transfer => ['192.168.1.2', '192.168.1.3'] }}
|
||
|
||
it "should have valid zone configuration with allow-transfer" do
|
||
verify_concat_fragment_exact_contents(catalogue, 'dns_zones+10_example.com.dns', [
|
||
verify_concat_fragment_exact_contents(catalogue, 'dns_zones+10__GLOBAL__example.com.dns', [
|
||
'zone "example.com" {',
|
||
' type master;',
|
||
' file "/var/named/dynamic/db.example.com";',
|
||
... | ... | |
let(:params) {{ :also_notify => ['192.168.1.2'] }}
|
||
|
||
it "should have valid zone configuration with also-notify" do
|
||
verify_concat_fragment_exact_contents(catalogue, 'dns_zones+10_example.com.dns', [
|
||
verify_concat_fragment_exact_contents(catalogue, 'dns_zones+10__GLOBAL__example.com.dns', [
|
||
'zone "example.com" {',
|
||
' type master;',
|
||
' file "/var/named/dynamic/db.example.com";',
|
||
... | ... | |
let(:params) {{ :also_notify => ['192.168.1.2', '192.168.1.3'] }}
|
||
|
||
it "should have valid zone configuration with also-notify" do
|
||
verify_concat_fragment_exact_contents(catalogue, 'dns_zones+10_example.com.dns', [
|
||
verify_concat_fragment_exact_contents(catalogue, 'dns_zones+10__GLOBAL__example.com.dns', [
|
||
'zone "example.com" {',
|
||
' type master;',
|
||
' file "/var/named/dynamic/db.example.com";',
|
||
... | ... | |
let(:params) {{ :zonetype => 'slave', :masters => ['192.168.1.1'] }}
|
||
|
||
it "should have valid slave zone configuration" do
|
||
verify_concat_fragment_exact_contents(catalogue, 'dns_zones+10_example.com.dns', [
|
||
verify_concat_fragment_exact_contents(catalogue, 'dns_zones+10__GLOBAL__example.com.dns', [
|
||
'zone "example.com" {',
|
||
' type slave;',
|
||
' file "/var/named/dynamic/db.example.com";',
|
||
... | ... | |
let(:params) {{ :zonetype => 'slave', :masters => ['192.168.1.1', '192.168.1.2'] }}
|
||
|
||
it "should have valid slave zone configuration" do
|
||
verify_concat_fragment_exact_contents(catalogue, 'dns_zones+10_example.com.dns', [
|
||
verify_concat_fragment_exact_contents(catalogue, 'dns_zones+10__GLOBAL__example.com.dns', [
|
||
'zone "example.com" {',
|
||
' type slave;',
|
||
' file "/var/named/dynamic/db.example.com";',
|
||
... | ... | |
let(:params) {{ :dns_notify => 'no' }}
|
||
|
||
it "should have valid slave zone configuration" do
|
||
verify_concat_fragment_exact_contents(catalogue, 'dns_zones+10_example.com.dns', [
|
||
verify_concat_fragment_exact_contents(catalogue, 'dns_zones+10__GLOBAL__example.com.dns', [
|
||
'zone "example.com" {',
|
||
' type master;',
|
||
' file "/var/named/dynamic/db.example.com";',
|
||
... | ... | |
let(:params) {{ :zonetype => 'slave', :masters => ['192.168.1.1', '192.168.1.2'], :allow_query => ['1.2.3.4'] }}
|
||
|
||
it "should have valid slave zone configuration" do
|
||
verify_concat_fragment_exact_contents(catalogue, 'dns_zones+10_example.com.dns', [
|
||
verify_concat_fragment_exact_contents(catalogue, 'dns_zones+10__GLOBAL__example.com.dns', [
|
||
'zone "example.com" {',
|
||
' type slave;',
|
||
' file "/var/named/dynamic/db.example.com";',
|
||
... | ... | |
end
|
||
end
|
||
|
||
context 'views enabled with nonexisting view' do
|
||
let(:params) {{ :target_views => ['nonexistent'] }}
|
||
let :pre_condition do
|
||
'class { "::dns": enable_views => true }'
|
||
end
|
||
it { is_expected.to_not compile }
|
||
end
|
||
|
||
context 'views enabled with existing view' do
|
||
let(:params) {{ :target_views => ['existing'] }}
|
||
let :pre_condition do
|
||
'class { "::dns": enable_views => true }
|
||
dns::view { "existing": }
|
||
'
|
||
end
|
||
it { is_expected.to compile }
|
||
end
|
||
|
||
context 'views feature with two views' do
|
||
let(:params) {{ :target_views => ['office', 'dmz'] }}
|
||
|
||
let :pre_condition do
|
||
'class { "::dns": enable_views => true }
|
||
dns::view { "office": }
|
||
dns::view { "dmz": }
|
||
'
|
||
end
|
||
it "should have valid slave zone configuration in office view" do
|
||
verify_concat_fragment_exact_contents(catalogue, 'dns_zones+10_office_example.com.dns', [
|
||
'zone "example.com" {',
|
||
' type master;',
|
||
' file "/var/named/dynamic/db.example.com";',
|
||
' update-policy {',
|
||
' grant rndc-key zonesub ANY;',
|
||
' };',
|
||
'};',
|
||
])
|
||
end
|
||
|
||
it "should have valid slave zone configuration in dmz view" do
|
||
verify_concat_fragment_exact_contents(catalogue, 'dns_zones+10_dmz_example.com.dns', [
|
||
'zone "example.com" {',
|
||
' type master;',
|
||
' file "/var/named/dynamic/db.example.com";',
|
||
' update-policy {',
|
||
' grant rndc-key zonesub ANY;',
|
||
' };',
|
||
'};',
|
||
])
|
||
end
|
||
|
||
it { should_not contain_concat__fragment('dns_zones+10__GLOBAL__example.com.dns') }
|
||
|
||
end
|
||
|
||
end
|
||
|
Also available in: Unified diff
Add BIND views support
Closes GH-78