Skip to content

Commit

Permalink
add spec tests
Browse files Browse the repository at this point in the history
  • Loading branch information
trefzer committed Mar 11, 2024
1 parent a4fbb8c commit 3ebb55b
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions spec/classes/redis_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1715,6 +1715,61 @@ class { 'redis':
it { is_expected.to contain_systemd__unit_file("#{service_name}.service").with('content' => %r{^TimeoutStartSec=600$}) }
it { is_expected.to contain_systemd__unit_file("#{service_name}.service").with('content' => %r{^TimeoutStopSec=300$}) }
end

describe 'with non default ownership' do

Check failure on line 1719 in spec/classes/redis_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Layout/ExtraSpacing: Unnecessary spacing detected.

Check failure on line 1719 in spec/classes/redis_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Layout/SpaceBeforeFirstArg: Put one space between the method name and the first argument.
let :params do

Check failure on line 1720 in spec/classes/redis_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Layout/TrailingWhitespace: Trailing whitespace detected. (https://rubystyle.guide#no-trailing-whitespace)
{
workdir: '/tmp/rediswork',
workdir_group: 'wdirgroup',
workdir_owner: 'wdirowner',
config_group: 'cfggroup'
}
end

it {
is_expected.to contain_file('/tmp/rediswork').with(
'ensure' => 'directory',
'owner' => 'wdirowner',
'group' => 'wdirgroup',
'mode' => '0750',

Check failure on line 1734 in spec/classes/redis_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Style/TrailingCommaInArguments: Avoid comma after the last parameter of a method call. (https://rubystyle.guide#no-trailing-params-comma)
)
}

Check failure on line 1736 in spec/classes/redis_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

RSpec/EmptyLineAfterExample: Add an empty line after `it`. (https://rspec.rubystyle.guide/#empty-lines-around-examples, https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExample)
if facts[:os]['family'] == 'Debian'
it {
is_expected.to contain_file('/etc/default/redis-server').
with(
'ensure' => 'file',
'owner' => 'redis',
'group' => 'cfggroup',
'mode' => '0640',

Check failure on line 1744 in spec/classes/redis_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Style/TrailingCommaInArguments: Avoid comma after the last parameter of a method call. (https://rubystyle.guide#no-trailing-params-comma)
)
}
end
end

Check failure on line 1748 in spec/classes/redis_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

RSpec/EmptyLineAfterExampleGroup: Add an empty line after `describe`. (https://rspec.rubystyle.guide/#empty-lines-between-describes, https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExampleGroup)
describe 'overwrite debian directory config' do

Check failure on line 1749 in spec/classes/redis_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Layout/ExtraSpacing: Unnecessary spacing detected.

Check failure on line 1749 in spec/classes/redis_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Layout/SpaceBeforeFirstArg: Put one space between the method name and the first argument.
let :params do
{
config_owner: 'redis',
config_group: 'cfggroup',
config_file_mode: '0333',
debdefault_group: 'dd_group',
debdefault_owner: 'dd_owner',
debdefault_file_mode: '0242',
}
end

if facts[:os]['family'] == 'Debian'
it {
is_expected.to contain_file('/etc/default/redis-server').
with(
'ensure' => 'file',
'owner' => 'dd_owner',
'group' => 'dd_group',
'mode' => '0242',

Check failure on line 1768 in spec/classes/redis_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Style/TrailingCommaInArguments: Avoid comma after the last parameter of a method call. (https://rubystyle.guide#no-trailing-params-comma)
)
}
end
end
end
end
end
Expand Down

0 comments on commit 3ebb55b

Please sign in to comment.