Skip to content

Commit

Permalink
Merge pull request #755 from jlambert121/modules-1065
Browse files Browse the repository at this point in the history
MODULES-1065: Add ThreadLimit to mod::worker
  • Loading branch information
igalic committed Jun 12, 2014
2 parents 3ad5b24 + ae714e0 commit 4e59789
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions manifests/mod/worker.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
$threadsperchild = '25',
$maxrequestsperchild = '0',
$serverlimit = '25',
$threadlimit = '64',
$apache_version = $::apache::apache_version,
) {
if defined(Class['apache::mod::event']) {
Expand Down Expand Up @@ -34,6 +35,7 @@
# - $threadsperchild
# - $maxrequestsperchild
# - $serverlimit
# - $threadLimit
file { "${::apache::mod_dir}/worker.conf":
ensure => file,
content => template('apache/mod/worker.conf.erb'),
Expand Down
47 changes: 47 additions & 0 deletions spec/classes/mod/worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,51 @@
it { should_not contain_apache__mod('worker') }
it { should contain_file("/usr/local/etc/apache22/Modules/worker.conf").with_ensure('file') }
end

# Template config doesn't vary by distro
context "on all distros" do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystemrelease => '6',
:concat_basedir => '/dne',
}
end

context 'defaults' do
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^<IfModule mpm_worker_module>$/) }
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ServerLimit\s+25$/) }
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+StartServers\s+2$/) }
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MaxClients\s+150$/) }
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MinSpareThreads\s+25$/) }
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MaxSpareThreads\s+75$/) }
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ThreadsPerChild\s+25$/) }
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MaxRequestsPerChild\s+0$/) }
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ThreadLimit\s+64$/) }
end

context 'setting params' do
let :params do
{
:serverlimit => 10,
:startservers => 11,
:maxclients => 12,
:minsparethreads => 13,
:maxsparethreads => 14,
:threadsperchild => 15,
:maxrequestsperchild => 16,
:threadlimit => 17
}
end
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^<IfModule mpm_worker_module>$/) }
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ServerLimit\s+10$/) }
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+StartServers\s+11$/) }
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MaxClients\s+12$/) }
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MinSpareThreads\s+13$/) }
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MaxSpareThreads\s+14$/) }
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ThreadsPerChild\s+15$/) }
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+MaxRequestsPerChild\s+16$/) }
it { should contain_file('/etc/httpd/conf.d/worker.conf').with(:content => /^\s+ThreadLimit\s+17$/) }
end
end
end
1 change: 1 addition & 0 deletions templates/mod/worker.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
MaxSpareThreads <%= @maxsparethreads %>
ThreadsPerChild <%= @threadsperchild %>
MaxRequestsPerChild <%= @maxrequestsperchild %>
ThreadLimit <%= @threadlimit %>
</IfModule>

0 comments on commit 4e59789

Please sign in to comment.