From 6f18c36b98b77a854d5abe112056a5bc956f9bec Mon Sep 17 00:00:00 2001 From: Jacob McCoy Wade Date: Fri, 18 Sep 2015 15:05:04 -0700 Subject: [PATCH] paramaterizing more tomcat settings added tests for added tomcat parameters --- manifests/init.pp | 23 +++++---- spec/classes/jira_config_spec.rb | 80 ++++++++++++++++++++++++++++++++ templates/server.xml.erb | 22 ++++----- 3 files changed, 106 insertions(+), 19 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 24a0ec1c..24cae384 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -106,14 +106,21 @@ $stop_jira = 'service jira stop && sleep 15', # Tomcat - $tomcatAddress = undef, - $tomcatPort = 8080, - $tomcatNativeSsl = false, - $tomcatHttpsPort = 8443, - $tomcatKeyAlias = 'jira', - $tomcatKeystoreFile = '/home/jira/jira.jks', - $tomcatKeystorePass = 'changeit', - $tomcatKeystoreType = 'JKS', + $tomcatAddress = undef, + $tomcatPort = 8080, + $tomcatMaxHttpHeaderSize = '8192', + $tomcatMinSpareThreads = '25', + $tomcatConnectionTimeout = '20000', + $tomcatEnableLookups = false, + $tomcatNativeSsl = false, + $tomcatHttpsPort = 8443, + $tomcatProtocol = 'HTTP/1.1', + $tomcatUseBodyEncodingForURI = true, + $tomcatDisableUploadTimeout = true, + $tomcatKeyAlias = 'jira', + $tomcatKeystoreFile = '/home/jira/jira.jks', + $tomcatKeystorePass = 'changeit', + $tomcatKeystoreType = 'JKS', # Tomcat Tunables $tomcatMaxThreads = '150', diff --git a/spec/classes/jira_config_spec.rb b/spec/classes/jira_config_spec.rb index b7389f0e..1a287200 100644 --- a/spec/classes/jira_config_spec.rb +++ b/spec/classes/jira_config_spec.rb @@ -109,6 +109,86 @@ .with_content(/acceptCount="200"/) } end + context 'tomcat MaxHttpHeaderSize' do + let(:params) {{ + :version => '6.3.4a', + :javahome => '/opt/java', + :tomcatMaxHttpHeaderSize => '4096', + }} + it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/conf/server.xml') + .with_content(/maxHttpHeaderSize="4096"/) } + end + + context 'tomcat MinSpareThreads' do + let(:params) {{ + :version => '6.3.4a', + :javahome => '/opt/java', + :tomcatMinSpareThreads => '50', + }} + it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/conf/server.xml') + .with_content(/minSpareThreads="50"/) } + end + + context 'tomcat ConnectionTimeout' do + let(:params) {{ + :version => '6.3.4a', + :javahome => '/opt/java', + :tomcatConnectionTimeout => '25000', + }} + it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/conf/server.xml') + .with_content(/connectionTimeout="25000"/) } + end + + context 'tomcat EnableLookups' do + let(:params) {{ + :version => '6.3.4a', + :javahome => '/opt/java', + :tomcatEnableLookups => 'true', + }} + it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/conf/server.xml') + .with_content(/enableLookups="true"/) } + end + + context 'tomcat Protocol' do + let(:params) {{ + :version => '6.3.4a', + :javahome => '/opt/java', + :tomcatProtocol => 'HTTP/1.1', + }} + it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/conf/server.xml') + .with_content(/protocol="HTTP\/1.1"/) } + end + + context 'tomcat UseBodyEncodingForURI' do + let(:params) {{ + :version => '6.3.4a', + :javahome => '/opt/java', + :tomcatUseBodyEncodingForURI => 'false', + }} + it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/conf/server.xml') + .with_content(/useBodyEncodingForURI="false"/) } + end + + context 'tomcat DisableUploadTimeout' do + let(:params) {{ + :version => '6.3.4a', + :javahome => '/opt/java', + :tomcatDisableUploadTimeout => 'false', + }} + it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/conf/server.xml') + .with_content(/disableUploadTimeout="false"/) } + end + + context 'tomcat EnableLookups' do + let(:params) {{ + :version => '6.3.4a', + :javahome => '/opt/java', + :tomcatEnableLookups => 'true', + }} + it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/conf/server.xml') + .with_content(/enableLookups="true"/) } + end + context 'tomcat maxThreads' do let(:params) {{ :version => '6.3.4a', diff --git a/templates/server.xml.erb b/templates/server.xml.erb index 8aa6895b..cb7f6b54 100644 --- a/templates/server.xml.erb +++ b/templates/server.xml.erb @@ -40,14 +40,14 @@ address="<%= @tomcatAddress %>" <%- end -%> maxThreads="<%= @tomcatMaxThreads %>" - minSpareThreads="25" - connectionTimeout="20000" - enableLookups="false" - maxHttpHeaderSize="8192" - protocol="HTTP/1.1" - useBodyEncodingForURI="true" + minSpareThreads="<%= @tomcatMinSpareThreads %>" + connectionTimeout="<%= @tomcatConnectionTimeout %>" + enableLookups="<%= @tomcatEnableLookups %>" + maxHttpHeaderSize="<%= @tomcatMaxHttpHeaderSize %>" + protocol="<%= @tomcatProtocol %>" + useBodyEncodingForURI="<%= @tomcatUseBodyEncodingForURI %>" acceptCount="<%= @tomcatAcceptCount %>" - disableUploadTimeout="true" + disableUploadTimeout="<%= @tomcatDisableUploadTimeout %>" <% if @tomcatNativeSsl -%> redirectPort="<%= @tomcatHttpsPort %>" <% end -%> @@ -65,12 +65,12 @@ <%- if @tomcatAddress -%> address="<%= @tomcatAddress %>" <%- end -%> - maxHttpHeaderSize="8192" + maxHttpHeaderSize="<%= @tomcatMaxHttpHeaderSize %>" SSLEnabled="true" maxThreads="<%= @tomcatMaxThreads %>" - minSpareThreads="25" - enableLookups="false" - disableUploadTimeout="true" + minSpareThreads="<%= @tomcatMinSpareThreads %>" + enableLookups="<%= @tomcatEnableLookups %>" + disableUploadTimeout="<%= @tomcatDisableUploadTimeout %>" acceptCount="<%= @tomcatAcceptCount %>" <% if ! @proxy['scheme'] -%> scheme="https"