-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: update and fix all tests (inc. provide files for comparison)
- Loading branch information
Showing
22 changed files
with
2,066 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
# frozen_string_literal: true | ||
|
||
# Prepare platform "finger" and base path to file comparison directory | ||
platform_finger = "#{platform[:name]}-#{platform[:release].split('.')[0]}" | ||
comparison_files_dir = '/tmp/kitchen/srv/salt/comparison_files' | ||
|
||
# Default values for `control 'Tomcat main config'` | ||
main_config_file = '/etc/sysconfig/tomcat' | ||
# Default values for `control 'Tomcat Catalina temp dir'` | ||
catalina_tmpdir = '/var/cache/tomcat/temp' | ||
catalina_tmpdir_user_and_group = 'tomcat' | ||
# Default values for `control 'Tomcat `server.xml` config'` | ||
conf_dir = '/etc/tomcat' | ||
server_xml_user_and_group = 'tomcat' | ||
|
||
# Override by platform | ||
case platform[:family] | ||
when 'debian' | ||
main_config_file = '/etc/default/tomcat8' | ||
catalina_tmpdir = '/var/cache/tomcat8/temp' | ||
catalina_tmpdir_user_and_group = 'tomcat8' | ||
conf_dir = '/etc/tomcat8' | ||
server_xml_user_and_group = 'tomcat8' | ||
case platform_finger | ||
when 'debian-10' | ||
main_config_file = '/etc/default/tomcat9' | ||
catalina_tmpdir = '/var/cache/tomcat9/temp' | ||
catalina_tmpdir_user_and_group = 'tomcat' | ||
conf_dir = '/etc/tomcat9' | ||
server_xml_user_and_group = 'tomcat' | ||
when 'debian-9' | ||
when 'debian-8' | ||
main_config_file = '/etc/default/tomcat7' | ||
catalina_tmpdir = '/var/cache/tomcat7/temp' | ||
catalina_tmpdir_user_and_group = 'tomcat7' | ||
conf_dir = '/etc/tomcat7' | ||
server_xml_user_and_group = 'tomcat7' | ||
when 'ubuntu-18' | ||
when 'ubuntu-16' | ||
end | ||
when 'redhat' | ||
case platform_finger | ||
when 'centos-8' | ||
when 'centos-7' | ||
when 'centos-6' | ||
when 'amazon-2' | ||
when 'amazon-2018' | ||
end | ||
when 'fedora' | ||
case platform_finger | ||
when 'fedora-31' | ||
when 'fedora-30' | ||
end | ||
when 'suse' | ||
case platform_finger | ||
when 'opensuse-15' | ||
server_xml_user_and_group = 'root' | ||
end | ||
when 'linux' | ||
case platform_finger | ||
when 'arch-5' | ||
end | ||
end | ||
|
||
control 'Tomcat main config' do | ||
title 'should contain the lines' | ||
|
||
# Prepare comparison file | ||
main_config_path = "#{comparison_files_dir}/main_config/#{platform_finger}" | ||
main_config = file(main_config_path).content | ||
|
||
describe file(main_config_file) do | ||
it { should be_file } | ||
it { should be_owned_by 'root' } | ||
it { should be_grouped_into 'root' } | ||
its('mode') { should cmp '0644' } | ||
its('content') { should include main_config } | ||
end | ||
end | ||
|
||
control 'Tomcat Catalina temp dir' do | ||
title 'should be prepared with the settings' | ||
|
||
describe file(catalina_tmpdir) do | ||
it { should be_directory } | ||
it { should be_owned_by catalina_tmpdir_user_and_group } | ||
it { should be_grouped_into catalina_tmpdir_user_and_group } | ||
its('mode') { should cmp '0755' } | ||
end | ||
end | ||
|
||
control 'Tomcat `server.xml` config' do | ||
title 'should contain the lines' | ||
|
||
server_xml_file = "#{conf_dir}/server.xml" | ||
server_xml_path = "#{comparison_files_dir}/server_xml/#{platform_finger}.xml" | ||
server_xml = file(server_xml_path).content | ||
# Need the hostname to be used for `tomcat.cluster` | ||
server_xml = server_xml.gsub( | ||
'HOSTNAME_PLACEHOLDER', | ||
file('/etc/hostname').content.chomp | ||
) | ||
|
||
describe file(server_xml_file) do | ||
it { should be_file } | ||
it { should be_owned_by server_xml_user_and_group } | ||
it { should be_grouped_into server_xml_user_and_group } | ||
its('mode') { should cmp '0644' } | ||
unless %w[debian-9].include?(platform_finger) | ||
its('content') { should include server_xml } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# This file is managed by salt. Manual changes risk being overwritten. | ||
# # Modify the values passed to the tomcat pillar instead. | ||
|
||
# Service-specific configuration file for tomcat. This will be sourced by | ||
# the SysV init script after the global configuration file | ||
# /etc/tomcat/tomcat.conf, thus allowing values to be overridden in | ||
# a per-service manner. | ||
# | ||
# NEVER change the init script itself. To change values for all services make | ||
# your changes in /etc/tomcat/tomcat.conf | ||
# | ||
# To change values for a specific service make your edits here. | ||
# To create a new service create a link from /etc/init.d/<your new service> to | ||
# /etc/init.d/tomcat (do not copy the init script) and make a copy of the | ||
# /etc/sysconfig/tomcat file to /etc/sysconfig/<your new service> and change | ||
# the property values so the two services won't conflict. Register the new | ||
# service in the system as usual (see chkconfig and similars). | ||
# | ||
|
||
# Where your java installation lives | ||
JAVA_HOME=/usr/lib/jvm/jre | ||
|
||
CATALINA_BASE="/usr/share/tomcat" | ||
|
||
CATALINA_HOME="/usr/share/tomcat" | ||
|
||
CATALINA_TMPDIR="/var/cache/tomcat/temp" | ||
|
||
CATALINA_PID="/var/run/tomcat.pid" | ||
|
||
|
||
# You can pass some parameters to java here if you wish to | ||
#JAVA_OPTS="-Xminf0.1 -Xmaxf0.3" | ||
JAVA_OPTS="-Djava.awt.headless=true -Xmx128m -XX:MaxPermSize=256m -Dlog4j.configuration=file:/tmp/log4j.properties -Dlogback.configurationFile=/tmp/logback.xml" | ||
|
||
#if CLASSPATH is defined in JAVA_OPTS it may no longer munge with the default CLASSPATH | ||
#replace and customize if necessary | ||
#CLASSPATH=/usr/share/tomcat/bin/bootstrap.jar:/usr/share/tomcat/bin/tomcat-juli.jar:/usr/share/java/commons-daemon.jar | ||
|
||
# Use JAVA_OPTS to set java.library.path for libtcnative.so | ||
#JAVA_OPTS="-Djava.library.path=/usr/lib64" | ||
|
||
# What user should run tomcat | ||
TOMCAT_USER=tomcat | ||
|
||
# What group should run tomcat | ||
TOMCAT_GROUP=tomcat | ||
|
||
# You can change your tomcat locale here | ||
#LANG="en_US" | ||
|
||
# Run tomcat under the Java Security Manager | ||
SECURITY_MANAGER="false" | ||
|
||
|
||
# Time to wait in seconds, before killing process | ||
#SHUTDOWN_WAIT="30" | ||
|
||
# Whether to annoy the user with "attempting to shut down" messages or not | ||
#SHUTDOWN_VERBOSE="false" | ||
|
||
# Connector port is 8080 for this tomcat instance | ||
#CONNECTOR_PORT="8080" | ||
|
||
# If you wish to further customize your tomcat environment, | ||
# put your own definitions here | ||
# (i.e. LD_LIBRARY_PATH for some jdbc drivers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# This file is managed by salt. Manual changes risk being overwritten. | ||
# # Modify the values passed to the tomcat pillar instead. | ||
|
||
# Service-specific configuration file for tomcat. This will be sourced by | ||
# the SysV init script after the global configuration file | ||
# /etc/tomcat/tomcat.conf, thus allowing values to be overridden in | ||
# a per-service manner. | ||
# | ||
# NEVER change the init script itself. To change values for all services make | ||
# your changes in /etc/tomcat/tomcat.conf | ||
# | ||
# To change values for a specific service make your edits here. | ||
# To create a new service create a link from /etc/init.d/<your new service> to | ||
# /etc/init.d/tomcat (do not copy the init script) and make a copy of the | ||
# /etc/sysconfig/tomcat file to /etc/sysconfig/<your new service> and change | ||
# the property values so the two services won't conflict. Register the new | ||
# service in the system as usual (see chkconfig and similars). | ||
# | ||
|
||
# Where your java installation lives | ||
JAVA_HOME=/usr/lib/jvm/jre | ||
|
||
CATALINA_BASE="/usr/share/tomcat" | ||
|
||
CATALINA_HOME="/usr/share/tomcat" | ||
|
||
CATALINA_TMPDIR="/var/cache/tomcat/temp" | ||
|
||
CATALINA_PID="/var/run/tomcat.pid" | ||
|
||
|
||
# You can pass some parameters to java here if you wish to | ||
#JAVA_OPTS="-Xminf0.1 -Xmaxf0.3" | ||
JAVA_OPTS="-Djava.awt.headless=true -Xmx128m -XX:MaxPermSize=256m -Dlog4j.configuration=file:/tmp/log4j.properties -Dlogback.configurationFile=/tmp/logback.xml" | ||
|
||
#if CLASSPATH is defined in JAVA_OPTS it may no longer munge with the default CLASSPATH | ||
#replace and customize if necessary | ||
#CLASSPATH=/usr/share/tomcat/bin/bootstrap.jar:/usr/share/tomcat/bin/tomcat-juli.jar:/usr/share/java/commons-daemon.jar | ||
|
||
# Use JAVA_OPTS to set java.library.path for libtcnative.so | ||
#JAVA_OPTS="-Djava.library.path=/usr/lib64" | ||
|
||
# What user should run tomcat | ||
TOMCAT_USER=tomcat | ||
|
||
# What group should run tomcat | ||
TOMCAT_GROUP=tomcat | ||
|
||
# You can change your tomcat locale here | ||
#LANG="en_US" | ||
|
||
# Run tomcat under the Java Security Manager | ||
SECURITY_MANAGER="false" | ||
|
||
|
||
# Time to wait in seconds, before killing process | ||
#SHUTDOWN_WAIT="30" | ||
|
||
# Whether to annoy the user with "attempting to shut down" messages or not | ||
#SHUTDOWN_VERBOSE="false" | ||
|
||
# Connector port is 8080 for this tomcat instance | ||
#CONNECTOR_PORT="8080" | ||
|
||
# If you wish to further customize your tomcat environment, | ||
# put your own definitions here | ||
# (i.e. LD_LIBRARY_PATH for some jdbc drivers) |
Oops, something went wrong.