Skip to content

Commit 4e59789

Browse files
committed
Merge pull request #755 from jlambert121/modules-1065
MODULES-1065: Add ThreadLimit to mod::worker
2 parents 3ad5b24 + ae714e0 commit 4e59789

3 files changed

Lines changed: 50 additions & 0 deletions

File tree

manifests/mod/worker.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
$threadsperchild = '25',
77
$maxrequestsperchild = '0',
88
$serverlimit = '25',
9+
$threadlimit = '64',
910
$apache_version = $::apache::apache_version,
1011
) {
1112
if defined(Class['apache::mod::event']) {
@@ -34,6 +35,7 @@
3435
# - $threadsperchild
3536
# - $maxrequestsperchild
3637
# - $serverlimit
38+
# - $threadLimit
3739
file { "${::apache::mod_dir}/worker.conf":
3840
ensure => file,
3941
content => template('apache/mod/worker.conf.erb'),

spec/classes/mod/worker_spec.rb

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,51 @@
111111
it { should_not contain_apache__mod('worker') }
112112
it { should contain_file("/usr/local/etc/apache22/Modules/worker.conf").with_ensure('file') }
113113
end
114+
115+
# Template config doesn't vary by distro
116+
context "on all distros" do
117+
let :facts do
118+
{
119+
:osfamily => 'RedHat',
120+
:operatingsystemrelease => '6',
121+
:concat_basedir => '/dne',
122+
}
123+
end
124+
125+
context 'defaults' do
126+
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^<IfModule mpm_worker_module>$/) }
127+
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ServerLimit\s+25$/) }
128+
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+StartServers\s+2$/) }
129+
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MaxClients\s+150$/) }
130+
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MinSpareThreads\s+25$/) }
131+
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MaxSpareThreads\s+75$/) }
132+
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ThreadsPerChild\s+25$/) }
133+
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MaxRequestsPerChild\s+0$/) }
134+
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ThreadLimit\s+64$/) }
135+
end
136+
137+
context 'setting params' do
138+
let :params do
139+
{
140+
:serverlimit => 10,
141+
:startservers => 11,
142+
:maxclients => 12,
143+
:minsparethreads => 13,
144+
:maxsparethreads => 14,
145+
:threadsperchild => 15,
146+
:maxrequestsperchild => 16,
147+
:threadlimit => 17
148+
}
149+
end
150+
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^<IfModule mpm_worker_module>$/) }
151+
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ServerLimit\s+10$/) }
152+
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+StartServers\s+11$/) }
153+
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MaxClients\s+12$/) }
154+
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MinSpareThreads\s+13$/) }
155+
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MaxSpareThreads\s+14$/) }
156+
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ThreadsPerChild\s+15$/) }
157+
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MaxRequestsPerChild\s+16$/) }
158+
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ThreadLimit\s+17$/) }
159+
end
160+
end
114161
end

templates/mod/worker.conf.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
MaxSpareThreads <%= @maxsparethreads %>
77
ThreadsPerChild <%= @threadsperchild %>
88
MaxRequestsPerChild <%= @maxrequestsperchild %>
9+
ThreadLimit <%= @threadlimit %>
910
</IfModule>

0 commit comments

Comments
 (0)