From 491ca2b8470bf802424854280969c3fedcebe181 Mon Sep 17 00:00:00 2001 From: William Yardley Date: Wed, 10 May 2023 19:21:27 -0700 Subject: [PATCH 1/4] modulesync 7.5.0 --- .github/CONTRIBUTING.md | 27 +++++++++++---- .github/SECURITY.md | 3 -- .github/workflows/ci.yml | 9 +++-- .github/workflows/release.yml | 2 +- .gitignore | 38 ++++++++++---------- .msync.yml | 2 +- .pmtignore | 65 ++++++++++++++++++----------------- .rubocop.yml | 1 + Dockerfile | 24 ------------- Gemfile | 12 +++---- Rakefile | 36 +++---------------- spec/spec_helper.rb | 3 ++ 12 files changed, 95 insertions(+), 127 deletions(-) delete mode 100644 .github/SECURITY.md delete mode 100644 Dockerfile diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8b466cfb9..880932740 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -131,19 +131,29 @@ You can install all needed gems for spec tests into the modules directory by running: ```sh -bundle install --path .vendor/ --without development system_tests release --jobs "$(nproc)" +bundle config set --local path '.vendor/' +bundle config set --local without 'development system_tests release' +bundle install --jobs "$(nproc)" ``` If you also want to run acceptance tests: ```sh -bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)" +bundle config set --local path '.vendor/' +bundle config set --local without 'development release' +bundle config set --local with 'system_tests' +bundle install --jobs "$(nproc)" ``` Our all in one solution if you don't know if you need to install or update gems: ```sh -bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)"; bundle update; bundle clean +bundle config set --local path '.vendor/' +bundle config set --local without 'development release' +bundle config set --local with 'system_tests' +bundle install --jobs "$(nproc)" +bundle update +bundle clean ``` As an alternative to the `--jobs "$(nproc)` parameter, you can set an @@ -232,18 +242,21 @@ simple tests against it after applying the module. You can run this with: ```sh -BEAKER_setfile=debian11-64 bundle exec rake beaker +BEAKER_PUPPET_COLLECTION=puppet7 BEAKER_setfile=debian11-64 bundle exec rake beaker ``` -You can replace the string `debian10` with any common operating system. +You can replace the string `debian11` with any common operating system. The following strings are known to work: -* ubuntu1804 * ubuntu2004 -* debian10 +* ubuntu2204 * debian11 * centos7 * centos8 +* centos9 +* almalinux8 +* almalinux9 +* fedora36 For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests). diff --git a/.github/SECURITY.md b/.github/SECURITY.md deleted file mode 100644 index cacadf220..000000000 --- a/.github/SECURITY.md +++ /dev/null @@ -1,3 +0,0 @@ -# Vox Pupuli Security Policy - -Our vulnerabilities reporting process is at https://voxpupuli.org/security/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a0779116..7216724fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,12 @@ name: CI -on: pull_request +on: + pull_request: {} + push: + branches: + - main + - master concurrency: group: ${{ github.ref_name }} @@ -13,6 +18,6 @@ concurrency: jobs: puppet: name: Puppet - uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1 + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2 with: pidfile_workaround: 'false' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 15f172134..55324aa62 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ on: jobs: release: name: Release - uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1 + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v2 with: allowed_owner: 'voxpupuli' secrets: diff --git a/.gitignore b/.gitignore index 9b95224ce..adea1b017 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,25 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -pkg/ -Gemfile.lock -Gemfile.local -vendor/ -.vendor/ -spec/fixtures/manifests/ -spec/fixtures/modules/ -.vagrant/ -.bundle/ -.ruby-version -coverage/ -log/ -.idea/ -.dependencies/ -.librarian/ -Puppetfile.lock +/pkg/ +/Gemfile.lock +/Gemfile.local +/vendor/ +/.vendor/ +/spec/fixtures/manifests/ +/spec/fixtures/modules/ +/.vagrant/ +/.bundle/ +/.ruby-version +/coverage/ +/log/ +/.idea/ +/.dependencies/ +/.librarian/ +/Puppetfile.lock *.iml .*.sw? -.yardoc/ -Guardfile +/.yardoc/ +/Guardfile +bolt-debug.log +.rerun.json diff --git a/.msync.yml b/.msync.yml index 968a93678..ade23f9ea 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.2.0' +modulesync_config_version: '7.5.0' diff --git a/.pmtignore b/.pmtignore index 65f505149..10b983069 100644 --- a/.pmtignore +++ b/.pmtignore @@ -1,37 +1,38 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -docs/ -pkg/ -Gemfile -Gemfile.lock -Gemfile.local -vendor/ -.vendor/ -spec/ -Rakefile -.vagrant/ -.bundle/ -.ruby-version -coverage/ -log/ -.idea/ -.dependencies/ -.github/ -.librarian/ -Puppetfile.lock +/docs/ +/pkg/ +/Gemfile +/Gemfile.lock +/Gemfile.local +/vendor/ +/.vendor/ +/spec/ +/Rakefile +/.vagrant/ +/.bundle/ +/.ruby-version +/coverage/ +/log/ +/.idea/ +/.dependencies/ +/.github/ +/.librarian/ +/Puppetfile.lock *.iml -.editorconfig -.fixtures.yml -.gitignore -.msync.yml -.overcommit.yml -.pmtignore -.rspec -.rspec_parallel -.rubocop.yml -.sync.yml +/.editorconfig +/.fixtures.yml +/.gitignore +/.msync.yml +/.overcommit.yml +/.pmtignore +/.rspec +/.rspec_parallel +/.rubocop.yml +/.sync.yml .*.sw? -.yardoc/ -.yardopts -Dockerfile +/.yardoc/ +/.yardopts +/Dockerfile +/HISTORY.md diff --git a/.rubocop.yml b/.rubocop.yml index 53ac18982..fded90cf2 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,5 +2,6 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ +inherit_from: .rubocop_todo.yml inherit_gem: voxpupuli-test: rubocop.yml diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 8dd82d636..000000000 --- a/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -# MANAGED BY MODULESYNC -# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ - -FROM ruby:2.7 - -WORKDIR /opt/puppet - -# https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39 -RUN mkdir -p /etc/sv - -ARG PUPPET_GEM_VERSION="~> 6.0" -ARG PARALLEL_TEST_PROCESSORS=4 - -# Cache gems -COPY Gemfile . -RUN bundle install --without system_tests development release --path=${BUNDLE_PATH:-vendor/bundle} - -COPY . . - -RUN bundle install -RUN bundle exec rake release_checks - -# Container should not saved -RUN exit 1 diff --git a/Gemfile b/Gemfile index 225c39694..a4a3b2043 100644 --- a/Gemfile +++ b/Gemfile @@ -4,10 +4,10 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 5.0', :require => false + gem 'voxpupuli-test', '~> 7.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 1.0', :require => false + gem 'puppet_metadata', '~> 3.5', :require => false end group :development do @@ -16,19 +16,17 @@ group :development do end group :system_tests do - gem 'voxpupuli-acceptance', '~> 1.0', :require => false + gem 'voxpupuli-acceptance', '~> 3.0', :require => false end group :release do - gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' - gem 'voxpupuli-release', '>= 1.2.0', :require => false - gem 'puppet-strings', '>= 2.2', :require => false + gem 'voxpupuli-release', '~> 3.0', :require => false end gem 'rake', :require => false gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0' +puppetversion = ENV['PUPPET_GEM_VERSION'] || '~> 7.24' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby diff --git a/Rakefile b/Rakefile index f92f05164..b1bc23c83 100644 --- a/Rakefile +++ b/Rakefile @@ -24,6 +24,10 @@ end begin require 'voxpupuli/release/rake_tasks' rescue LoadError + # voxpupuli-release not present +else + GCGConfig.user = 'voxpupuli' + GCGConfig.project = 'puppet-rabbitmq' end desc "Run main 'test' task and report merged results to coveralls" @@ -37,36 +41,4 @@ task test_with_coveralls: [:test] do end end -desc 'Generate REFERENCE.md' -task :reference, [:debug, :backtrace] do |t, args| - patterns = '' - Rake::Task['strings:generate:reference'].invoke(patterns, args[:debug], args[:backtrace]) -end - -begin - require 'github_changelog_generator/task' - require 'puppet_blacksmith' - GitHubChangelogGenerator::RakeTask.new :changelog do |config| - metadata = Blacksmith::Modulefile.new - config.future_release = "v#{metadata.version}" if metadata.version =~ /^\d+\.\d+.\d+$/ - config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." - config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} - config.user = 'voxpupuli' - config.project = metadata.metadata['name'] - end - - # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 - require 'rbconfig' - if RbConfig::CONFIG['host_os'] =~ /linux/ - task :changelog do - puts 'Fixing line endings...' - changelog_file = File.join(__dir__, 'CHANGELOG.md') - changelog_txt = File.read(changelog_file) - new_contents = changelog_txt.gsub(%r{\r\n}, "\n") - File.open(changelog_file, "w") {|file| file.puts new_contents } - end - end - -rescue LoadError -end # vim: syntax=ruby diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 67cc04489..8f1062c2a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,6 +13,8 @@ require 'voxpupuli/test/spec_helper' +add_mocked_facts! + if File.exist?(File.join(__dir__, 'default_module_facts.yml')) facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) facts&.each do |name, value| @@ -21,3 +23,4 @@ end require 'spec_helper_local' +Dir['./spec/support/spec/**/*.rb'].sort.each { |f| require f } From 14fe17fbb6b2ff3c6c8ed2b42110082f5e51b675 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 18 Aug 2023 08:38:16 +0200 Subject: [PATCH 2/4] rubocop: autofix --- .rubocop.yml | 2 ++ .rubocop_todo.yml | 22 +++++++++++++++++++ lib/facter/rabbitmq_nodename.rb | 2 +- spec/classes/rabbitmq_spec.rb | 4 ++-- .../util/fact_rabbitmq_plugins_dirs_spec.rb | 13 ++--------- .../rabbitmqctl_spec.rb | 3 +-- .../puppet/type/rabbitmq_parameter_spec.rb | 2 +- 7 files changed, 31 insertions(+), 17 deletions(-) create mode 100644 .rubocop_todo.yml diff --git a/.rubocop.yml b/.rubocop.yml index fded90cf2..7e8bb89d6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,4 +1,6 @@ --- +inherit_from: .rubocop_todo.yml + # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 000000000..a7ca885e9 --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,22 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2023-08-17 21:37:37 UTC using RuboCop version 1.50.2. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 8 +# This cop supports unsafe autocorrection (--autocorrect-all). +RSpec/BeEq: + Exclude: + - 'spec/unit/puppet/provider/rabbitmq_plugin/rabbitmqctl_spec.rb' + - 'spec/unit/puppet/provider/rabbitmq_policy/rabbitmqctl_spec.rb' + - 'spec/unit/puppet/provider/rabbitmq_user_permissions/rabbitmqctl_spec.rb' + - 'spec/unit/puppet/provider/rabbitmq_vhost/rabbitmqctl_spec.rb' + - 'spec/unit/puppet/type/rabbitmq_user_permissions_spec.rb' + +# Offense count: 3 +RSpec/PendingWithoutReason: + Exclude: + - 'spec/acceptance/class_spec.rb' diff --git a/lib/facter/rabbitmq_nodename.rb b/lib/facter/rabbitmq_nodename.rb index 812443cbf..0ab1606a8 100644 --- a/lib/facter/rabbitmq_nodename.rb +++ b/lib/facter/rabbitmq_nodename.rb @@ -5,7 +5,7 @@ if Facter::Util::Resolution.which('rabbitmqctl') rabbitmq_nodename = Facter::Core::Execution.execute('rabbitmqctl status 2>&1') begin - %r{^Status of node '?([\w.\-]+@[\w.\-]+)'?}.match(rabbitmq_nodename)[1] + %r{^Status of node '?([\w.-]+@[\w.-]+)'?}.match(rabbitmq_nodename)[1] rescue StandardError Facter.debug("Error: rabbitmq_nodename facter failed. Output was #{rabbitmq_nodename}") end diff --git a/spec/classes/rabbitmq_spec.rb b/spec/classes/rabbitmq_spec.rb index d89df2839..dd1b51083 100644 --- a/spec/classes/rabbitmq_spec.rb +++ b/spec/classes/rabbitmq_spec.rb @@ -372,7 +372,7 @@ describe 'does not contain pre-ranch settings with default config' do it do is_expected.to contain_file('rabbitmq.config'). \ - without_content(%r{binary,}). \ + without_content(%r{binary,}). \ without_content(%r{\{packet, raw\},}). \ without_content(%r{\{reuseaddr, true\},}) end @@ -383,7 +383,7 @@ it do is_expected.to contain_file('rabbitmq.config'). \ - with_content(%r{binary,}). \ + with_content(%r{binary,}). \ with_content(%r{\{packet, raw\},}). \ with_content(%r{\{reuseaddr, true\},}) end diff --git a/spec/unit/facter/util/fact_rabbitmq_plugins_dirs_spec.rb b/spec/unit/facter/util/fact_rabbitmq_plugins_dirs_spec.rb index 04a10e358..55888dec4 100644 --- a/spec/unit/facter/util/fact_rabbitmq_plugins_dirs_spec.rb +++ b/spec/unit/facter/util/fact_rabbitmq_plugins_dirs_spec.rb @@ -10,12 +10,7 @@ it do Facter::Util::Resolution.expects(:which).with('rabbitmqctl').returns(true) Facter::Core::Execution.expects(:execute).with("rabbitmqctl eval 'application:get_env(rabbit, plugins_dir).'").returns('{ok,"/usr/lib/rabbitmq/plugins:/usr/lib/rabbitmq/lib/rabbitmq_server-3.7.10/plugins"}') - expect(Facter.fact(:rabbitmq_plugins_dirs).value).to match_array( - [ - '/usr/lib/rabbitmq/plugins', - '/usr/lib/rabbitmq/lib/rabbitmq_server-3.7.10/plugins' - ] - ) + expect(Facter.fact(:rabbitmq_plugins_dirs).value).to contain_exactly('/usr/lib/rabbitmq/plugins', '/usr/lib/rabbitmq/lib/rabbitmq_server-3.7.10/plugins') end end @@ -23,11 +18,7 @@ it do Facter::Util::Resolution.expects(:which).with('rabbitmqctl').returns(true) Facter::Core::Execution.expects(:execute).with("rabbitmqctl eval 'application:get_env(rabbit, plugins_dir).'").returns('{ok,"/usr/lib/rabbitmq/lib/rabbitmq_server-0.0.0/plugins"}') - expect(Facter.fact(:rabbitmq_plugins_dirs).value).to match_array( - [ - '/usr/lib/rabbitmq/lib/rabbitmq_server-0.0.0/plugins' - ] - ) + expect(Facter.fact(:rabbitmq_plugins_dirs).value).to contain_exactly('/usr/lib/rabbitmq/lib/rabbitmq_server-0.0.0/plugins') end end diff --git a/spec/unit/puppet/provider/rabbitmq_user_permissions/rabbitmqctl_spec.rb b/spec/unit/puppet/provider/rabbitmq_user_permissions/rabbitmqctl_spec.rb index 77fcc2789..cca62c64d 100644 --- a/spec/unit/puppet/provider/rabbitmq_user_permissions/rabbitmqctl_spec.rb +++ b/spec/unit/puppet/provider/rabbitmq_user_permissions/rabbitmqctl_spec.rb @@ -37,8 +37,7 @@ end it 'does not match an empty list' do - provider.class.expects(:rabbitmqctl_list).with('user_permissions', 'foo').returns <<-EOT - EOT + provider.class.expects(:rabbitmqctl_list).with('user_permissions', 'foo').returns '' expect(provider.exists?).to eq(nil) end diff --git a/spec/unit/puppet/type/rabbitmq_parameter_spec.rb b/spec/unit/puppet/type/rabbitmq_parameter_spec.rb index 8fc81c226..5b9586db8 100644 --- a/spec/unit/puppet/type/rabbitmq_parameter_spec.rb +++ b/spec/unit/puppet/type/rabbitmq_parameter_spec.rb @@ -96,7 +96,7 @@ it 'does not convert numeric string to integer' do expect(parameter[:value]['myparameter']).to eq('1800000') - expect(parameter[:value]['myparameter']).to be_kind_of(String) + expect(parameter[:value]['myparameter']).to be_a(String) end end end From a38dd1a3bdde347a7e1631f2099f2373bac4682a Mon Sep 17 00:00:00 2001 From: markuszilch Date: Fri, 29 Mar 2024 12:18:39 +0100 Subject: [PATCH 3/4] replace install_module_from_forge with install_puppet_module_via_pmt --- spec/spec_helper_acceptance.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 94706e396..a4332b42f 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -5,9 +5,9 @@ configure_beaker do |host| case fact_on(host, 'os.family') when 'Debian' - install_module_from_forge_on(host, 'puppetlabs-apt', '>= 4.1.0 < 9.0.0') + install_puppet_module_via_pmt_on(host, 'puppetlabs-apt', '>= 4.1.0 < 9.0.0') when 'RedHat' - install_module_from_forge_on(host, 'garethr-erlang', '>= 0.3.0 < 1.0.0') + install_puppet_module_via_pmt_on(host, 'garethr-erlang', '>= 0.3.0 < 1.0.0') if fact_on(host, 'os.selinux.enabled') # Make sure selinux is disabled so the tests work. on host, puppet('resource', 'exec', 'setenforce 0', 'path=/bin:/sbin:/usr/bin:/usr/sbin', 'onlyif=which setenforce && getenforce | grep Enforcing') From 51846f3b9a4c4e3af51a9abf9e169ec4bae297e4 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 19 May 2024 00:28:17 +0200 Subject: [PATCH 4/4] trying to fix rspec-puppet --- .rubocop_todo.yml | 12 +++++++++++- lib/puppet/type/rabbitmq_parameter.rb | 2 +- spec/classes/rabbitmq_spec.rb | 18 ++++++------------ 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index a7ca885e9..f6f53043d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-08-17 21:37:37 UTC using RuboCop version 1.50.2. +# on 2024-05-18 22:27:55 UTC using RuboCop version 1.50.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -20,3 +20,13 @@ RSpec/BeEq: RSpec/PendingWithoutReason: Exclude: - 'spec/acceptance/class_spec.rb' + +# Offense count: 4 +RSpec/RepeatedExampleGroupBody: + Exclude: + - 'spec/classes/rabbitmq_spec.rb' + +# Offense count: 14 +RSpec/RepeatedExampleGroupDescription: + Exclude: + - 'spec/classes/rabbitmq_spec.rb' diff --git a/lib/puppet/type/rabbitmq_parameter.rb b/lib/puppet/type/rabbitmq_parameter.rb index b3121e670..8e7c4f689 100644 --- a/lib/puppet/type/rabbitmq_parameter.rb +++ b/lib/puppet/type/rabbitmq_parameter.rb @@ -85,7 +85,7 @@ [self[:name].split('@')[1]] end - def set_parameters(hash) # rubocop:disable Style/AccessorMethodName + def set_parameters(hash) # rubocop:disable Naming/AccessorMethodName # Hack to ensure :autoconvert is initialized before :value self[:autoconvert] = hash[:autoconvert] if hash.key?(:autoconvert) super diff --git a/spec/classes/rabbitmq_spec.rb b/spec/classes/rabbitmq_spec.rb index dd1b51083..bfadc4b7c 100644 --- a/spec/classes/rabbitmq_spec.rb +++ b/spec/classes/rabbitmq_spec.rb @@ -1,8 +1,5 @@ # frozen_string_literal: true -# rubocop:disable RSpec/RepeatedExampleGroupDescription -# rubocop:disable RSpec/RepeatedExampleGroupBody - require 'spec_helper' describe 'rabbitmq' do @@ -144,13 +141,13 @@ it { is_expected.not_to contain_file('/etc/default/rabbitmq-server') } end - if os_facts[:systemd] + if os_facts['systemd'] selinux_ignore_defaults = os_facts[:os]['family'] == 'RedHat' it do is_expected.to contain_systemd__service_limits("#{name}.service"). with_selinux_ignore_defaults(selinux_ignore_defaults). - with_limits('LimitNOFILE' => value). + with_limits({ 'LimitNOFILE' => value, 'OOMScoreAdjust' => 0 }). with_restart_service(false) end else @@ -179,10 +176,10 @@ it { is_expected.not_to contain_file('/etc/default/rabbitmq-server') } end - if os_facts[:systemd] + if os_facts['systemd'] it do is_expected.to contain_systemd__service_limits("#{name}.service"). - with_limits('OOMScoreAdjust' => value). + with_limits({ 'LimitNOFILE' => 16_384, 'OOMScoreAdjust' => value }). with_restart_service(false) end else @@ -201,14 +198,14 @@ end end - context 'on systems with systemd', if: os_facts[:systemd] do + context 'on systems with systemd', if: os_facts['systemd'] do it do is_expected.to contain_systemd__service_limits("#{name}.service"). with_restart_service(false) end end - context 'on systems without systemd', unless: os_facts[:systemd] do + context 'on systems without systemd', unless: os_facts['systemd'] do it { is_expected.not_to contain_systemd__service_limits("#{name}.service") } end @@ -1806,6 +1803,3 @@ end end end - -# rubocop:enable RSpec/RepeatedExampleGroupDescription -# rubocop:enable RSpec/RepeatedExampleGroupBody