Skip to content

Commit c178d73

Browse files
committed
Merge pull request thias#51 from NexusIS/master
Add missing bind tools package and improve rspec tests
2 parents aeffbe2 + 0479c58 commit c178d73

File tree

2 files changed

+64
-15
lines changed

2 files changed

+64
-15
lines changed

manifests/init.pp

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
notify => Service['bind'],
2525
}
2626

27+
package{'bind-tools':
28+
ensure => latest,
29+
name => $::bind::params::nsupdate_package,
30+
before => Package['bind'],
31+
}
32+
2733
package { 'bind':
2834
ensure => latest,
2935
name => $::bind::params::bind_package,

spec/classes/bind_spec.rb

+58-15
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,66 @@
22
require 'spec_helper'
33

44
describe 'bind' do
5-
let(:facts) { { :concat_basedir => '/wtf' } }
5+
context "on a Debian OS" do
6+
let :facts do
7+
{
8+
:concat_basedir => '/wtf',
9+
:osfamily => 'Debian',
10+
:operatingsystem => 'Debian'
11+
}
12+
end
13+
it {
14+
should contain_package('bind-tools').with({
15+
'ensure' => 'latest',
16+
'name' => 'dnsutils'
17+
}).that_comes_before('Package[bind]')
18+
}
19+
it {
20+
should contain_package('bind').with({
21+
'ensure' => 'latest',
22+
'name' => 'bind9'
23+
})
24+
}
625

7-
it {
8-
should contain_package('bind').with({
9-
'ensure' => 'latest',
10-
'name' => 'bind9'
11-
})
12-
}
26+
it { should contain_file('_NAMEDCONF_').that_requires('Package[bind]') }
27+
it { should contain_file('_NAMEDCONF_').that_notifies('Service[bind]') }
1328

14-
it { should contain_file('_NAMEDCONF_').that_requires('Package[bind]') }
15-
it { should contain_file('_NAMEDCONF_').that_notifies('Service[bind]') }
29+
it {
30+
should contain_service('bind').with({
31+
'ensure' => 'running',
32+
'name' => 'bind9'
33+
})
34+
}
35+
end
36+
context "on a RedHat OS" do
37+
let :facts do
38+
{
39+
:concat_basedir => '/wtf',
40+
:osfamily => 'RedHat',
41+
:operatingsystem => 'CentOS'
42+
}
43+
end
44+
it {
45+
should contain_package('bind-tools').with({
46+
'ensure' => 'latest',
47+
'name' => 'bind-utils'
48+
})
49+
}
50+
it {
51+
should contain_package('bind').with({
52+
'ensure' => 'latest',
53+
'name' => 'bind'
54+
})
55+
}
1656

17-
it {
18-
should contain_service('bind').with({
19-
'ensure' => 'running',
20-
'name' => 'bind9'
21-
})
22-
}
57+
it { should contain_file('_NAMEDCONF_').that_requires('Package[bind]') }
58+
it { should contain_file('_NAMEDCONF_').that_notifies('Service[bind]') }
2359

60+
it {
61+
should contain_service('bind').with({
62+
'ensure' => 'running',
63+
'name' => 'named'
64+
})
65+
}
66+
end
2467
end

0 commit comments

Comments
 (0)