spec tests for bind::key

This commit is contained in:
Cédric Defortis
2017-05-02 11:41:59 +02:00
parent 3dd198e706
commit 8308595a57
5 changed files with 126 additions and 23 deletions
+40
View File
@@ -0,0 +1,40 @@
require 'spec_helper'
describe 'bind::key' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:pre_condition) do
'include bind'
end
let (:facts) {facts}
case facts[:os]['family']
when 'Debian'
expected_confdir = '/etc/bind'
expected_group = 'bind'
when 'RedHat'
expected_confdir = '/etc/named'
expected_group = 'named'
end
# Resource title:
let(:title) { 'foobar-key' }
context 'with defaults for all parameters' do
it { should compile }
it { should compile.with_all_deps }
it do
is_expected.to contain_file("#{expected_confdir}/keys/foobar-key").with(
owner: 'root',
group: expected_group,
content: /^key foobar-key/,
)
end
it do
is_expected.to contain_concat__fragment('bind-key-foobar-key').with(
order: '10',
target: "#{expected_confdir}/keys.conf",
content: "include \"#{expected_confdir}\/keys\/foobar-key\";\n",
)
end
end
end
end
end
+28
View File
@@ -0,0 +1,28 @@
require 'spec_helper'
describe 'bind::zone' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let (:facts) {facts}
case facts[:os]['family']
when 'Debian'
expected_confdir = '/etc/bind'
expected_group = 'bind'
when 'RedHat'
expected_confdir = '/etc/named'
expected_group = 'named'
end
# Resource title:
let(:title) { 'foobar-zone' }
let(:params) do
{
zone_type: 'master'
}
end
context 'with defaults for all parameters' do
it { should compile }
it { should compile.with_all_deps }
end
end
end
end