Skip to content

Commit

Permalink
trying to fix rspec-puppet
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed May 18, 2024
1 parent 4789667 commit a32473b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
12 changes: 11 additions & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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'
2 changes: 1 addition & 1 deletion lib/puppet/type/rabbitmq_parameter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 6 additions & 12 deletions spec/classes/rabbitmq_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# frozen_string_literal: true

# rubocop:disable RSpec/RepeatedExampleGroupDescription
# rubocop:disable RSpec/RepeatedExampleGroupBody

require 'spec_helper'

describe 'rabbitmq' do
Expand Down Expand Up @@ -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}).

Check failure on line 150 in spec/classes/rabbitmq_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Layout/SpaceInsideHashLiteralBraces: Space inside { missing. (https://rubystyle.guide#spaces-braces)

Check failure on line 150 in spec/classes/rabbitmq_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Layout/SpaceInsideHashLiteralBraces: Space inside } missing. (https://rubystyle.guide#spaces-braces)
with_restart_service(false)
end
else
Expand Down Expand Up @@ -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' => 16384, 'OOMScoreAdjust' => value}).

Check failure on line 182 in spec/classes/rabbitmq_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Layout/SpaceInsideHashLiteralBraces: Space inside { missing. (https://rubystyle.guide#spaces-braces)

Check failure on line 182 in spec/classes/rabbitmq_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Style/NumericLiterals: Use underscores(_) as thousands separator and separate every 3 digits with them. (https://rubystyle.guide#underscores-in-numerics)

Check failure on line 182 in spec/classes/rabbitmq_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Layout/SpaceInsideHashLiteralBraces: Space inside } missing. (https://rubystyle.guide#spaces-braces)
with_restart_service(false)
end
else
Expand All @@ -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

Expand Down Expand Up @@ -1806,6 +1803,3 @@
end
end
end

# rubocop:enable RSpec/RepeatedExampleGroupDescription
# rubocop:enable RSpec/RepeatedExampleGroupBody

0 comments on commit a32473b

Please sign in to comment.