Apply remaining rubocop fixes
This commit is contained in:
@@ -89,6 +89,8 @@ Performance/CaseWhenSplat:
|
|||||||
Performance/Casecmp:
|
Performance/Casecmp:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Performance/CollectionLiteralInLoop:
|
Performance/CollectionLiteralInLoop:
|
||||||
|
Exclude:
|
||||||
|
- spec/**/*
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Performance/CompareWithBlock:
|
Performance/CompareWithBlock:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
@@ -294,6 +296,8 @@ Metrics/AbcSize:
|
|||||||
Enabled: false
|
Enabled: false
|
||||||
Metrics/BlockLength:
|
Metrics/BlockLength:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
Metrics/BlockNesting:
|
||||||
|
Enabled: false
|
||||||
Metrics/ClassLength:
|
Metrics/ClassLength:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
Metrics/CyclomaticComplexity:
|
Metrics/CyclomaticComplexity:
|
||||||
@@ -308,6 +312,8 @@ Metrics/PerceivedComplexity:
|
|||||||
Enabled: false
|
Enabled: false
|
||||||
Migration/DepartmentName:
|
Migration/DepartmentName:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
Naming/AccessorMethodName:
|
||||||
|
Enabled: false
|
||||||
Naming/BlockParameterName:
|
Naming/BlockParameterName:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
Naming/HeredocDelimiterCase:
|
Naming/HeredocDelimiterCase:
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ Facter.add(:java_version) do
|
|||||||
confine operatingsystem: 'Darwin'
|
confine operatingsystem: 'Darwin'
|
||||||
has_weight 100
|
has_weight 100
|
||||||
setcode do
|
setcode do
|
||||||
unless %r{Unable to find any JVMs matching version} =~ Facter::Util::Resolution.exec('/usr/libexec/java_home --failfast 2>&1')
|
unless Facter::Util::Resolution.exec('/usr/libexec/java_home --failfast 2>&1').include?('Unable to find any JVMs matching version')
|
||||||
version = nil
|
version = nil
|
||||||
Facter::Util::Resolution.exec('java -Xmx12m -version 2>&1').lines.each { |line| version = Regexp.last_match(1) if %r{^.+ version \"(.+)\"} =~ line }
|
Facter::Util::Resolution.exec('java -Xmx12m -version 2>&1').lines.each { |line| version = Regexp.last_match(1) if %r{^.+ version \"(.+)\"} =~ line }
|
||||||
version
|
version
|
||||||
|
|||||||
@@ -189,94 +189,96 @@ install_sap_jdk_jre = <<EOL
|
|||||||
}
|
}
|
||||||
EOL
|
EOL
|
||||||
|
|
||||||
context 'installing java jre', unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do
|
describe 'installing' do
|
||||||
it 'installs jre' do
|
context 'installing java jre' do
|
||||||
idempotent_apply(java_class_jre)
|
it 'installs jre' do
|
||||||
end
|
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)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'fails to install java with an incorrect distribution' do
|
context 'installing java jdk' do
|
||||||
apply_manifest(incorrect_distro, expect_failures: true)
|
it 'installs jdk' do
|
||||||
|
idempotent_apply(java_class)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'fails to install java with a blank distribution' do
|
context 'with failure cases' do
|
||||||
apply_manifest(blank_distro, expect_failures: true)
|
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
|
end
|
||||||
|
|
||||||
it 'fails to install java with an incorrect package' do
|
context 'java::oracle', if: oracle_enabled, unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do
|
||||||
apply_manifest(incorrect_package, expect_failures: true)
|
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
|
end
|
||||||
|
|
||||||
it 'fails on debian or RHEL when passed fake java_alternative and path' do
|
context 'java::adopt', if: adopt_enabled, unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do
|
||||||
if os[:family] == 'sles'
|
let(:install_path) do
|
||||||
apply_manifest(bogus_alternative, catch_failures: true)
|
(os[:family] == 'redhat') ? '/usr/java' : '/usr/lib/jvm'
|
||||||
else
|
end
|
||||||
apply_manifest(bogus_alternative, expect_failures: true)
|
|
||||||
|
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
|
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
|
|
||||||
|
|||||||
Reference in New Issue
Block a user