Apply remaining rubocop fixes

This commit is contained in:
David Schmitt
2020-12-16 17:36:26 +00:00
parent d3c3598349
commit f9d03a10ac
4 changed files with 89 additions and 81 deletions

View File

@@ -189,94 +189,96 @@ install_sap_jdk_jre = <<EOL
}
EOL
context 'installing java jre', unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do
it 'installs jre' do
idempotent_apply(java_class_jre)
end
end
context 'installing java jdk', unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do
it 'installs jdk' do
idempotent_apply(java_class)
end
end
context 'with failure cases' do
it 'fails to install java with a blank version' do
apply_manifest(blank_version, expect_failures: true)
describe 'installing' do
context 'installing java jre' do
it 'installs jre' do
idempotent_apply(java_class_jre)
end
end
it 'fails to install java with an incorrect distribution' do
apply_manifest(incorrect_distro, expect_failures: true)
context 'installing java jdk' do
it 'installs jdk' do
idempotent_apply(java_class)
end
end
it 'fails to install java with a blank distribution' do
apply_manifest(blank_distro, expect_failures: true)
context 'with failure cases' do
it 'fails to install java with a blank version' do
apply_manifest(blank_version, expect_failures: true)
end
it 'fails to install java with an incorrect distribution' do
apply_manifest(incorrect_distro, expect_failures: true)
end
it 'fails to install java with a blank distribution' do
apply_manifest(blank_distro, expect_failures: true)
end
it 'fails to install java with an incorrect package' do
apply_manifest(incorrect_package, expect_failures: true)
end
it 'fails on debian or RHEL when passed fake java_alternative and path' do
if os[:family] == 'sles'
apply_manifest(bogus_alternative, catch_failures: true)
else
apply_manifest(bogus_alternative, expect_failures: true)
end
end
end
it 'fails to install java with an incorrect package' do
apply_manifest(incorrect_package, expect_failures: true)
context 'java::oracle', if: oracle_enabled, unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do
let(:install_path) do
(os[:family] == 'redhat') ? '/usr/java' : '/usr/lib/jvm'
end
let(:version_suffix) do
(os[:family] == 'redhat') ? '-amd64' : ''
end
it 'installs oracle jdk and jre' do
idempotent_apply(install_oracle_jdk_jre)
jdk_result = shell("test ! -e #{install_path}/jdk1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/jre/lib/security/local_policy.jar")
jre_result = shell("test ! -e #{install_path}/jre1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/lib/security/local_policy.jar")
expect(jdk_result.exit_code).to eq(0)
expect(jre_result.exit_code).to eq(0)
end
it 'installs oracle jdk with jce' do
idempotent_apply(install_oracle_jdk_jce)
result = shell("test -e #{install_path}/jdk1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/jre/lib/security/local_policy.jar")
expect(result.exit_code).to eq(0)
end
it 'installs oracle jre with jce' do
idempotent_apply(install_oracle_jre_jce)
result = shell("test -e #{install_path}/jre1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/lib/security/local_policy.jar")
expect(result.exit_code).to eq(0)
end
end
it 'fails on debian or RHEL when passed fake java_alternative and path' do
if os[:family] == 'sles'
apply_manifest(bogus_alternative, catch_failures: true)
else
apply_manifest(bogus_alternative, expect_failures: true)
context 'java::adopt', if: adopt_enabled, unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do
let(:install_path) do
(os[:family] == 'redhat') ? '/usr/java' : '/usr/lib/jvm'
end
let(:version_suffix) do
(os[:family] == 'redhat') ? '-amd64' : ''
end
it 'installs adopt jdk and jre' do
idempotent_apply(install_adopt_jdk_jre)
end
end
context 'java::adopt', if: sap_enabled && ['Sles'].include?(os[:family]), unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do
let(:install_path) do
(os[:family] == 'redhat') ? '/usr/java' : '/usr/lib/jvm'
end
it 'installs adopt jdk and jre' do
idempotent_apply(install_sap_jdk_jre)
end
end
end
context 'java::oracle', if: oracle_enabled, unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do
let(:install_path) do
(os[:family] == 'redhat') ? '/usr/java' : '/usr/lib/jvm'
end
let(:version_suffix) do
(os[:family] == 'redhat') ? '-amd64' : ''
end
it 'installs oracle jdk and jre' do
idempotent_apply(install_oracle_jdk_jre)
jdk_result = shell("test ! -e #{install_path}/jdk1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/jre/lib/security/local_policy.jar")
jre_result = shell("test ! -e #{install_path}/jre1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/lib/security/local_policy.jar")
expect(jdk_result.exit_code).to eq(0)
expect(jre_result.exit_code).to eq(0)
end
it 'installs oracle jdk with jce' do
idempotent_apply(install_oracle_jdk_jce)
result = shell("test -e #{install_path}/jdk1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/jre/lib/security/local_policy.jar")
expect(result.exit_code).to eq(0)
end
it 'installs oracle jre with jce' do
idempotent_apply(install_oracle_jre_jce)
result = shell("test -e #{install_path}/jre1.#{oracle_version_major}.0_#{oracle_version_minor}#{version_suffix}/lib/security/local_policy.jar")
expect(result.exit_code).to eq(0)
end
end
context 'java::adopt', if: adopt_enabled, unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do
let(:install_path) do
(os[:family] == 'redhat') ? '/usr/java' : '/usr/lib/jvm'
end
let(:version_suffix) do
(os[:family] == 'redhat') ? '-amd64' : ''
end
it 'installs adopt jdk and jre' do
idempotent_apply(install_adopt_jdk_jre)
end
end
context 'java::adopt', if: sap_enabled && ['Sles'].include?(os[:family]), unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do
let(:install_path) do
(os[:family] == 'redhat') ? '/usr/java' : '/usr/lib/jvm'
end
it 'installs adopt jdk and jre' do
idempotent_apply(install_sap_jdk_jre)
end
end