Skip to content

Commit

Permalink
Add configurable options for mpm_event
Browse files Browse the repository at this point in the history
  • Loading branch information
stumped2 committed Nov 19, 2014
1 parent 1ff81aa commit 5ac2f34
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 8 deletions.
20 changes: 12 additions & 8 deletions manifests/mod/event.pp
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
class apache::mod::event (
$startservers = '2',
$maxclients = '150',
$minsparethreads = '25',
$maxsparethreads = '75',
$threadsperchild = '25',
$maxrequestsperchild = '0',
$serverlimit = '25',
$apache_version = $::apache::apache_version,
$startservers = '2',
$maxclients = '150',
$minsparethreads = '25',
$maxsparethreads = '75',
$threadsperchild = '25',
$maxrequestsperchild = '0',
$serverlimit = '25',
$apache_version = $::apache::apache_version,
$threadlimit = '64',
$listenbacklog = '511',
$maxrequestworkers = '256',
$maxconnectionsperchild = '0',
) {
if defined(Class['apache::mod::itk']) {
fail('May not include both apache::mod::event and apache::mod::itk on the same node')
Expand Down
33 changes: 33 additions & 0 deletions spec/classes/mod/event_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,44 @@
}
end


it { is_expected.to contain_class("apache::params") }
it { is_expected.not_to contain_apache__mod('event') }
it { is_expected.to contain_file("/etc/apache2/mods-available/event.conf").with_ensure('file') }
it { is_expected.to contain_file("/etc/apache2/mods-enabled/event.conf").with_ensure('link') }

context "Test mpm_event params" do
let :params do
{
:serverlimit => '0',
:startservers => '1',
:maxclients => '2',
:minsparethreads => '3',
:maxsparethreads => '4',
:threadsperchild => '5',
:maxrequestsperchild => '6',
:threadlimit => '7',
:listenbacklog => '8',
:maxrequestworkers => '9',
:maxconnectionsperchild => '10',
}
end

it { is_expected.to contain_file("/etc/apache2/mods-available/event.conf").with_ensure('file')
.with_content(/^\s*ServerLimit\s*0/)
.with_content(/^\s*StartServers\s*1/)
.with_content(/^\s*MaxClients\s*2/)
.with_content(/^\s*MinSpareThreads\s*3/)
.with_content(/^\s*MaxSpareThreads\s*4/)
.with_content(/^\s*ThreadsPerChild\s*5/)
.with_content(/^\s*MaxRequestsPerChild\s*6/)
.with_content(/^\s*ThreadLimit\s*7/)
.with_content(/^\s*ListenBacklog\s*8/)
.with_content(/^\s*MaxRequestWorkers\s*9/)
.with_content(/^\s*MaxConnectionsPerChild\s*10/)
}
end

context "with Apache version < 2.4" do
let :params do
{
Expand Down
4 changes: 4 additions & 0 deletions templates/mod/event.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@
MaxSpareThreads <%= @maxsparethreads %>
ThreadsPerChild <%= @threadsperchild %>
MaxRequestsPerChild <%= @maxrequestsperchild %>
ThreadLimit <%= @threadlimit %>
ListenBacklog <%= @listenbacklog %>
MaxRequestWorkers <%= @maxrequestworkers %>
MaxConnectionsPerChild <%= @maxconnectionsperchild %>
</IfModule>

0 comments on commit 5ac2f34

Please sign in to comment.