Skip to content

Commit

Permalink
Fix remaining rubocop offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
root-expert committed Jul 3, 2022
1 parent b742519 commit 9eaaec7
Show file tree
Hide file tree
Showing 6 changed files with 591 additions and 599 deletions.
2 changes: 2 additions & 0 deletions lib/puppet/type/splunk_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
desc 'splunk config'
end

# rubocop:disable Lint/EmptyBlock
newparam(:forwarder_installdir) do
end

Expand All @@ -21,6 +22,7 @@

newparam(:server_confdir) do
end
# rubocop:enable Lint/EmptyBlock

## Generate purge parameters for the splunk_config type
%i[
Expand Down
680 changes: 339 additions & 341 deletions spec/classes/enterprise_spec.rb

Large diffs are not rendered by default.

428 changes: 213 additions & 215 deletions spec/classes/forwarder_spec.rb

Large diffs are not rendered by default.

20 changes: 9 additions & 11 deletions spec/classes/splunk_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@
describe 'splunk' do
context 'supported operating systems' do
on_supported_os.each do |os, facts|
if os.start_with?('windows')
# Splunk Server not used supported on windows
else
context "on #{os}" do
let(:facts) do
facts
end
next if facts[:os]['name'] == 'windows' # Splunk Server not used supported on windows

context 'splunk class without any parameters' do
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('splunk') }
end
context "on #{os}" do
let(:facts) do
facts
end

context 'splunk class without any parameters' do
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('splunk') }
end
end
end
Expand Down
58 changes: 27 additions & 31 deletions spec/defines/addon_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@
describe 'splunk::addon' do
context 'fail if class prerequisit not declared' do
on_supported_os.each do |os, facts|
if os.start_with?('windows')
# Splunk Server not used supported on windows
else
context "on #{os}" do
let(:facts) do
facts
end
let(:title) { 'Splunk_TA' }
let(:params) { { 'splunkbase_source' => 'puppet:///modules/profiles/splunk-add-on.tgz' } }
next if facts[:os]['name'] == 'windows' # Splunk Server not used supported on windows

it { is_expected.to compile.and_raise_error(%r{Error while evaluating a Function Call}) }
context "on #{os}" do
let(:facts) do
facts
end
let(:title) { 'Splunk_TA' }
let(:params) { { 'splunkbase_source' => 'puppet:///modules/profiles/splunk-add-on.tgz' } }

it { is_expected.to compile.and_raise_error(%r{Error while evaluating a Function Call}) }
end
end
end
Expand All @@ -27,32 +25,30 @@
end

on_supported_os.each do |os, facts|
if os.start_with?('windows')
# Splunk Server not used supported on windows
else
context "on #{os}" do
let(:facts) do
facts
end
next if facts[:os]['name'] == 'windows' # Splunk Server not used supported on windows

context 'basic addon' do
let(:title) { 'Splunk_TA' }
let(:params) { { 'splunkbase_source' => 'puppet:///modules/profiles/splunk-add-on.tgz' } }
context "on #{os}" do
let(:facts) do
facts
end

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_archive('Splunk_TA').with(source: 'puppet:///modules/profiles/splunk-add-on.tgz') }
end
context 'basic addon' do
let(:title) { 'Splunk_TA' }
let(:params) { { 'splunkbase_source' => 'puppet:///modules/profiles/splunk-add-on.tgz' } }

context 'addon requiring extract_command' do
let(:title) { 'Splunk_TA' }
let(:params) do
{ 'splunkbase_source' => 'puppet:///modules/profiles/splunk-add-on.spl',
'extract_command' => 'tar zxf %s' }
end
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_archive('Splunk_TA').with(source: 'puppet:///modules/profiles/splunk-add-on.tgz') }
end

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_archive('Splunk_TA').with(source: 'puppet:///modules/profiles/splunk-add-on.spl', extract_command: 'tar zxf %s') }
context 'addon requiring extract_command' do
let(:title) { 'Splunk_TA' }
let(:params) do
{ 'splunkbase_source' => 'puppet:///modules/profiles/splunk-add-on.spl',
'extract_command' => 'tar zxf %s' }
end

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_archive('Splunk_TA').with(source: 'puppet:///modules/profiles/splunk-add-on.spl', extract_command: 'tar zxf %s') }
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/puppet/type/splunk_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'spec_helper'

describe Puppet::Type.type(:splunk_config) do
let(:subject) do
let(:subject) do # rubocop:disable RSpec/SubjectDeclaration
described_class.new(
name: 'config',
server_confdir: '/opt/splunk/etc',
Expand Down

0 comments on commit 9eaaec7

Please sign in to comment.