Skip to content

Commit

Permalink
Merge pull request #268 from willmeek/tomcat_test_fix
Browse files Browse the repository at this point in the history
Fix Tomcat tests for Tomcat8
  • Loading branch information
david22swan committed Dec 20, 2017
2 parents 56e2069 + 3762418 commit 397f74a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
18 changes: 10 additions & 8 deletions spec/acceptance/acceptance_1b_spec.rb
Expand Up @@ -31,27 +31,27 @@ class jsvc {
cleanup => false,
path => "/opt/apache-tomcat/bin/commons-daemon-native.tar.gz",
extract_path => "/opt/apache-tomcat/bin",
creates => "/opt/apache-tomcat/bin/commons-daemon-1.0.15-native-src",
creates => "/opt/apache-tomcat/bin/commons-daemon-#{LATEST_DAEMON}-native-src",
}
-> exec { 'configure jsvc':
command => "JAVA_HOME=${java_home} configure --with-java=${java_home}",
creates => "/opt/apache-tomcat/bin/commons-daemon-1.0.15-native-src/unix/Makefile",
cwd => "/opt/apache-tomcat/bin/commons-daemon-1.0.15-native-src/unix",
path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/apache-tomcat/bin/commons-daemon-1.0.15-native-src/unix",
creates => "/opt/apache-tomcat/bin/commons-daemon-#{LATEST_DAEMON}-native-src/unix/Makefile",
cwd => "/opt/apache-tomcat/bin/commons-daemon-#{LATEST_DAEMON}-native-src/unix",
path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/apache-tomcat/bin/commons-daemon-#{LATEST_DAEMON}-native-src/unix",
require => [ Class['gcc'], Class['java'] ],
provider => shell,
}
-> exec { 'make jsvc':
command => 'make',
creates => "/opt/apache-tomcat/bin/commons-daemon-1.0.15-native-src/unix/jsvc",
cwd => "/opt/apache-tomcat/bin/commons-daemon-1.0.15-native-src/unix",
path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/apache-tomcat/bin/commons-daemon-1.0.15-native-src/unix",
creates => "/opt/apache-tomcat/bin/commons-daemon-#{LATEST_DAEMON}-native-src/unix/jsvc",
cwd => "/opt/apache-tomcat/bin/commons-daemon-#{LATEST_DAEMON}-native-src/unix",
path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/apache-tomcat/bin/commons-daemon-#{LATEST_DAEMON}-native-src/unix",
provider => shell,
}
-> file { 'jsvc':
ensure => link,
path => "/opt/apache-tomcat/bin/jsvc",
target => "/opt/apache-tomcat/bin/commons-daemon-1.0.15-native-src/unix/jsvc",
target => "/opt/apache-tomcat/bin/commons-daemon-#{LATEST_DAEMON}-native-src/unix/jsvc",
}
}
Expand Down Expand Up @@ -96,6 +96,8 @@ class jsvc {
port => '8309',
}
tomcat::war { 'war_one.war':
user => 'tomcat8',
group => 'tomcat8',
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
war_source => '#{SAMPLE_WAR}',
allow_insecure => true,
Expand Down
8 changes: 8 additions & 0 deletions spec/spec_helper_acceptance.rb
Expand Up @@ -23,6 +23,13 @@ def latest_tomcat_tarball_url(version)
end
end

def latest_daemon_version
require 'net/http'
page = Net::HTTP.get(URI('https://commons.apache.org/proper/commons-daemon/apidocs/index.html'))
latest_version = (match = page.match(%r{(?:Apache\sCommons\sDaemon\s)(\d.\d.\d)?(?:\sAPI)}) and match[1])
latest_version
end

latest7 = latest_tomcat_tarball_url('7')
latest8 = latest_tomcat_tarball_url('8')
latest9 = latest_tomcat_tarball_url('9')
Expand All @@ -40,6 +47,7 @@ def latest_tomcat_tarball_url(version)
TOMCAT_LEGACY_SOURCE = "http://archive.apache.org/dist/tomcat/tomcat-7/v#{TOMCAT_LEGACY_VERSION}/bin/apache-tomcat-#{TOMCAT_LEGACY_VERSION}.tar.gz"
SAMPLE_WAR = 'https://tomcat.apache.org/tomcat-9.0-doc/appdev/sample/sample.war'

LATEST_DAEMON = latest_daemon_version

UNSUPPORTED_PLATFORMS = ['windows','Solaris','Darwin']

Expand Down

0 comments on commit 397f74a

Please sign in to comment.