Skip to content

Commit 5ac2f34

Browse files
committed
Add configurable options for mpm_event
1 parent 1ff81aa commit 5ac2f34

File tree

3 files changed

+49
-8
lines changed

3 files changed

+49
-8
lines changed

manifests/mod/event.pp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
class apache::mod::event (
2-
$startservers = '2',
3-
$maxclients = '150',
4-
$minsparethreads = '25',
5-
$maxsparethreads = '75',
6-
$threadsperchild = '25',
7-
$maxrequestsperchild = '0',
8-
$serverlimit = '25',
9-
$apache_version = $::apache::apache_version,
2+
$startservers = '2',
3+
$maxclients = '150',
4+
$minsparethreads = '25',
5+
$maxsparethreads = '75',
6+
$threadsperchild = '25',
7+
$maxrequestsperchild = '0',
8+
$serverlimit = '25',
9+
$apache_version = $::apache::apache_version,
10+
$threadlimit = '64',
11+
$listenbacklog = '511',
12+
$maxrequestworkers = '256',
13+
$maxconnectionsperchild = '0',
1014
) {
1115
if defined(Class['apache::mod::itk']) {
1216
fail('May not include both apache::mod::event and apache::mod::itk on the same node')

spec/classes/mod/event_spec.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,44 @@
3434
}
3535
end
3636

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

43+
context "Test mpm_event params" do
44+
let :params do
45+
{
46+
:serverlimit => '0',
47+
:startservers => '1',
48+
:maxclients => '2',
49+
:minsparethreads => '3',
50+
:maxsparethreads => '4',
51+
:threadsperchild => '5',
52+
:maxrequestsperchild => '6',
53+
:threadlimit => '7',
54+
:listenbacklog => '8',
55+
:maxrequestworkers => '9',
56+
:maxconnectionsperchild => '10',
57+
}
58+
end
59+
60+
it { is_expected.to contain_file("/etc/apache2/mods-available/event.conf").with_ensure('file')
61+
.with_content(/^\s*ServerLimit\s*0/)
62+
.with_content(/^\s*StartServers\s*1/)
63+
.with_content(/^\s*MaxClients\s*2/)
64+
.with_content(/^\s*MinSpareThreads\s*3/)
65+
.with_content(/^\s*MaxSpareThreads\s*4/)
66+
.with_content(/^\s*ThreadsPerChild\s*5/)
67+
.with_content(/^\s*MaxRequestsPerChild\s*6/)
68+
.with_content(/^\s*ThreadLimit\s*7/)
69+
.with_content(/^\s*ListenBacklog\s*8/)
70+
.with_content(/^\s*MaxRequestWorkers\s*9/)
71+
.with_content(/^\s*MaxConnectionsPerChild\s*10/)
72+
}
73+
end
74+
4275
context "with Apache version < 2.4" do
4376
let :params do
4477
{

templates/mod/event.conf.erb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@
66
MaxSpareThreads <%= @maxsparethreads %>
77
ThreadsPerChild <%= @threadsperchild %>
88
MaxRequestsPerChild <%= @maxrequestsperchild %>
9+
ThreadLimit <%= @threadlimit %>
10+
ListenBacklog <%= @listenbacklog %>
11+
MaxRequestWorkers <%= @maxrequestworkers %>
12+
MaxConnectionsPerChild <%= @maxconnectionsperchild %>
913
</IfModule>

0 commit comments

Comments
 (0)