Skip to content

Commit

Permalink
fix acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
h-haaks committed Feb 5, 2024
1 parent 42ec42c commit d4b1086
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 31 deletions.
40 changes: 26 additions & 14 deletions spec/acceptance/default_parameters_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,27 @@
'Debian' => '/usr/lib/jvm/java-1.11.0-openjdk-amd64',
}
class { 'postgresql::server': }
# The output of `systemctl status postgresql` is non ascii which
# breaks the Exec in Postgresql::Server::Instance::Reload
# on rhel based docker containers
# We don't need the output.
class { 'postgresql::server':
service_status => 'systemctl status postgresql > /dev/null'
}
postgresql::server::db { 'jira':
user => 'jiraadm',
password => postgresql::postgresql_password('jiraadm', 'mypassword'),
}
# There is a bug in the check-java.sh that prevents jira from starting on Centos Stream 8
# https://jira.atlassian.com/browse/JRASERVER-77097
# Running with script_check_java_manage => true to solve this
class { 'jira':
java_package => $java_package,
javahome => $java_home,
require => Postgresql::Server::Db['jira'],
java_package => $java_package,
javahome => $java_home,
script_check_java_manage => true,
require => Postgresql::Server::Db['jira'],
}
EOS
pp_upgrade = <<-EOS
Expand All @@ -40,9 +50,10 @@ class { 'jira':
}
class { 'jira':
version => '8.16.0',
java_package => $java_package,
javahome => $java_home,
version => '8.16.0',
java_package => $java_package,
javahome => $java_home,
script_check_java_manage => true,
}
EOS

Expand All @@ -53,14 +64,16 @@ class { 'jira':
shell wget_cmd, acceptable_exit_codes: [0, 8]
sleep SLEEP_SECONDS
shell wget_cmd, acceptable_exit_codes: [0, 8]
sleep SLEEP_SECONDS

apply_manifest(pp, catch_changes: true)

apply_manifest(pp_upgrade, catch_failures: true)
sleep SLEEP_SECONDS
shell wget_cmd, acceptable_exit_codes: [0, 8]
sleep SLEEP_SECONDS
shell wget_cmd, acceptable_exit_codes: [0, 8]
sleep SLEEP_SECONDS
apply_manifest(pp_upgrade, catch_failures: true)

apply_manifest(pp_upgrade, catch_changes: true)
end

describe process('java') do
Expand All @@ -76,10 +89,9 @@ class { 'jira':
it { is_expected.to be_running }
end

specify do
expect(user('jira')).to exist.
and belong_to_group 'jira'.
and have_login_shell '/bin/true'
describe user('jira') do
it { is_expected.to belong_to_group 'jira' }
it { is_expected.to have_login_shell '/bin/true' }
end

describe command('wget -q --tries=24 --retry-connrefused --read-timeout=10 -O- localhost:8080') do
Expand Down
37 changes: 20 additions & 17 deletions spec/acceptance/mysql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,23 @@ class { 'java':
require => Exec['tmpkey'],
}
# There is a bug in the check-java.sh that prevents jira from starting on Centos Stream 8
# https://jira.atlassian.com/browse/JRASERVER-77097
# Running with script_check_java_manage => true to solve this
class { 'jira':
installdir => '/opt/atlassian-jira',
homedir => '/opt/jira-home',
javahome => '/usr',
jvm_type => 'oracle-jdk-1.8',
db => 'mysql',
dbport => 3306,
dbdriver => 'com.mysql.jdbc.Driver',
dbtype => 'mysql',
tomcat_port => 8081,
tomcat_native_ssl => true,
tomcat_keystore_file => '/tmp/jira.ks',
require => [Mysql::Db['jira'], Java_ks['jira']],
installdir => '/opt/atlassian-jira',
homedir => '/opt/jira-home',
javahome => '/usr',
jvm_type => 'oracle-jdk-1.8',
db => 'mysql',
dbport => 3306,
dbdriver => 'com.mysql.jdbc.Driver',
dbtype => 'mysql',
tomcat_port => 8081,
tomcat_native_ssl => true,
tomcat_keystore_file => '/tmp/jira.ks',
script_check_java_manage => true,
require => [Mysql::Db['jira'], Java_ks['jira']],
}
EOS

Expand All @@ -68,7 +72,7 @@ class { 'jira':
shell wget_cmd, acceptable_exit_codes: [0, 8]
sleep SLEEP_SECONDS
shell wget_cmd, acceptable_exit_codes: [0, 8]
sleep SLEEP_SECONDS

apply_manifest(pp, catch_changes: true)
end

Expand All @@ -85,10 +89,9 @@ class { 'jira':
it { is_expected.to be_running }
end

specify do
expect(user('jira')).to exist.
and belong_to_group 'jira'.
and have_login_shell '/bin/true'
describe user('jira') do
it { is_expected.to belong_to_group 'jira' }
it { is_expected.to have_login_shell '/bin/true' }
end

specify do
Expand Down

0 comments on commit d4b1086

Please sign in to comment.