diff --git a/.rubocop.yml b/.rubocop.yml index 33c33fa..07b68b8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,534 +1,540 @@ --- require: - rubocop-performance - rubocop-rspec AllCops: DisplayCopNames: true TargetRubyVersion: '2.4' Include: - "**/*.rb" Exclude: - bin/* - ".vendor/**/*" - "**/Gemfile" - "**/Rakefile" - pkg/**/* - spec/fixtures/**/* - vendor/**/* - "**/Puppetfile" - "**/Vagrantfile" - "**/Guardfile" Layout/LineLength: Description: People have wide screens, use them. Max: 200 RSpec/BeforeAfterAll: Description: Beware of using after(:all) as it may cause state to leak between tests. A necessary evil in acceptance testing. Exclude: - spec/acceptance/**/*.rb RSpec/HookArgument: Description: Prefer explicit :each argument, matching existing module's style EnforcedStyle: each Style/BlockDelimiters: Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to be consistent then. EnforcedStyle: braces_for_chaining Style/ClassAndModuleChildren: Description: Compact style reduces the required amount of indentation. EnforcedStyle: compact Style/EmptyElse: Description: Enforce against empty else clauses, but allow `nil` for clarity. EnforcedStyle: empty Style/FormatString: Description: Following the main puppet project's style, prefer the % format format. EnforcedStyle: percent Style/FormatStringToken: Description: Following the main puppet project's style, prefer the simpler template tokens over annotated ones. EnforcedStyle: template Style/Lambda: Description: Prefer the keyword for easier discoverability. EnforcedStyle: literal Style/RegexpLiteral: Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168 EnforcedStyle: percent_r Style/TernaryParentheses: Description: Checks for use of parentheses around ternary conditions. Enforce parentheses on complex expressions for better readability, but seriously consider breaking it up. EnforcedStyle: require_parentheses_when_complex Style/TrailingCommaInArguments: Description: Prefer always trailing comma on multiline argument lists. This makes diffs, and re-ordering nicer. EnforcedStyleForMultiline: comma Style/TrailingCommaInArrayLiteral: Description: Prefer always trailing comma on multiline literals. This makes diffs, and re-ordering nicer. EnforcedStyleForMultiline: comma Style/SymbolArray: Description: Using percent style obscures symbolic intent of array's contents. EnforcedStyle: brackets RSpec/MessageSpies: EnforcedStyle: receive Style/Documentation: Exclude: - lib/puppet/parser/functions/**/* - spec/**/* Style/WordArray: EnforcedStyle: brackets Performance/AncestorsInclude: Enabled: true Performance/BigDecimalWithNumericArgument: Enabled: true Performance/BlockGivenWithExplicitBlock: Enabled: true Performance/Caller: Enabled: true Performance/CaseWhenSplat: Enabled: true Performance/Casecmp: Enabled: true Performance/CollectionLiteralInLoop: + Exclude: + - spec/**/* Enabled: true Performance/CompareWithBlock: Enabled: true Performance/ConstantRegexp: Enabled: true Performance/Count: Enabled: true Performance/Detect: Enabled: true Performance/DoubleStartEndWith: Enabled: true Performance/EndWith: Enabled: true Performance/FixedSize: Enabled: true Performance/FlatMap: Enabled: true Performance/MethodObjectAsBlock: Enabled: true Performance/RangeInclude: Enabled: true Performance/RedundantBlockCall: Enabled: true Performance/RedundantMatch: Enabled: true Performance/RedundantMerge: Enabled: true Performance/RedundantSortBlock: Enabled: true Performance/RedundantStringChars: Enabled: true Performance/RegexpMatch: Enabled: true Performance/ReverseEach: Enabled: true Performance/ReverseFirst: Enabled: true Performance/Size: Enabled: true Performance/SortReverse: Enabled: true Performance/Squeeze: Enabled: true Performance/StartWith: Enabled: true Performance/StringInclude: Enabled: true Performance/StringReplacement: Enabled: true Performance/Sum: Enabled: true Performance/TimesMap: Enabled: true Style/CollectionMethods: Enabled: true Style/MethodCalledOnDoEndBlock: Enabled: true Style/StringMethods: Enabled: true Bundler/InsecureProtocolSource: Enabled: false Gemspec/DuplicatedAssignment: Enabled: false Gemspec/OrderedDependencies: Enabled: false Gemspec/RequiredRubyVersion: Enabled: false Gemspec/RubyVersionGlobalsUsage: Enabled: false Layout/ArgumentAlignment: Enabled: false Layout/BeginEndAlignment: Enabled: false Layout/ClosingHeredocIndentation: Enabled: false Layout/EmptyComment: Enabled: false Layout/EmptyLineAfterGuardClause: Enabled: false Layout/EmptyLinesAroundArguments: Enabled: false Layout/EmptyLinesAroundAttributeAccessor: Enabled: false Layout/EndOfLine: Enabled: false Layout/FirstArgumentIndentation: Enabled: false Layout/HashAlignment: Enabled: false Layout/HeredocIndentation: Enabled: false Layout/LeadingEmptyLines: Enabled: false Layout/SpaceAroundMethodCallOperator: Enabled: false Layout/SpaceInsideArrayLiteralBrackets: Enabled: false Layout/SpaceInsideReferenceBrackets: Enabled: false Lint/BigDecimalNew: Enabled: false Lint/BooleanSymbol: Enabled: false Lint/ConstantDefinitionInBlock: Enabled: false Lint/DeprecatedOpenSSLConstant: Enabled: false Lint/DisjunctiveAssignmentInConstructor: Enabled: false Lint/DuplicateBranch: Enabled: false Lint/DuplicateElsifCondition: Enabled: false Lint/DuplicateRegexpCharacterClassElement: Enabled: false Lint/DuplicateRequire: Enabled: false Lint/DuplicateRescueException: Enabled: false Lint/EmptyBlock: Enabled: false Lint/EmptyClass: Enabled: false Lint/EmptyConditionalBody: Enabled: false Lint/EmptyFile: Enabled: false Lint/ErbNewArguments: Enabled: false Lint/FloatComparison: Enabled: false Lint/HashCompareByIdentity: Enabled: false Lint/IdentityComparison: Enabled: false Lint/InterpolationCheck: Enabled: false Lint/MissingCopEnableDirective: Enabled: false Lint/MixedRegexpCaptureTypes: Enabled: false Lint/NestedPercentLiteral: Enabled: false Lint/NoReturnInBeginEndBlocks: Enabled: false Lint/NonDeterministicRequireOrder: Enabled: false Lint/OrderedMagicComments: Enabled: false Lint/OutOfRangeRegexpRef: Enabled: false Lint/RaiseException: Enabled: false Lint/RedundantCopEnableDirective: Enabled: false Lint/RedundantRequireStatement: Enabled: false Lint/RedundantSafeNavigation: Enabled: false Lint/RedundantWithIndex: Enabled: false Lint/RedundantWithObject: Enabled: false Lint/RegexpAsCondition: Enabled: false Lint/ReturnInVoidContext: Enabled: false Lint/SafeNavigationConsistency: Enabled: false Lint/SafeNavigationWithEmpty: Enabled: false Lint/SelfAssignment: Enabled: false Lint/SendWithMixinArgument: Enabled: false Lint/ShadowedArgument: Enabled: false Lint/StructNewOverride: Enabled: false Lint/ToEnumArguments: Enabled: false Lint/ToJSON: Enabled: false Lint/TopLevelReturnWithArgument: Enabled: false Lint/TrailingCommaInAttributeDeclaration: Enabled: false Lint/UnexpectedBlockArity: Enabled: false Lint/UnmodifiedReduceAccumulator: Enabled: false Lint/UnreachableLoop: Enabled: false Lint/UriEscapeUnescape: Enabled: false Lint/UriRegexp: Enabled: false Lint/UselessMethodDefinition: Enabled: false Lint/UselessTimes: Enabled: false Metrics/AbcSize: Enabled: false Metrics/BlockLength: Enabled: false +Metrics/BlockNesting: + Enabled: false Metrics/ClassLength: Enabled: false Metrics/CyclomaticComplexity: Enabled: false Metrics/MethodLength: Enabled: false Metrics/ModuleLength: Enabled: false Metrics/ParameterLists: Enabled: false Metrics/PerceivedComplexity: Enabled: false Migration/DepartmentName: Enabled: false +Naming/AccessorMethodName: + Enabled: false Naming/BlockParameterName: Enabled: false Naming/HeredocDelimiterCase: Enabled: false Naming/HeredocDelimiterNaming: Enabled: false Naming/MemoizedInstanceVariableName: Enabled: false Naming/MethodParameterName: Enabled: false Naming/RescuedExceptionsVariableName: Enabled: false RSpec/Be: Enabled: false RSpec/Capybara/CurrentPathExpectation: Enabled: false RSpec/Capybara/FeatureMethods: Enabled: false RSpec/Capybara/VisibilityMatcher: Enabled: false RSpec/ContextMethod: Enabled: false RSpec/ContextWording: Enabled: false RSpec/DescribeClass: Enabled: false RSpec/EmptyHook: Enabled: false RSpec/EmptyLineAfterExample: Enabled: false RSpec/EmptyLineAfterExampleGroup: Enabled: false RSpec/EmptyLineAfterHook: Enabled: false RSpec/ExampleLength: Enabled: false RSpec/ExampleWithoutDescription: Enabled: false RSpec/ExpectChange: Enabled: false RSpec/ExpectInHook: Enabled: false RSpec/FactoryBot/AttributeDefinedStatically: Enabled: false RSpec/FactoryBot/CreateList: Enabled: false RSpec/FactoryBot/FactoryClassName: Enabled: false RSpec/HooksBeforeExamples: Enabled: false RSpec/ImplicitBlockExpectation: Enabled: false RSpec/ImplicitSubject: Enabled: false RSpec/LeakyConstantDeclaration: Enabled: false RSpec/LetBeforeExamples: Enabled: false RSpec/MissingExampleGroupArgument: Enabled: false RSpec/MultipleExpectations: Enabled: false RSpec/MultipleMemoizedHelpers: Enabled: false RSpec/MultipleSubjects: Enabled: false RSpec/NestedGroups: Enabled: false RSpec/PredicateMatcher: Enabled: false RSpec/ReceiveCounts: Enabled: false RSpec/ReceiveNever: Enabled: false RSpec/RepeatedExampleGroupBody: Enabled: false RSpec/RepeatedExampleGroupDescription: Enabled: false RSpec/RepeatedIncludeExample: Enabled: false RSpec/ReturnFromStub: Enabled: false RSpec/SharedExamples: Enabled: false RSpec/StubbedMock: Enabled: false RSpec/UnspecifiedException: Enabled: false RSpec/VariableDefinition: Enabled: false RSpec/VoidExpect: Enabled: false RSpec/Yield: Enabled: false Security/Open: Enabled: false Style/AccessModifierDeclarations: Enabled: false Style/AccessorGrouping: Enabled: false Style/ArgumentsForwarding: Enabled: false Style/AsciiComments: Enabled: false Style/BisectedAttrAccessor: Enabled: false Style/CaseLikeIf: Enabled: false Style/ClassEqualityComparison: Enabled: false Style/CollectionCompact: Enabled: false Style/ColonMethodDefinition: Enabled: false Style/CombinableLoops: Enabled: false Style/CommentedKeyword: Enabled: false Style/Dir: Enabled: false Style/DocumentDynamicEvalDefinition: Enabled: false Style/DoubleCopDisableDirective: Enabled: false Style/EmptyBlockParameter: Enabled: false Style/EmptyLambdaParameter: Enabled: false Style/Encoding: Enabled: false Style/EvalWithLocation: Enabled: false Style/ExpandPathArguments: Enabled: false Style/ExplicitBlockArgument: Enabled: false Style/ExponentialNotation: Enabled: false Style/FloatDivision: Enabled: false Style/GlobalStdStream: Enabled: false Style/HashAsLastArrayItem: Enabled: false Style/HashLikeCase: Enabled: false Style/HashTransformKeys: Enabled: false Style/HashTransformValues: Enabled: false Style/IfUnlessModifier: Enabled: false Style/KeywordParametersOrder: Enabled: false Style/MinMax: Enabled: false Style/MixinUsage: Enabled: false Style/MultilineWhenThen: Enabled: false Style/NegatedIfElseCondition: Enabled: false Style/NegatedUnless: Enabled: false Style/NilLambda: Enabled: false Style/NumericPredicate: Enabled: false Style/OptionalBooleanParameter: Enabled: false Style/OrAssignment: Enabled: false Style/RandomWithOffset: Enabled: false Style/RedundantArgument: Enabled: false Style/RedundantAssignment: Enabled: false Style/RedundantCondition: Enabled: false Style/RedundantConditional: Enabled: false Style/RedundantFetchBlock: Enabled: false Style/RedundantFileExtensionInRequire: Enabled: false Style/RedundantRegexpCharacterClass: Enabled: false Style/RedundantRegexpEscape: Enabled: false Style/RedundantSelfAssignment: Enabled: false Style/RedundantSort: Enabled: false Style/RescueStandardError: Enabled: false Style/SingleArgumentDig: Enabled: false Style/SlicingWithRange: Enabled: false Style/SoleNestedConditional: Enabled: false Style/StderrPuts: Enabled: false Style/StringConcatenation: Enabled: false Style/Strip: Enabled: false Style/SwapValues: Enabled: false Style/SymbolProc: Enabled: false Style/TrailingBodyOnClass: Enabled: false Style/TrailingBodyOnMethodDefinition: Enabled: false Style/TrailingBodyOnModule: Enabled: false Style/TrailingCommaInHashLiteral: Enabled: false Style/TrailingMethodEndStatement: Enabled: false Style/UnpackFirst: Enabled: false diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml deleted file mode 100644 index e69de29..0000000 diff --git a/lib/facter/java_version.rb b/lib/facter/java_version.rb index 07468da..1c427a8 100644 --- a/lib/facter/java_version.rb +++ b/lib/facter/java_version.rb @@ -1,46 +1,46 @@ # frozen_string_literal: true # Fact: java_version # # Purpose: get full java version string # # Resolution: # Tests for presence of java, returns nil if not present # returns output of "java -version" and splits on '"' # # Caveats: # none # # Notes: # None Facter.add(:java_version) do # the OS-specific overrides need to be able to return nil, # to indicate "no java available". Usually returning nil # would mean that facter falls back to a lower priority # resolution, which would then trigger MODULES-2637. To # avoid that, we confine the "default" here to not run # on those OS. # Additionally, facter versions prior to 2.0.1 only support # positive matches, so this needs to be done manually in setcode. setcode do unless ['darwin'].include? Facter.value(:operatingsystem).downcase version = nil if Facter::Util::Resolution.which('java') Facter::Util::Resolution.exec('java -Xmx12m -version 2>&1').lines.each { |line| version = Regexp.last_match(1) if %r{^.+ version \"(.+)\"} =~ line } end version end end end Facter.add(:java_version) do confine operatingsystem: 'Darwin' has_weight 100 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 Facter::Util::Resolution.exec('java -Xmx12m -version 2>&1').lines.each { |line| version = Regexp.last_match(1) if %r{^.+ version \"(.+)\"} =~ line } version end end end diff --git a/spec/acceptance/install_spec.rb b/spec/acceptance/install_spec.rb index e79b4ce..ddefb71 100644 --- a/spec/acceptance/install_spec.rb +++ b/spec/acceptance/install_spec.rb @@ -1,282 +1,284 @@ # frozen_string_literal: true require 'spec_helper_acceptance' require 'pry' java_class_jre = "class { 'java':\n"\ " distribution => 'jre',\n"\ '}' java_class = "class { 'java': }" _sources = "file_line { 'non-free source':\n"\ " path => '/etc/apt/sources.list',\n"\ " match => \"deb http://osmirror.delivery.puppetlabs.net/debian/ ${::lsbdistcodename} main\",\n"\ " line => \"deb http://osmirror.delivery.puppetlabs.net/debian/ ${::lsbdistcodename} main non-free\",\n"\ '}' _sun_jre = "class { 'java':\n"\ " distribution => 'sun-jre',\n"\ '}' _sun_jdk = "class { 'java':\n"\ " distribution => 'sun-jdk',\n"\ '}' blank_version = "class { 'java':\n"\ " version => '',\n"\ '}' incorrect_distro = "class { 'java':\n"\ " distribution => 'xyz',\n"\ '}' blank_distro = "class { 'java':\n"\ " distribution => '',\n"\ '}' incorrect_package = "class { 'java':\n"\ " package => 'xyz',\n"\ '}' bogus_alternative = "class { 'java':\n"\ " java_alternative => 'whatever',\n"\ " java_alternative_path => '/whatever',\n"\ '}' # Oracle installs are disabled by default, because the links to valid oracle installations # change often. Look the parameters up from the Oracle download URLs at https://java.oracle.com and # enable the tests: oracle_enabled = false oracle_version_major = '8' oracle_version_minor = '201' oracle_version_build = '09' oracle_hash = '42970487e3af4f5aa5bca3f542482c60' install_oracle_jdk_jre = < '#{oracle_version_major}', version_major => '#{oracle_version_major}u#{oracle_version_minor}', version_minor => 'b#{oracle_version_build}', url_hash => '#{oracle_hash}', java_se => 'jre', } java::oracle { 'test_oracle_jdk': version => '#{oracle_version_major}', version_major => '#{oracle_version_major}u#{oracle_version_minor}', version_minor => 'b#{oracle_version_build}', url_hash => '#{oracle_hash}', java_se => 'jdk', } EOL install_oracle_jre_jce = < '#{oracle_version_major}', version_major => '#{oracle_version_major}u#{oracle_version_minor}', version_minor => 'b#{oracle_version_build}', url_hash => '#{oracle_hash}', java_se => 'jre', jce => true, } EOL install_oracle_jdk_jce = < '#{oracle_version_major}', version_major => '#{oracle_version_major}u#{oracle_version_minor}', version_minor => 'b#{oracle_version_build}', url_hash => '#{oracle_hash}', java_se => 'jdk', jce => true, } EOL # AdoptOpenJDK URLs are quite generic, so tests are enabled by default # We need to test version 8 and >8 (here we use 9), because namings are different after version 8 adopt_enabled = true unless os[:family].casecmp('SLES').zero? adopt_version8_major = '8' adopt_version8_minor = '202' adopt_version8_build = '08' adopt_version9_major = '9' adopt_version9_full = '9.0.4' adopt_version9_build = '11' install_adopt_jdk_jre = < '#{adopt_version8_major}', version_major => '#{adopt_version8_major}u#{adopt_version8_minor}', version_minor => 'b#{adopt_version8_build}', java => 'jre', } java::adopt { 'test_adopt_jdk_version8': version => '#{adopt_version8_major}', version_major => '#{adopt_version8_major}u#{adopt_version8_minor}', version_minor => 'b#{adopt_version8_build}', java => 'jdk', } java::adopt { 'test_adopt_jre_version9': version => '#{adopt_version9_major}', version_major => '#{adopt_version9_full}', version_minor => '#{adopt_version9_build}', java => 'jre', } java::adopt { 'test_adopt_jdk_version9': version => '#{adopt_version9_major}', version_major => '#{adopt_version9_full}', version_minor => '#{adopt_version9_build}', java => 'jdk', } EOL sap_enabled = true sap_version7 = '7' sap_version7_full = '7.1.072' sap_version8 = '8' sap_version8_full = '8.1.065' sap_version11 = '11' sap_version11_full = '11.0.7' sap_version14 = '14' sap_version14_full = '14.0.1' install_sap_jdk_jre = < '#{sap_version7}', version_full => '#{sap_version7_full}', java => 'jdk', } java::sap { 'test_sap_jdk_version8': version => '#{sap_version8}', version_full => '#{sap_version8_full}', java => 'jdk', } java::sap { 'test_sap_jre_version11': version => '#{sap_version11}', version_full => '#{sap_version11_full}', java => 'jre', } java::sap { 'test_sap_jdk_version11': version => '#{sap_version11}', version_full => '#{sap_version11_full}', java => 'jdk', } java::sap { 'test_sap_jre_version14': version => '#{sap_version14}', version_full => '#{sap_version14_full}', java => 'jre', } java::sap { 'test_sap_jdk_version14': version => '#{sap_version14}', version_full => '#{sap_version14_full}', java => 'jdk', } EOL -context 'installing java jre', unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do - it 'installs jre' do - idempotent_apply(java_class_jre) +describe 'installing' do + context 'installing java jre' do + it 'installs jre' do + idempotent_apply(java_class_jre) + end end -end -context 'installing java jdk', unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do - it 'installs jdk' do - idempotent_apply(java_class) + context 'installing java jdk' do + it 'installs jdk' do + idempotent_apply(java_class) + end 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 + 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 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 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 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) + 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 -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 + 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 + 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 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 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) + 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 -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 + 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 + let(:version_suffix) do + (os[:family] == 'redhat') ? '-amd64' : '' + end - it 'installs adopt jdk and jre' do - idempotent_apply(install_adopt_jdk_jre) + it 'installs adopt jdk and jre' do + idempotent_apply(install_adopt_jdk_jre) + end 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 + 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) + it 'installs adopt jdk and jre' do + idempotent_apply(install_sap_jdk_jre) + end end end