1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
require 'spec_helper'
describe 'dhcp' do
context 'When on an unsupported OS' do
let (:facts) { {
:operatingsystem => 'RedHat',
:osfamily => 'Redhat',
:lsbdistcodename => 'Santiago'
} }
it 'should fail' do
expect {
should contain_package('dhcp-server')
}.to raise_error(Puppet::Error, /Unsupported OS RedHat\/Santiago/)
end
end
context 'When on Debian lenny' do
let (:facts) { {
:operatingsystem => 'Debian',
:osfamily => 'Debian',
:lsbdistcodename => 'lenny'
} }
# Package
it { should contain_package('dhcp-server').with(
:name => 'dhcp3-server'
) }
# Config
it { should contain_concat('/etc/dhcp3/dhcpd.conf').with(
:owner => 'root',
:group => 'root',
:mode => '0644'
) }
# Service
it { should contain_service('dhcpd').with(
:ensure => 'running',
:name => 'dhcp3-server',
:enable => true,
:pattern => '/usr/sbin/dhcpd3'
) }
end
context 'When on Debian squeeze' do
let (:facts) { {
:operatingsystem => 'Debian',
:osfamily => 'Debian',
:lsbdistcodename => 'squeeze'
} }
# Package
it { should contain_package('dhcp-server').with(
:name => 'isc-dhcp-server'
) }
# Config
it { should contain_concat('/etc/dhcp/dhcpd.conf').with(
:owner => 'root',
:group => 'root',
:mode => '0644'
) }
# Service
it { should contain_service('dhcpd').with(
:ensure => 'running',
:name => 'isc-dhcp-server',
:enable => true,
:pattern => '/usr/sbin/dhcpd'
) }
end
end
|