diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2ce5b055..1dadbe82 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -57,6 +57,8 @@ jobs:
needs: setup_matrix
runs-on: ubuntu-latest
env:
+ LANG: en_US
+ LC_ALL: en_US.UTF-8
BUNDLE_WITHOUT: development:test:release
strategy:
fail-fast: false
diff --git a/.sync.yml b/.sync.yml
index 35424a92..12e16091 100644
--- a/.sync.yml
+++ b/.sync.yml
@@ -3,3 +3,6 @@ Gemfile:
optional:
':test':
- gem: puppet-lint-param-docs
+spec/spec_helper.rb:
+ spec_overrides:
+ - "require 'support/acceptance/constants.rb'"
diff --git a/manifests/config.pp b/manifests/config.pp
index acb3e747..37190838 100644
--- a/manifests/config.pp
+++ b/manifests/config.pp
@@ -151,17 +151,21 @@
# Configuration logic ends, resources begin:
file { "${jira::webappdir}/bin/user.sh":
- content => epp('jira/user.sh.epp'),
+ content => epp("${module_name}/user.sh.epp"),
mode => '0755',
}
file { "${jira::webappdir}/bin/setenv.sh":
- content => epp('jira/setenv.sh.epp'),
+ content => epp("${module_name}/setenv.sh.epp"),
mode => '0755',
}
+ $dbconfig_template = $jira::use_jndi_ds ? {
+ true => "${module_name}/dbconfig.jndi.xml.epp",
+ default => "${module_name}/dbconfig.xml.epp"
+ }
file { "${jira::homedir}/dbconfig.xml":
- content => epp('jira/dbconfig.xml.epp'),
+ content => epp($dbconfig_template),
mode => '0600',
}
@@ -174,12 +178,12 @@
}
file { "${jira::webappdir}/conf/server.xml":
- content => epp('jira/server.xml.epp'),
+ content => epp("${module_name}/server.xml.epp"),
mode => '0600',
}
file { "${jira::webappdir}/conf/context.xml":
- content => epp('jira/context.xml.epp'),
+ content => epp("${module_name}/context.xml.epp"),
mode => '0600',
}
@@ -195,7 +199,7 @@
if $jira::datacenter {
file { "${jira::homedir}/cluster.properties":
- content => epp('jira/cluster.properties.epp'),
+ content => epp("${module_name}/cluster.properties.epp"),
mode => '0600',
}
}
diff --git a/manifests/init.pp b/manifests/init.pp
index e43c9c12..20e84025 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -58,6 +58,10 @@
# EHCache configuration for clustered mode
# @param ehcache_object_port
# EHCache configuration for clustered mode
+# @param use_jndi_ds
+# If true, the database will be configured as JNDI datasource in server.xml and then referenced in dbconfig.xml
+# @param jndi_ds_name
+# Configures the JNDI datasource name
# @param db
# The kind of database to use.
# @param dbname
@@ -263,6 +267,15 @@
# undocumented SSO parameter
# @param session_lastvalidation
# undocumented SSO parameter
+# @param plugins
+# an array of hashes defining custom plugins to install
+# a single plugin configuration will has the following form
+# installation_name: this name wil be used to install the plugin within jira
+# source: url of plugin to be fetched
+# username: the username for authentification, if necessary
+# password: the password for authentification, if necessary
+# checksum: the checksum of the plugin, to determine the need for an upgrade
+# checksumtype: the type of checksum used (none|md5|sha1|sha2|sha256|sha384|sha512). (default: none)
# @param jvm_permgen
# Deprecated. Exists to notify users that they're trying to configure a parameter that has no effect
# @param poolsize
@@ -296,6 +309,8 @@
Optional[Stdlib::Port] $ehcache_listener_port = undef,
Optional[Stdlib::Port] $ehcache_object_port = undef,
# Database Settings
+ Boolean $use_jndi_ds = false,
+ String[1] $jndi_ds_name = 'JiraDS',
Enum['postgresql','mysql','sqlserver','oracle','h2'] $db = 'postgresql',
String $dbuser = 'jiraadm',
String $dbpassword = 'mypassword',
@@ -352,10 +367,9 @@
$service_notify = undef,
$service_subscribe = undef,
# Command to stop jira in preparation to upgrade. This is configurable
- # incase the jira service is managed outside of puppet. eg: using the
+ # in case the jira service is managed outside of puppet. eg: using the
# puppetlabs-corosync module: 'crm resource stop jira && sleep 15'
- # Note: the command should return either 0 or 5
- # when the service doesn't exist
+ # Note: the command should return either 0 or 5 when the service doesn't exist
String $stop_jira = 'systemctl stop jira.service && sleep 15',
# Whether to manage the 'check-java.sh' script, and where to retrieve
# the script from.
@@ -411,8 +425,10 @@
Optional[String] $jvm_permgen = undef,
Optional[Integer[0]] $poolsize = undef,
Optional[Boolean] $enable_connection_pooling = undef,
+ # plugin installation
+ Array[Hash] $plugins = [],
) {
- # To maintain compatibility with previous behaviour, we check for not-servicedesk instead of specifying the
+ # To maintain compatibility with previous behaviour, we check for not-servicedesk instead of specifying the
if $product != 'servicedesk' and versioncmp($jira::version, '8.0.0') < 0 {
fail('JIRA versions older than 8.0.0 are no longer supported. Please use an older version of this module to upgrade first.')
}
@@ -476,4 +492,34 @@
if ($enable_sso) {
class { 'jira::sso': }
}
+
+ # install any given library or remove them
+ $plugins.each |Hash $plugin_data| {
+ $target = "${jira::webappdir}/atlassian-jira/WEB-INF/lib/${$plugin_data['installation_name']}"
+ if $plugin_data['ensure'] == 'absent' {
+ archive {
+ $target:
+ ensure => 'absent',
+ }
+ } else {
+ $_target_defaults = {
+ ensure => 'present',
+ source => $plugin_data['source'],
+ checksum => $plugin_data['checksum'],
+ checksum_type => $plugin_data['checksum_type'],
+ }
+ $_username = !empty($plugin_data['username']) ? {
+ default => {},
+ true => { username => $plugin_data['username'] }
+ }
+ $_password = !empty($plugin_data['password']) ? {
+ default => {},
+ true => { password => $plugin_data['password'] }
+ }
+ $_plugin_archive = {
+ $target => $_target_defaults + $_username + $_password
+ }
+ create_resources(archive, $_plugin_archive)
+ }
+ }
}
diff --git a/spec/acceptance/default_parameters_spec.rb b/spec/acceptance/default_parameters_spec.rb
index 542b0266..a7d02f98 100644
--- a/spec/acceptance/default_parameters_spec.rb
+++ b/spec/acceptance/default_parameters_spec.rb
@@ -45,17 +45,18 @@ class { 'jira':
EOS
# jira just takes *ages* to start up :-(
+ WGET_CMD = 'wget -q --tries=24 --retry-connrefused --read-timeout=10 localhost:8080'.freeze
apply_manifest(pp, catch_failures: true)
sleep 60
- shell 'wget -q --tries=24 --retry-connrefused --read-timeout=10 localhost:8080', acceptable_exit_codes: [0, 8]
+ shell WGET_CMD, acceptable_exit_codes: [0, 8]
sleep 60
- shell 'wget -q --tries=24 --retry-connrefused --read-timeout=10 localhost:8080', acceptable_exit_codes: [0, 8]
+ shell WGET_CMD, acceptable_exit_codes: [0, 8]
sleep 60
apply_manifest(pp_upgrade, catch_failures: true)
sleep 60
- shell 'wget -q --tries=24 --retry-connrefused --read-timeout=10 localhost:8080', acceptable_exit_codes: [0, 8]
+ shell WGET_CMD, acceptable_exit_codes: [0, 8]
sleep 60
- shell 'wget -q --tries=24 --retry-connrefused --read-timeout=10 localhost:8080', acceptable_exit_codes: [0, 8]
+ shell WGET_CMD, acceptable_exit_codes: [0, 8]
sleep 60
apply_manifest(pp_upgrade, catch_failures: true)
end
diff --git a/spec/acceptance/mysql_spec.rb b/spec/acceptance/mysql_spec.rb
index 4a2c4404..88859118 100644
--- a/spec/acceptance/mysql_spec.rb
+++ b/spec/acceptance/mysql_spec.rb
@@ -60,11 +60,12 @@ class { 'jira':
}
EOS
+ WGET_CMD = 'wget -q --tries=24 --retry-connrefused --read-timeout=10 --no-check-certificate localhost:8081'.freeze
apply_manifest(pp, catch_failures: true)
sleep 60
- shell 'wget -q --tries=24 --retry-connrefused --read-timeout=10 --no-check-certificate localhost:8081', acceptable_exit_codes: [0, 8]
+ shell WGET_CMD, acceptable_exit_codes: [0, 8]
sleep 60
- shell 'wget -q --tries=24 --retry-connrefused --read-timeout=10 --no-check-certificate localhost:8081', acceptable_exit_codes: [0, 8]
+ shell WGET_CMD, acceptable_exit_codes: [0, 8]
sleep 60
apply_manifest(pp, catch_changes: true)
end
diff --git a/spec/classes/jira_config_spec.rb b/spec/classes/jira_config_spec.rb
index 965c65fc..0436ef9d 100644
--- a/spec/classes/jira_config_spec.rb
+++ b/spec/classes/jira_config_spec.rb
@@ -1,7 +1,20 @@
require 'spec_helper.rb'
+# set some constants to keep it DRY
+REGEXP_DISABLE_NOTIFICATIONS = %r{#DISABLE_NOTIFICATIONS=}
+REGEXP_POSTGRESQL_URL = %r{jdbc:postgresql://localhost:5432/jira}
+REGEXP_PUBLIC_SCHEMA = %r{public}
+HTTP11 = 'HTTP/1.1'.freeze
+PLUGIN_SOURCE_URL = 'https://www.example.com/fine-jira-plugin.tgz'.freeze
describe 'jira' do
describe 'jira::config' do
+ let(:params) do
+ {
+ javahome: '/opt/java',
+ version: DEFAULT_VERSION,
+ }
+ end
+
context 'supported operating systems' do
on_supported_os.each do |os, facts|
context "on #{os}" do
@@ -10,24 +23,18 @@
end
context 'default params' do
- let(:params) do
- {
- javahome: '/opt/java'
- }
- end
-
it { is_expected.to compile.with_all_deps }
it do
- is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/bin/setenv.sh').
- with_content(%r{#DISABLE_NOTIFICATIONS=})
+ is_expected.to contain_file(FILENAME_SETENV_SH).
+ with_content(REGEXP_DISABLE_NOTIFICATIONS)
end
- it { is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/bin/user.sh') }
- it { is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/conf/server.xml') }
+ it { is_expected.to contain_file(FILENAME_USER_SH) }
+ it { is_expected.to contain_file(FILENAME_SERVER_XML) }
# Also ensure that we actually omit elements by default
it do
- is_expected.to contain_file('/home/jira/dbconfig.xml').
- with_content(%r{jdbc:postgresql://localhost:5432/jira}).
- with_content(%r{public}).
+ is_expected.to contain_file(FILENAME_DBCONFIG_XML).
+ with_content(REGEXP_POSTGRESQL_URL).
+ with_content(REGEXP_PUBLIC_SCHEMA).
with_content(%r{20}).
with_content(%r{20}).
with_content(%r{30000}).
@@ -41,8 +48,8 @@
with_content(%r{select version\(\);}).
with_content(%r{tcpKeepAlive=true;socketTimeout=240})
end
- it { is_expected.not_to contain_file('/home/jira/cluster.properties') }
- it { is_expected.not_to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/bin/check-java.sh') }
+ it { is_expected.not_to contain_file(FILENAME_CLUSTER_PROPS) }
+ it { is_expected.not_to contain_file(FILENAME_CHECK_JAVA_SH) }
end
context 'default params with java install' do
@@ -69,7 +76,7 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_package('java-11-openjdk-headless') }
it do
- is_expected.to contain_file('/home/jira/dbconfig.xml').
+ is_expected.to contain_file(FILENAME_DBCONFIG_XML).
with_content(%r{select 1}).
with_content(%r{3}).
without_content(%r{})
@@ -78,21 +85,19 @@
context 'database settings' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
+ super().merge(
connection_settings: 'TEST-SETTING;',
pool_max_size: 200,
pool_min_size: 10,
- validation_query: 'SELECT myfunction();',
- }
+ validation_query: 'SELECT myfunction();'
+ )
end
- it { is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/bin/setenv.sh') }
- it { is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/bin/user.sh') }
- it { is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/conf/server.xml') }
+ it { is_expected.to contain_file(FILENAME_SETENV_SH) }
+ it { is_expected.to contain_file(FILENAME_USER_SH) }
+ it { is_expected.to contain_file(FILENAME_SERVER_XML) }
it do
- is_expected.to contain_file('/home/jira/dbconfig.xml').
+ is_expected.to contain_file(FILENAME_DBCONFIG_XML).
with_content(%r{TEST-SETTING;}).
with_content(%r{200}).
with_content(%r{10}).
@@ -102,34 +107,30 @@
context 'mysql params' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
+ super().merge(
db: 'mysql'
- }
+ )
end
- it { is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/bin/setenv.sh') }
- it { is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/bin/user.sh') }
- it { is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/conf/server.xml') }
+ it { is_expected.to contain_file(FILENAME_SETENV_SH) }
+ it { is_expected.to contain_file(FILENAME_USER_SH) }
+ it { is_expected.to contain_file(FILENAME_SERVER_XML) }
it do
- is_expected.to contain_file('/home/jira/dbconfig.xml').
+ is_expected.to contain_file(FILENAME_DBCONFIG_XML).
with_content(%r{jdbc:mysql://localhost:3306/jira})
end
end
context 'oracle params' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
+ super().merge(
db: 'oracle',
- dbname: 'mydatabase',
- }
+ dbname: 'mydatabase'
+ )
end
it do
- is_expected.to contain_file('/home/jira/dbconfig.xml').
+ is_expected.to contain_file(FILENAME_DBCONFIG_XML).
with_content(%r{jdbc:oracle:thin:@localhost:1521:mydatabase}).
with_content(%r{oracle10g}).
with_content(%r{oracle.jdbc.OracleDriver})
@@ -138,69 +139,168 @@
context 'oracle servicename' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
+ super().merge(
db: 'oracle',
dbport: 1522,
dbserver: 'oracleserver',
oracle_use_sid: false,
- dbname: 'mydatabase',
- }
+ dbname: 'mydatabase'
+ )
end
it do
- is_expected.to contain_file('/home/jira/dbconfig.xml').
+ is_expected.to contain_file(FILENAME_DBCONFIG_XML).
with_content(%r{jdbc:oracle:thin:@oracleserver:1522/mydatabase})
end
end
+ context 'postgres params' do
+ let(:params) do
+ super().merge(
+ db: 'postgresql',
+ dbport: 4711,
+ dbserver: 'TheSQLServer',
+ dbname: 'TheJiraDB',
+ dbuser: 'TheDBUser',
+ dbpassword: 'TheDBPassword'
+ )
+ end
+
+ it do
+ is_expected.to contain_file(FILENAME_DBCONFIG_XML).
+ with_content(%r{jdbc:postgresql://TheSQLServer:4711/TheJiraDB}).
+ with_content(REGEXP_PUBLIC_SCHEMA).
+ with_content(%r{TheDBUser}).
+ with_content(%r{TheDBPassword})
+ end
+ end
+
+ context 'JNDI DS usage' do
+ let(:params) do
+ super().merge(
+ use_jndi_ds: true,
+ jndi_ds_name: 'TestJndiDSName',
+ db: 'postgresql',
+ dbport: 4711,
+ dbserver: 'TheSQLServer',
+ dbname: 'TheJiraDB',
+ dbuser: 'TheDBUser',
+ dbpassword: 'TheDBPassword'
+ )
+ end
+
+ it do
+ is_expected.to contain_file(FILENAME_SERVER_XML).
+ with_content(%r{Resource name="jdbc/TestJndiDSName"}).
+ with_content(%r{driverClassName="org.postgresql.Driver"}).
+ with_content(%r{url="jdbc:postgresql://TheSQLServer:4711/TheJiraDB"}).
+ with_content(%r{username="TheDBUser"}).
+ with_content(%r{password="TheDBPassword"}).
+ with_content(%r{maxTotal="20"}).
+ with_content(%r{maxIdle="20"}).
+ with_content(%r{validationQuery="select 1"})
+ end
+
+ it do
+ is_expected.not_to contain_file(FILENAME_DBCONFIG_XML).
+ with_content(%r{jdbc:postgresql://TheSQLServer:4711/TheJiraDB}).
+ with_content(%r{20}).
+ with_content(%r{20}).
+ with_content(%r{select version\(\);})
+ end
+
+ it do
+ is_expected.to contain_file(FILENAME_DBCONFIG_XML).
+ with_content(%r{defaultDS}).
+ with_content(%r{default}).
+ with_content(%r{postgres72}).
+ with_content(REGEXP_PUBLIC_SCHEMA).
+ with_content(%r{\s*java:comp/env/jdbc/TestJndiDSName\s*})
+ end
+ end
+
+ context 'Non JNDI DS usage' do
+ let(:params) do
+ super().merge(
+ db: 'postgresql',
+ dbport: 4711,
+ dbserver: 'TheSQLServer',
+ dbname: 'TheJiraDB',
+ dbuser: 'TheDBUser',
+ dbpassword: 'TheDBPassword'
+ )
+ end
+
+ it do
+ is_expected.not_to contain_file(FILENAME_SERVER_XML).
+ with_content(%r{Resource name="jdbc/TestJndiDSName"}).
+ with_content(%r{driverClassName="org.postgresql.Driver"}).
+ with_content(%r{url="jdbc:postgresql://TheSQLServer:4711/TheJiraDB"}).
+ with_content(%r{username="TheDBUser"}).
+ with_content(%r{password="TheDBPassword"}).
+ with_content(%r{maxTotal="20"}).
+ with_content(%r{maxIdle="20"}).
+ with_content(%r{validationQuery="select 1"})
+ end
+
+ it do
+ is_expected.to contain_file(FILENAME_DBCONFIG_XML).
+ with_content(%r{jdbc:postgresql://TheSQLServer:4711/TheJiraDB}).
+ with_content(%r{20}).
+ with_content(%r{20}).
+ with_content(%r{select version\(\);})
+ end
+
+ it do
+ is_expected.not_to contain_file(FILENAME_DBCONFIG_XML).
+ with_content(%r{defaultDS}).
+ with_content(%r{default}).
+ with_content(%r{postgres72}).
+ with_content(REGEXP_PUBLIC_SCHEMA).
+ with_content(%r{\s*java:comp/env/jdbc/TestJndiDSName\s*})
+ end
+ end
+
context 'sqlserver params' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
+ super().merge(
db: 'sqlserver',
dbport: '1433',
dbschema: 'public'
- }
+ )
end
- it { is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/bin/setenv.sh') }
- it { is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/bin/user.sh') }
- it { is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/conf/server.xml') }
+ it { is_expected.to contain_file(FILENAME_SETENV_SH) }
+ it { is_expected.to contain_file(FILENAME_USER_SH) }
+ it { is_expected.to contain_file(FILENAME_SERVER_XML) }
it do
- is_expected.to contain_file('/home/jira/dbconfig.xml').
- with_content(%r{public})
+ is_expected.to contain_file(FILENAME_DBCONFIG_XML).
+ with_content(REGEXP_PUBLIC_SCHEMA)
end
end
context 'custom dburl' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
+ super().merge(
dburl: 'my custom dburl'
- }
+ )
end
it do
- is_expected.to contain_file('/home/jira/dbconfig.xml').
+ is_expected.to contain_file(FILENAME_DBCONFIG_XML).
with_content(%r{my custom dburl})
end
end
context 'customise tomcat connector' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
+ super().merge(
tomcat_port: 9229
- }
+ )
end
it do
- is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/conf/server.xml').
+ is_expected.to contain_file(FILENAME_SERVER_XML).
with_content(%r{ 'https',
'proxyName' => 'www.example.com',
'proxyPort' => '9999'
}
- }
+ )
end
it do
- is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/conf/server.xml').
+ is_expected.to contain_file(FILENAME_SERVER_XML).
with_content(%r{proxyName = 'www\.example\.com'}).
with_content(%r{scheme = 'https'}).
with_content(%r{proxyPort = '9999'})
@@ -440,20 +511,18 @@
context 'tomcat proxy path native ssl default params' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
+ super().merge(
proxy: {
'scheme' => 'https',
'proxyName' => 'www.example.com',
'proxyPort' => '9999'
},
tomcat_native_ssl: true
- }
+ )
end
it do
- is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/conf/server.xml').
+ is_expected.to contain_file(FILENAME_SERVER_XML).
with_content(%r{proxyName = 'www\.example\.com'}).
with_content(%r{scheme = 'https'}).
with_content(%r{proxyPort = '9999'}).
@@ -471,35 +540,31 @@
context 'ajp proxy' do
context 'with valid config including protocol AJP/1.3' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
+ super().merge(
ajp: {
'port' => '8009',
'protocol' => 'AJP/1.3'
}
- }
+ )
end
it do
- is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/conf/server.xml').
+ is_expected.to contain_file(FILENAME_SERVER_XML).
with_content(%r{})
end
end
context 'with valid config including protocol org.apache.coyote.ajp.AjpNioProtocol' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
+ super().merge(
ajp: {
'port' => '8009',
'protocol' => 'org.apache.coyote.ajp.AjpNioProtocol'
}
- }
+ )
end
it do
- is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/conf/server.xml').
+ is_expected.to contain_file(FILENAME_SERVER_XML).
with_content(%r{})
end
end
@@ -507,15 +572,13 @@
context 'tomcat additional connectors, without default' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
+ super().merge(
tomcat_default_connector: false,
tomcat_additional_connectors: {
8081 => {
'URIEncoding' => 'UTF-8',
'connectionTimeout' => '20000',
- 'protocol' => 'HTTP/1.1',
+ 'protocol' => HTTP11,
'proxyName' => 'foo.example.com',
'proxyPort' => '8123',
'secure' => true,
@@ -524,17 +587,17 @@
8082 => {
'URIEncoding' => 'UTF-8',
'connectionTimeout' => '20000',
- 'protocol' => 'HTTP/1.1',
+ 'protocol' => HTTP11,
'proxyName' => 'bar.example.com',
'proxyPort' => '8124',
'scheme' => 'http'
}
}
- }
+ )
end
it do
- is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/conf/server.xml').
+ is_expected.to contain_file(FILENAME_SERVER_XML).
without_content(%r{})
end
end
context 'tomcat access log format with x-forward-for handling' do
let(:params) do
- {
- version: '8.16.0',
- javahome: '/opt/java',
- tomcat_accesslog_enable_xforwarded_for: true,
- }
+ super().merge(
+ tomcat_accesslog_enable_xforwarded_for: true
+ )
end
it do
- is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.16.0-standalone/conf/server.xml').
+ is_expected.to contain_file(FILENAME_SERVER_XML).
with_content(%r{org.apache.catalina.valves.RemoteIpValve}).
with_content(%r{requestAttributesEnabled="true"})
end
@@ -587,60 +646,52 @@
context 'with script_check_java_managed enabled' do
let(:params) do
- {
- script_check_java_manage: true,
- version: '8.1.0',
- javahome: '/opt/java'
- }
+ super().merge(
+ script_check_java_manage: true
+ )
end
it do
- is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.1.0-standalone/bin/check-java.sh').
+ is_expected.to contain_file(FILENAME_CHECK_JAVA_SH).
with_content(%r{Wrong JVM version})
end
end
context 'context resources' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
+ super().merge(
resources: { 'testdb' => { 'auth' => 'Container' } }
- }
+ )
end
it do
- is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/conf/context.xml').
+ is_expected.to contain_file("#{PATH_INSTALLATION_BASE}/conf/context.xml").
with_content(%r{})
end
end
context 'disable notifications' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
+ super().merge(
disable_notifications: true
- }
+ )
end
it do
- is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/bin/setenv.sh').
+ is_expected.to contain_file(FILENAME_SETENV_SH).
with_content(%r{^DISABLE_NOTIFICATIONS=})
end
end
context 'native ssl support default params' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
+ super().merge(
tomcat_native_ssl: true
- }
+ )
end
it do
- is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/conf/server.xml').
+ is_expected.to contain_file(FILENAME_SERVER_XML).
with_content(%r{redirectPort="8443"}).
with_content(%r{port="8443"}).
with_content(%r{keyAlias="jira"}).
@@ -654,9 +705,7 @@
context 'native ssl support custom params' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
+ super().merge(
tomcat_native_ssl: true,
tomcat_https_port: 9443,
tomcat_address: '127.0.0.1',
@@ -666,11 +715,11 @@
tomcat_keystore_file: '/tmp/keyfile.ks',
tomcat_keystore_pass: 'keystorepass',
tomcat_keystore_type: 'PKCS12'
- }
+ )
end
it do
- is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/conf/server.xml').
+ is_expected.to contain_file(FILENAME_SERVER_XML).
with_content(%r{redirectPort="9443"}).
with_content(%r{port="9443"}).
with_content(%r{keyAlias="keystorealias"}).
@@ -685,47 +734,41 @@
context 'enable secure admin sessions' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
+ super().merge(
enable_secure_admin_sessions: true
- }
+ )
end
it do
- is_expected.to contain_file('/home/jira/jira-config.properties').
+ is_expected.to contain_file(FILENAME_JIRA_CONFIG_PROPS).
with_content(%r{jira.websudo.is.disabled = false})
end
end
context 'disable secure admin sessions' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
+ super().merge(
enable_secure_admin_sessions: false
- }
+ )
end
it do
- is_expected.to contain_file('/home/jira/jira-config.properties').
+ is_expected.to contain_file(FILENAME_JIRA_CONFIG_PROPS).
with_content(%r{jira.websudo.is.disabled = true})
end
end
context 'jira-config.properties' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
+ super().merge(
jira_config_properties: {
'ops.bar.group.size.opsbar-transitions' => '4'
}
- }
+ )
end
it do
- is_expected.to contain_file('/home/jira/jira-config.properties').
+ is_expected.to contain_file(FILENAME_JIRA_CONFIG_PROPS).
with_content(%r{jira.websudo.is.disabled = false}).
with_content(%r{ops.bar.group.size.opsbar-transitions = 4})
end
@@ -733,16 +776,14 @@
context 'enable clustering' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
+ super().merge(
datacenter: true,
shared_homedir: '/mnt/jira_shared_home_dir'
- }
+ )
end
it do
- is_expected.to contain_file('/home/jira/cluster.properties').
+ is_expected.to contain_file(FILENAME_CLUSTER_PROPS).
with_content(%r{jira.node.id = \S+}).
with_content(%r{jira.shared.home = /mnt/jira_shared_home_dir})
end
@@ -750,19 +791,17 @@
context 'enable clustering with ehcache options' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
+ super().merge(
datacenter: true,
shared_homedir: '/mnt/jira_shared_home_dir',
ehcache_listener_host: 'jira.foo.net',
ehcache_listener_port: 42,
ehcache_object_port: 401
- }
+ )
end
it do
- is_expected.to contain_file('/home/jira/cluster.properties').
+ is_expected.to contain_file(FILENAME_CLUSTER_PROPS).
with_content(%r{jira.node.id = \S+}).
with_content(%r{jira.shared.home = /mnt/jira_shared_home_dir}).
with_content(%r{ehcache.listener.hostName = jira.foo.net}).
@@ -771,65 +810,199 @@
end
end
- context 'jira-8.12 - OpenJDK jvm params' do
+ context 'OpenJDK jvm params' do
let(:params) do
- {
- version: '8.16.0',
- javahome: '/opt/java',
+ super().merge(
jvm_type: 'openjdk-11'
- }
+ )
end
it { is_expected.to compile.with_all_deps }
it do
- is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.16.0-standalone/bin/setenv.sh').
- with_content(%r{#DISABLE_NOTIFICATIONS=}).
+ is_expected.to contain_file(FILENAME_SETENV_SH).
+ with_content(REGEXP_DISABLE_NOTIFICATIONS).
with_content(%r{JVM_SUPPORT_RECOMMENDED_ARGS=''}).
with_content(%r{JVM_GC_ARGS='.+ \-XX:\+ExplicitGCInvokesConcurrent}).
with_content(%r{JVM_CODE_CACHE_ARGS='\S+InitialCodeCacheSize=32m \S+ReservedCodeCacheSize=512m}).
with_content(%r{JVM_REQUIRED_ARGS='.+InterningDocumentFactory})
end
- it { is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.16.0-standalone/bin/user.sh') }
- it { is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.16.0-standalone/conf/server.xml') }
+ it { is_expected.to contain_file(FILENAME_USER_SH) }
+ it { is_expected.to contain_file(FILENAME_SERVER_XML) }
it do
- is_expected.to contain_file('/home/jira/dbconfig.xml').
- with_content(%r{jdbc:postgresql://localhost:5432/jira}).
- with_content(%r{public})
+ is_expected.to contain_file(FILENAME_DBCONFIG_XML).
+ with_content(REGEXP_POSTGRESQL_URL).
+ with_content(REGEXP_PUBLIC_SCHEMA)
end
- it { is_expected.not_to contain_file('/home/jira/cluster.properties') }
- it { is_expected.not_to contain_file('/opt/jira/atlassian-jira-software-8.16.0-standalone/bin/check-java.sh') }
+ it { is_expected.not_to contain_file(FILENAME_CLUSTER_PROPS) }
+ it { is_expected.not_to contain_file(FILENAME_CHECK_JAVA_SH) }
end
- context 'jira-8.12 - custom jvm params' do
+ context 'custom jvm params' do
let(:params) do
- {
- version: '8.16.0',
- javahome: '/opt/java',
+ super().merge(
java_opts: '-XX:-TEST_OPTIONAL',
jvm_gc_args: '-XX:-TEST_GC_ARG',
jvm_code_cache_args: '-XX:-TEST_CODECACHE',
jvm_extra_args: '-XX:-TEST_EXTRA'
- }
+ )
end
it { is_expected.to compile.with_all_deps }
it do
- is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.16.0-standalone/bin/setenv.sh').
- with_content(%r{#DISABLE_NOTIFICATIONS=}).
+ is_expected.to contain_file(FILENAME_SETENV_SH).
+ with_content(REGEXP_DISABLE_NOTIFICATIONS).
with_content(%r{JVM_SUPPORT_RECOMMENDED_ARGS=\S+TEST_OPTIONAL}).
with_content(%r{JVM_GC_ARGS=\S+TEST_GC_ARG}).
with_content(%r{JVM_CODE_CACHE_ARGS=\S+TEST_CODECACHE}).
with_content(%r{JVM_EXTRA_ARGS=\S+TEST_EXTRA})
end
- it { is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.16.0-standalone/bin/user.sh') }
- it { is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.16.0-standalone/conf/server.xml') }
+ it { is_expected.to contain_file(FILENAME_USER_SH) }
+ it { is_expected.to contain_file(FILENAME_SERVER_XML) }
+ it do
+ is_expected.to contain_file(FILENAME_DBCONFIG_XML).
+ with_content(REGEXP_POSTGRESQL_URL).
+ with_content(REGEXP_PUBLIC_SCHEMA)
+ end
+ it { is_expected.not_to contain_file(FILENAME_CLUSTER_PROPS) }
+ it { is_expected.not_to contain_file(FILENAME_CHECK_JAVA_SH) }
+ end
+
+ context 'simple plugin download without username and password' do
+ let(:params) do
+ super().merge(
+ plugins: [
+ {
+ installation_name: 'fine-jira-plugin.jar',
+ source: PLUGIN_SOURCE_URL,
+ ensure: 'present',
+ checksum: '123abc',
+ checksum_type: 'sha512'
+ }
+ ]
+ )
+ end
+
+ it { is_expected.to compile.with_all_deps }
+
it do
- is_expected.to contain_file('/home/jira/dbconfig.xml').
- with_content(%r{jdbc:postgresql://localhost:5432/jira}).
- with_content(%r{public})
+ is_expected.to contain_archive("#{PATH_INSTALLATION_BASE}/atlassian-jira/WEB-INF/lib/fine-jira-plugin.jar").
+ with({
+ source: PLUGIN_SOURCE_URL,
+ ensure: 'present',
+ checksum: '123abc',
+ checksum_type: 'sha512'
+ })
+ end
+ end
+
+ context 'simple plugin download with username' do
+ let(:params) do
+ super().merge(
+ plugins: [
+ {
+ installation_name: 'fine-jira-plugin.jar',
+ source: PLUGIN_SOURCE_URL,
+ ensure: 'present',
+ username: 'TheUser',
+ checksum: '123abc',
+ checksum_type: 'sha512'
+ }
+ ]
+ )
+ end
+
+ it { is_expected.to compile.with_all_deps }
+
+ it do
+ is_expected.to contain_archive("#{PATH_INSTALLATION_BASE}/atlassian-jira/WEB-INF/lib/fine-jira-plugin.jar").
+ with({
+ source: PLUGIN_SOURCE_URL,
+ ensure: 'present',
+ username: 'TheUser',
+ checksum: '123abc',
+ checksum_type: 'sha512'
+ })
+ end
+ end
+
+ context 'simple plugin download with password' do
+ let(:params) do
+ super().merge(
+ plugins: [
+ {
+ installation_name: 'fine-jira-plugin.jar',
+ source: PLUGIN_SOURCE_URL,
+ ensure: 'present',
+ password: 'ThePassword',
+ checksum: '123abc',
+ checksum_type: 'sha512'
+ }
+ ]
+ )
+ end
+
+ it { is_expected.to compile.with_all_deps }
+
+ it do
+ is_expected.to contain_archive("#{PATH_INSTALLATION_BASE}/atlassian-jira/WEB-INF/lib/fine-jira-plugin.jar").
+ with({
+ source: PLUGIN_SOURCE_URL,
+ ensure: 'present',
+ password: 'ThePassword',
+ checksum: '123abc',
+ checksum_type: 'sha512'
+ })
+ end
+ end
+
+ context 'simple plugin download with username and password' do
+ let(:params) do
+ super().merge(
+ plugins: [
+ {
+ installation_name: 'fine-jira-plugin.jar',
+ source: PLUGIN_SOURCE_URL,
+ ensure: 'present',
+ username: 'TheUser',
+ password: 'ThePassword',
+ checksum: '123abc',
+ checksum_type: 'sha512'
+ }
+ ]
+ )
+ end
+
+ it { is_expected.to compile.with_all_deps }
+
+ it do
+ is_expected.to contain_archive("#{PATH_INSTALLATION_BASE}/atlassian-jira/WEB-INF/lib/fine-jira-plugin.jar").
+ with({
+ source: PLUGIN_SOURCE_URL,
+ ensure: 'present',
+ username: 'TheUser',
+ password: 'ThePassword',
+ checksum: '123abc',
+ checksum_type: 'sha512'
+ })
+ end
+
+ context 'ensure absent marked plugin isn\'t downloaded' do
+ let(:params) do
+ super().merge(
+ plugins: [
+ {
+ 'installation_name' => 'fine-jira-plugin.jar',
+ 'ensure' => 'absent'
+ }
+ ]
+ )
+ end
+
+ it do
+ is_expected.to contain_archive("#{PATH_INSTALLATION_BASE}/atlassian-jira/WEB-INF/lib/fine-jira-plugin.jar").
+ with({ 'ensure' => 'absent' })
+ end
end
- it { is_expected.not_to contain_file('/home/jira/cluster.properties') }
- it { is_expected.not_to contain_file('/opt/jira/atlassian-jira-software-8.16.0-standalone/bin/check-java.sh') }
end
end
end
diff --git a/spec/classes/jira_install_spec.rb b/spec/classes/jira_install_spec.rb
index ab257db3..2438bddd 100644
--- a/spec/classes/jira_install_spec.rb
+++ b/spec/classes/jira_install_spec.rb
@@ -1,7 +1,19 @@
require 'spec_helper.rb'
+# set some constants to keep it DRY
+DOWNLOAD_URL = 'https://product-downloads.atlassian.com/software/jira/downloads'.freeze
+
describe 'jira' do
describe 'jira::install' do
+ let(:params) do
+ {
+ javahome: PATH_JAVA_HOME,
+ installdir: PATH_JIRA_DIR,
+ version: DEFAULT_VERSION,
+ product: 'jira'
+ }
+ end
+
context 'supported operating systems' do
on_supported_os.each do |os, facts|
context "on #{os}" do
@@ -11,26 +23,22 @@
context 'default params' do
let(:params) do
- {
- javahome: '/opt/java',
+ super().merge(
user: 'jira',
group: 'jira',
- installdir: '/opt/jira',
homedir: '/home/jira',
- product: 'jira',
- version: '8.13.5',
- download_url: 'https://product-downloads.atlassian.com/software/jira/downloads'
- }
+ download_url: DOWNLOAD_URL
+ )
end
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_group('jira') }
it { is_expected.to contain_user('jira').with_shell('/bin/true') }
- it 'deploys jira 8.13.5 from tar.gz' do
- is_expected.to contain_archive('/tmp/atlassian-jira-software-8.13.5.tar.gz').
- with('extract_path' => '/opt/jira/atlassian-jira-software-8.13.5-standalone',
- 'source' => 'https://product-downloads.atlassian.com/software/jira/downloads/atlassian-jira-software-8.13.5.tar.gz',
- 'creates' => '/opt/jira/atlassian-jira-software-8.13.5-standalone/conf',
+ it "deploys jira #{DEFAULT_VERSION} from tar.gz" do
+ is_expected.to contain_archive("/tmp/#{PRODUCT_VERSION_STRING}.tar.gz").
+ with('extract_path' => "/opt/jira/#{PRODUCT_VERSION_STRING}-standalone",
+ 'source' => "#{DOWNLOAD_URL}/#{PRODUCT_VERSION_STRING}.tar.gz",
+ 'creates' => "/opt/jira/#{PRODUCT_VERSION_STRING}-standalone/conf",
'user' => 'jira',
'group' => 'jira',
'checksum_type' => 'md5')
@@ -38,49 +46,43 @@
it 'manages the jira home directory' do
is_expected.to contain_file('/home/jira').with('ensure' => 'directory',
- 'owner' => 'jira',
- 'group' => 'jira')
+ 'owner' => 'jira',
+ 'group' => 'jira')
end
end
- context 'jira version 8.16.0' do
+ context "jira version #{DEFAULT_VERSION}" do
context 'default product' do
let(:params) do
- {
- javahome: '/opt/java',
- installdir: '/opt/jira',
- product: 'jira',
- version: '8.16.0',
- download_url: 'http://www.atlassian.com/software/jira/downloads/binary'
- }
+ super().merge(
+ download_url: DOWNLOAD_URL
+ )
end
- it 'deploys jira 8.16.0 from tar.gz' do
- is_expected.to contain_archive('/tmp/atlassian-jira-software-8.16.0.tar.gz').
- with('extract_path' => '/opt/jira/atlassian-jira-software-8.16.0-standalone',
- 'source' => 'http://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-software-8.16.0.tar.gz',
- 'creates' => '/opt/jira/atlassian-jira-software-8.16.0-standalone/conf',
+ it "deploys jira #{DEFAULT_VERSION} from tar.gz" do
+ is_expected.to contain_archive("/tmp/#{PRODUCT_VERSION_STRING}.tar.gz").
+ with('extract_path' => "/opt/jira/#{PRODUCT_VERSION_STRING}-standalone",
+ 'source' => "#{DOWNLOAD_URL}/#{PRODUCT_VERSION_STRING}.tar.gz",
+ 'creates' => "/opt/jira/#{PRODUCT_VERSION_STRING}-standalone/conf",
'user' => 'jira',
'group' => 'jira',
'checksum_type' => 'md5')
end
end
+
context 'core product' do
let(:params) do
- {
- javahome: '/opt/java',
- installdir: '/opt/jira',
+ super().merge(
product: 'jira-core',
- version: '8.1.0',
- download_url: 'http://www.atlassian.com/software/jira/downloads/binary'
- }
+ download_url: DOWNLOAD_URL
+ )
end
- it 'deploys jira 8.1.0 from tar.gz' do
- is_expected.to contain_archive('/tmp/atlassian-jira-core-8.1.0.tar.gz').
- with('extract_path' => '/opt/jira/atlassian-jira-core-8.1.0-standalone',
- 'source' => 'http://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-core-8.1.0.tar.gz',
- 'creates' => '/opt/jira/atlassian-jira-core-8.1.0-standalone/conf',
+ it "deploys jira #{DEFAULT_VERSION} from tar.gz" do
+ is_expected.to contain_archive("/tmp/#{PRODUCT_VERSION_STRING_CORE}.tar.gz").
+ with('extract_path' => "/opt/jira/#{PRODUCT_VERSION_STRING_CORE}-standalone",
+ 'source' => "#{DOWNLOAD_URL}/#{PRODUCT_VERSION_STRING_CORE}.tar.gz",
+ 'creates' => "/opt/jira/#{PRODUCT_VERSION_STRING_CORE}-standalone/conf",
'user' => 'jira',
'group' => 'jira',
'checksum_type' => 'md5')
@@ -90,11 +92,9 @@
context 'manage_users => false' do
let(:params) do
- {
- javahome: '/opt/java',
- installdir: '/opt/jira',
+ super().merge(
manage_user: false
- }
+ )
end
let(:pre_condition) do
<<-PRE
@@ -111,18 +111,15 @@
context 'overwriting params' do
let(:params) do
- {
- javahome: '/opt/java',
- version: '8.5.0',
- installdir: '/opt/jira',
+ super().merge(
homedir: '/random/homedir',
user: 'foo',
group: 'bar',
uid: 333,
gid: 444,
shell: '/bin/bash',
- download_url: 'https://www.atlassian.com/software/jira/downloads/binary'
- }
+ download_url: DOWNLOAD_URL
+ )
end
it do
@@ -133,11 +130,11 @@
end
it { is_expected.to contain_group('bar') }
- it 'deploys jira 8.5.0 from tar.gz' do
- is_expected.to contain_archive('/tmp/atlassian-jira-software-8.5.0.tar.gz').
- with('extract_path' => '/opt/jira/atlassian-jira-software-8.5.0-standalone',
- 'source' => 'https://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-software-8.5.0.tar.gz',
- 'creates' => '/opt/jira/atlassian-jira-software-8.5.0-standalone/conf',
+ it "deploys jira #{DEFAULT_VERSION} from tar.gz" do
+ is_expected.to contain_archive("/tmp/#{PRODUCT_VERSION_STRING}.tar.gz").
+ with('extract_path' => "/opt/jira/#{PRODUCT_VERSION_STRING}-standalone",
+ 'source' => "#{DOWNLOAD_URL}/#{PRODUCT_VERSION_STRING}.tar.gz",
+ 'creates' => "/opt/jira/#{PRODUCT_VERSION_STRING}-standalone/conf",
'user' => 'foo',
'group' => 'bar',
'checksum_type' => 'md5')
diff --git a/spec/classes/jira_mysql_connector_spec.rb b/spec/classes/jira_mysql_connector_spec.rb
index ff723854..048439cb 100644
--- a/spec/classes/jira_mysql_connector_spec.rb
+++ b/spec/classes/jira_mysql_connector_spec.rb
@@ -1,7 +1,19 @@
require 'spec_helper.rb'
+# set some constants to keep it DRY
+PATH_MYSQL_CONNECTOR = '/opt/MySQL-connector'.freeze
+PATH_MYSQL_CONNECTOR_LIB = "#{PATH_INSTALLATION_BASE}/lib/mysql-connector-java.jar".freeze
+
describe 'jira' do
describe 'jira::mysql_connector' do
+ let(:params) do
+ {
+ javahome: PATH_JAVA_HOME,
+ version: DEFAULT_VERSION,
+ db: 'mysql'
+ }
+ end
+
context 'supported operating systems' do
on_supported_os.each do |os, facts|
context "on #{os}" do
@@ -11,89 +23,80 @@
context 'mysql connector defaults' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
- db: 'mysql',
+ super().merge(
mysql_connector_version: '5.1.34'
- }
+ )
end
it { is_expected.to compile.with_all_deps }
- it { is_expected.to contain_file('/opt/MySQL-connector').with_ensure('directory') }
+ it { is_expected.to contain_file(PATH_MYSQL_CONNECTOR).with_ensure('directory') }
it do
- is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/lib/mysql-connector-java.jar').
+ is_expected.to contain_file(PATH_MYSQL_CONNECTOR_LIB).
with(
'ensure' => 'link',
- 'target' => '/opt/MySQL-connector/mysql-connector-java-5.1.34/mysql-connector-java-5.1.34-bin.jar'
+ 'target' => "#{PATH_MYSQL_CONNECTOR}/mysql-connector-java-5.1.34/mysql-connector-java-5.1.34-bin.jar"
)
end
it 'deploys mysql connector 5.1.34 from tar.gz' do
- is_expected.to contain_archive('/opt/MySQL-connector/mysql-connector-java-5.1.34.tar.gz').with('source' => 'https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.34.tar.gz',
- 'extract_path' => '/opt/MySQL-connector',
- 'creates' => '/opt/MySQL-connector/mysql-connector-java-5.1.34')
+ is_expected.to contain_archive("#{PATH_MYSQL_CONNECTOR}/mysql-connector-java-5.1.34.tar.gz").
+ with('source' => 'https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.34.tar.gz',
+ 'extract_path' => PATH_MYSQL_CONNECTOR,
+ 'creates' => "#{PATH_MYSQL_CONNECTOR}/mysql-connector-java-5.1.34")
end
end
context 'mysql connector defaults Connector Version >8' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
- db: 'mysql',
+ super().merge(
mysql_connector_version: '8.0.23'
- }
+ )
end
it { is_expected.to compile.with_all_deps }
- it { is_expected.to contain_file('/opt/MySQL-connector').with_ensure('directory') }
+ it { is_expected.to contain_file(PATH_MYSQL_CONNECTOR).with_ensure('directory') }
it do
- is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/lib/mysql-connector-java.jar').
+ is_expected.to contain_file(PATH_MYSQL_CONNECTOR_LIB).
with(
'ensure' => 'link',
- 'target' => '/opt/MySQL-connector/mysql-connector-java-8.0.23/mysql-connector-java-8.0.23.jar'
+ 'target' => "#{PATH_MYSQL_CONNECTOR}/mysql-connector-java-8.0.23/mysql-connector-java-8.0.23.jar"
)
end
it 'deploys mysql connector 8.0.23 from tar.gz' do
- is_expected.to contain_archive('/opt/MySQL-connector/mysql-connector-java-8.0.23.tar.gz').with('source' => 'https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-8.0.23.tar.gz',
- 'extract_path' => '/opt/MySQL-connector',
- 'creates' => '/opt/MySQL-connector/mysql-connector-java-8.0.23')
+ is_expected.to contain_archive('/opt/MySQL-connector/mysql-connector-java-8.0.23.tar.gz').
+ with('source' => 'https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-8.0.23.tar.gz',
+ 'extract_path' => PATH_MYSQL_CONNECTOR,
+ 'creates' => "#{PATH_MYSQL_CONNECTOR}/mysql-connector-java-8.0.23")
end
end
context 'mysql connector overwrite params' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
- db: 'mysql',
+ super().merge(
mysql_connector_version: '5.1.15',
mysql_connector_format: 'zip',
mysql_connector_install: '/opt/foo',
mysql_connector_url: 'http://example.co.za/foo'
- }
+ )
end
it { is_expected.to contain_file('/opt/foo').with_ensure('directory') }
it do
- is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/lib/mysql-connector-java.jar').
+ is_expected.to contain_file(PATH_MYSQL_CONNECTOR_LIB).
with(
'ensure' => 'link',
'target' => '/opt/foo/mysql-connector-java-5.1.15/mysql-connector-java-5.1.15-bin.jar'
)
end
it 'deploys mysql connector 5.1.15 from zip' do
- is_expected.to contain_archive('/opt/foo/mysql-connector-java-5.1.15.zip').with('source' => 'http://example.co.za/foo/mysql-connector-java-5.1.15.zip',
- 'extract_path' => '/opt/foo',
- 'creates' => '/opt/foo/mysql-connector-java-5.1.15')
+ is_expected.to contain_archive('/opt/foo/mysql-connector-java-5.1.15.zip').
+ with('source' => 'http://example.co.za/foo/mysql-connector-java-5.1.15.zip',
+ 'extract_path' => '/opt/foo',
+ 'creates' => '/opt/foo/mysql-connector-java-5.1.15')
end
end
context 'mysql_connector_mangage equals false' do
let(:params) do
- {
- version: '8.13.5',
- javahome: '/opt/java',
- db: 'mysql',
+ super().merge(
mysql_connector_manage: false
- }
+ )
end
it { is_expected.not_to contain_class('jira::mysql_connector') }
diff --git a/spec/classes/jira_sso_spec.rb b/spec/classes/jira_sso_spec.rb
index 16c2fc12..8c6c1b8e 100644
--- a/spec/classes/jira_sso_spec.rb
+++ b/spec/classes/jira_sso_spec.rb
@@ -1,7 +1,18 @@
require 'spec_helper.rb'
+# set some constants to keep it DRY
+PATH_CROWD_PROPS = "#{PATH_INSTALLATION_BASE}/atlassian-jira/WEB-INF/classes/crowd.properties".freeze
+
describe 'jira' do
describe 'jira::sso' do
+ let(:params) do
+ {
+ javahome: '/opt/java',
+ version: '8.13.5',
+ enable_sso: true
+ }
+ end
+
context 'supported operating systems' do
on_supported_os.each do |os, facts|
context "on #{os}" do
@@ -10,50 +21,37 @@
end
context 'default params' do
- let(:params) do
- {
- javahome: '/opt/java',
- version: '8.13.5',
- enable_sso: true
- }
- end
-
it { is_expected.to compile.with_all_deps }
- it { is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/atlassian-jira/WEB-INF/classes/seraph-config.xml') }
- it { is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/atlassian-jira/WEB-INF/classes/crowd.properties') }
+ it { is_expected.to contain_file("#{PATH_INSTALLATION_BASE}/atlassian-jira/WEB-INF/classes/seraph-config.xml") }
+ it { is_expected.to contain_file(PATH_CROWD_PROPS) }
end
+
context 'with param application_name set to appname' do
let(:params) do
- {
- javahome: '/opt/java',
- version: '8.13.5',
- enable_sso: true,
+ super().merge(
application_name: 'appname'
- }
+ )
end
it do
- is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/atlassian-jira/WEB-INF/classes/crowd.properties').
+ is_expected.to contain_file(PATH_CROWD_PROPS).
with_content(%r{application.name appname})
end
end
context 'with non default params' do
let(:params) do
- {
- javahome: '/opt/java',
- version: '8.13.5',
- enable_sso: true,
+ super().merge(
application_name: 'app',
application_password: 'password',
application_login_url: 'https://login.url/',
crowd_server_url: 'https://crowd.url/',
crowd_base_url: 'http://crowdbase.url'
- }
+ )
end
- it { is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/atlassian-jira/WEB-INF/classes/seraph-config.xml') }
+ it { is_expected.to contain_file(PATH_CROWD_PROPS) }
it do
- is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/atlassian-jira/WEB-INF/classes/crowd.properties').
+ is_expected.to contain_file(PATH_CROWD_PROPS).
with_content(%r{application.name app}).
with_content(%r{application.password password}).
with_content(%r{application.login.url https://login.url/}).
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index fb5f0cbe..57a70076 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -15,3 +15,5 @@
end
end
end
+
+require 'support/acceptance/constants.rb'
diff --git a/spec/support/acceptance/constants.rb b/spec/support/acceptance/constants.rb
new file mode 100644
index 00000000..aeb8f814
--- /dev/null
+++ b/spec/support/acceptance/constants.rb
@@ -0,0 +1,16 @@
+# set some constants to keep it DRY
+DEFAULT_VERSION = '8.13.5'.freeze
+PRODUCT_VERSION_STRING = "atlassian-jira-software-#{DEFAULT_VERSION}".freeze
+PRODUCT_VERSION_STRING_CORE = "atlassian-jira-core-#{DEFAULT_VERSION}".freeze
+
+PATH_JAVA_HOME = '/opt/java'.freeze
+PATH_JIRA_DIR = '/opt/jira'.freeze
+PATH_INSTALLATION_BASE = "#{PATH_JIRA_DIR}/#{PRODUCT_VERSION_STRING}-standalone".freeze
+
+FILENAME_SETENV_SH = "#{PATH_INSTALLATION_BASE}/bin/setenv.sh".freeze
+FILENAME_USER_SH = "#{PATH_INSTALLATION_BASE}/bin/user.sh".freeze
+FILENAME_CHECK_JAVA_SH = "#{PATH_INSTALLATION_BASE}/bin/check-java.sh".freeze
+FILENAME_SERVER_XML = "#{PATH_INSTALLATION_BASE}/conf/server.xml".freeze
+FILENAME_DBCONFIG_XML = '/home/jira/dbconfig.xml'.freeze
+FILENAME_CLUSTER_PROPS = '/home/jira/cluster.properties'.freeze
+FILENAME_JIRA_CONFIG_PROPS = '/home/jira/jira-config.properties'.freeze
diff --git a/spec/type_aliases/jvm_types_spec.rb b/spec/type_aliases/jvm_types_spec.rb
index 4fd963ca..b10fbf79 100644
--- a/spec/type_aliases/jvm_types_spec.rb
+++ b/spec/type_aliases/jvm_types_spec.rb
@@ -2,8 +2,7 @@
describe 'Jira::Jvm_types' do
describe 'valid attributes' do
- ['openjdk-11',
- 'oracle-jdk-1.8'].each do |value|
+ %w[openjdk-11 oracle-jdk-1.8].each do |value|
describe value.inspect do
it { is_expected.to allow_value(value) }
end
@@ -12,10 +11,7 @@
describe 'invalid attributes' do
context 'with garbage inputs' do
- [
- 'openheydk-11',
- 'uracle-jdk-1.8'
- ].each do |value|
+ %w[openheydk-11 uracle-jdk-1.8].each do |value|
describe value.inspect do
it { is_expected.not_to allow_value(value) }
end
diff --git a/templates/dbconfig.jndi.xml.epp b/templates/dbconfig.jndi.xml.epp
new file mode 100644
index 00000000..632a9d1c
--- /dev/null
+++ b/templates/dbconfig.jndi.xml.epp
@@ -0,0 +1,14 @@
+
+
+<%# Some defaults are set in jira::config based on DB -%>
+
+ defaultDS
+ default
+ <%= $jira::config::dbtype %>
+<% if $jira::config::dbschema != undef { -%>
+ <%= $jira::config::dbschema %>
+<% } -%>
+
+ java:comp/env/jdbc/<%= $jira::jndi_ds_name %>
+
+
diff --git a/templates/dbconfig.xml.epp b/templates/dbconfig.xml.epp
index aee6a9c5..64183dde 100644
--- a/templates/dbconfig.xml.epp
+++ b/templates/dbconfig.xml.epp
@@ -1,6 +1,6 @@
-
-<%# Some default are set in jira::config based on DB -%>
+
+<%# Some defaults are set in jira::config based on DB -%>
defaultDS
default
diff --git a/templates/server.xml.epp b/templates/server.xml.epp
index 9a4a25cb..e096652a 100644
--- a/templates/server.xml.epp
+++ b/templates/server.xml.epp
@@ -48,7 +48,7 @@
<% if $jira::tomcat_native_ssl and $jira::tomcat_redirect_https_port { -%>
redirectPort="<%= $jira::tomcat_redirect_https_port %>"
<% } else { -%>
- redirectPort="<%= $jira::tomcat_https_port%>"
+ redirectPort="<%= $jira::tomcat_https_port %>"
<% } -%>
<% if $jira::proxy { -%>
<% jira::sort_hash($jira::proxy).each |$key, $value| { -%>
@@ -115,11 +115,22 @@
+<% if $jira::use_jndi_ds { %>
+
+
+<% } -%>
-