3 describe 'apache::mod::worker', :type => :class do
5 'class { "apache": mpm_module => false, }'
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_class("apache::params") }
22 it { is_expected.not_to contain_apache__mod('worker') }
23 it { is_expected.to contain_file("/etc/apache2/mods-available/worker.conf").with_ensure('file') }
24 it { is_expected.to contain_file("/etc/apache2/mods-enabled/worker.conf").with_ensure('link') }
26 context "with Apache version < 2.4" do
29 :apache_version => '2.2',
33 it { is_expected.not_to contain_file("/etc/apache2/mods-available/worker.load") }
34 it { is_expected.not_to contain_file("/etc/apache2/mods-enabled/worker.load") }
36 it { is_expected.to contain_package("apache2-mpm-worker") }
39 context "with Apache version >= 2.4" do
42 :apache_version => '2.4',
46 it { is_expected.to contain_file("/etc/apache2/mods-available/worker.load").with({
48 'content' => "LoadModule mpm_worker_module /usr/lib/apache2/modules/mod_mpm_worker.so\n"
51 it { is_expected.to contain_file("/etc/apache2/mods-enabled/worker.load").with_ensure('link') }
54 context "on a RedHat OS" do
57 :osfamily => 'RedHat',
58 :operatingsystemrelease => '6',
59 :concat_basedir => '/dne',
60 :operatingsystem => 'RedHat',
63 :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
67 it { is_expected.to contain_class("apache::params") }
68 it { is_expected.not_to contain_apache__mod('worker') }
69 it { is_expected.to contain_file("/etc/httpd/conf.d/worker.conf").with_ensure('file') }
71 context "with Apache version < 2.4" do
74 :apache_version => '2.2',
78 it { is_expected.to contain_file_line("/etc/sysconfig/httpd worker enable").with({
79 'require' => 'Package[httpd]',
84 context "with Apache version >= 2.4" do
87 :apache_version => '2.4',
91 it { is_expected.not_to contain_apache__mod('event') }
93 it { is_expected.to contain_file("/etc/httpd/conf.d/worker.load").with({
95 'content' => "LoadModule mpm_worker_module modules/mod_mpm_worker.so\n",
100 context "on a FreeBSD OS" do
103 :osfamily => 'FreeBSD',
104 :operatingsystemrelease => '9',
105 :concat_basedir => '/dne',
106 :operatingsystem => 'FreeBSD',
108 :kernel => 'FreeBSD',
109 :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
113 it { is_expected.to contain_class("apache::params") }
114 it { is_expected.not_to contain_apache__mod('worker') }
115 it { is_expected.to contain_file("/usr/local/etc/apache24/Modules/worker.conf").with_ensure('file') }
117 context "on a Gentoo OS" do
120 :osfamily => 'Gentoo',
121 :operatingsystem => 'Gentoo',
122 :operatingsystemrelease => '3.16.1-gentoo',
123 :concat_basedir => '/dne',
126 :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin',
130 it { is_expected.to contain_class("apache::params") }
131 it { is_expected.not_to contain_apache__mod('worker') }
132 it { is_expected.to contain_file("/etc/apache2/modules.d/worker.conf").with_ensure('file') }
135 # Template config doesn't vary by distro
136 context "on all distros" do
139 :osfamily => 'RedHat',
140 :operatingsystem => 'CentOS',
141 :operatingsystemrelease => '6',
144 :concat_basedir => '/dne',
145 :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
150 context 'defaults' do
151 it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^<IfModule mpm_worker_module>$/) }
152 it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ServerLimit\s+25$/) }
153 it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+StartServers\s+2$/) }
154 it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MaxClients\s+150$/) }
155 it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MinSpareThreads\s+25$/) }
156 it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MaxSpareThreads\s+75$/) }
157 it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ThreadsPerChild\s+25$/) }
158 it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MaxRequestsPerChild\s+0$/) }
159 it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ThreadLimit\s+64$/) }
162 context 'setting params' do
168 :minsparethreads => 13,
169 :maxsparethreads => 14,
170 :threadsperchild => 15,
171 :maxrequestsperchild => 16,
175 it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^<IfModule mpm_worker_module>$/) }
176 it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ServerLimit\s+10$/) }
177 it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+StartServers\s+11$/) }
178 it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MaxClients\s+12$/) }
179 it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MinSpareThreads\s+13$/) }
180 it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MaxSpareThreads\s+14$/) }
181 it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ThreadsPerChild\s+15$/) }
182 it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MaxRequestsPerChild\s+16$/) }
183 it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ThreadLimit\s+17$/) }