3 describe 'apache::service', :type => :class do
5 'include apache::params'
7 context "on a Debian OS" do
10 :osfamily => 'Debian',
11 :operatingsystemrelease => '6',
12 :concat_basedir => '/dne',
13 :lsbdistcodename => 'squeeze',
14 :operatingsystem => 'Debian',
17 :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
21 it { is_expected.to contain_service("httpd").with(
23 'ensure' => 'running',
28 context "with $service_name => 'foo'" do
29 let (:params) {{ :service_name => 'foo' }}
30 it { is_expected.to contain_service("httpd").with(
36 context "with $service_enable => true" do
37 let (:params) {{ :service_enable => true }}
38 it { is_expected.to contain_service("httpd").with(
40 'ensure' => 'running',
46 context "with $service_enable => false" do
47 let (:params) {{ :service_enable => false }}
48 it { is_expected.to contain_service("httpd").with(
50 'ensure' => 'running',
56 context "$service_enable must be a bool" do
57 let (:params) {{ :service_enable => 'not-a-boolean' }}
60 expect { catalogue }.to raise_error(Puppet::Error, /is not a boolean/)
64 context "$service_manage must be a bool" do
65 let (:params) {{ :service_manage => 'not-a-boolean' }}
68 expect { catalogue }.to raise_error(Puppet::Error, /is not a boolean/)
72 context "with $service_ensure => 'running'" do
73 let (:params) {{ :service_ensure => 'running', }}
74 it { is_expected.to contain_service("httpd").with(
75 'ensure' => 'running',
81 context "with $service_ensure => 'stopped'" do
82 let (:params) {{ :service_ensure => 'stopped', }}
83 it { is_expected.to contain_service("httpd").with(
84 'ensure' => 'stopped',
90 context "with $service_ensure => 'UNDEF'" do
91 let (:params) {{ :service_ensure => 'UNDEF' }}
92 it { is_expected.to contain_service("httpd").without_ensure }
95 context "with $service_restart unset" do
96 it { is_expected.to contain_service("httpd").without_restart }
99 context "with $service_restart => '/usr/sbin/apachectl graceful'" do
100 let (:params) {{ :service_restart => '/usr/sbin/apachectl graceful' }}
101 it { is_expected.to contain_service("httpd").with(
102 'restart' => '/usr/sbin/apachectl graceful'
109 context "on a RedHat 5 OS, do not manage service" do
112 :osfamily => 'RedHat',
113 :operatingsystemrelease => '5',
114 :concat_basedir => '/dne',
115 :operatingsystem => 'RedHat',
118 :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
124 'service_ensure' => 'running',
125 'service_name' => 'httpd',
126 'service_manage' => false
129 it 'should not manage the httpd service' do
130 subject.should_not contain_service('httpd')
134 context "on a FreeBSD 5 OS" do
137 :osfamily => 'FreeBSD',
138 :operatingsystemrelease => '9',
139 :concat_basedir => '/dne',
140 :operatingsystem => 'FreeBSD',
142 :kernel => 'FreeBSD',
143 :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
147 it { is_expected.to contain_service("httpd").with(
148 'name' => 'apache24',
149 'ensure' => 'running',
155 context "on a Gentoo OS" do
158 :osfamily => 'Gentoo',
159 :operatingsystem => 'Gentoo',
160 :operatingsystemrelease => '3.16.1-gentoo',
161 :concat_basedir => '/dne',
164 :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin',
168 it { is_expected.to contain_service("httpd").with(
170 'ensure' => 'running',