Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

facterdb_string_keys: switch to strings #1047

Merged
merged 1 commit into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
timeout_minutes: 75
spec/spec_helper.rb:
spec_overrides: "require 'spec_helper_methods'"
facterdb_string_keys: true
2 changes: 1 addition & 1 deletion spec/classes/collectd_init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
context 'when utils true' do
let(:params) { { utils: true } }

case "#{facts[:os]['family']}-#{facts[:os]['release']['major']}"
case "#{facts['os']['family']}-#{facts['os']['release']['major']}"
when %r{^Debian-.+}, 'RedHat-8', 'RedHat-9'
it { is_expected.to contain_package('collectd-utils') }
else
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_apache_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
end
end

case facts[:os]['family']
case facts['os']['family']
when 'RedHat'
context ':manage_package => true on osfamily => RedHat' do
let :params do
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_disk_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
end
end

case [facts[:os]['family'], facts[:os]['release']['major']]
case [facts['os']['family'], facts['os']['release']['major']]
when %w[RedHat 8]
context ':manage_package => undef with collectd 5.5 and up' do
let :facts do
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_java_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
end
end

case facts[:os]['family']
case facts['os']['family']
when 'RedHat'
context 'java_home option is empty' do
it 'will not contain libjvm' do
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_mcelog_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
it { is_expected.to contain_file('mcelog.load').with(content: %r{PersistentNotification false}) }
end

case facts[:os]['family']
case facts['os']['family']
when 'RedHat'
context 'on osfamily => RedHat' do
it { is_expected.to contain_package('collectd-mcelog').with(ensure: 'present') }
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/collectd_plugin_netlink_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
it { is_expected.to contain_file('netlink.load').with_content(%r{^ Filter "ppp0" "u32-1:0"$}) }
it { is_expected.to contain_file('netlink.load').with_content(%r{^ IgnoreSelected false$}) }

it { is_expected.to contain_package('collectd-netlink').with(ensure: 'present') } if facts[:os]['family'] == 'RedHat'
it { is_expected.to contain_package('collectd-netlink').with(ensure: 'present') } if facts['os']['family'] == 'RedHat'
end

context ':ensure => absent' do
Expand All @@ -55,7 +55,7 @@
)
end

if facts[:os]['family'] == 'RedHat'
if facts['os']['family'] == 'RedHat'
it do
is_expected.to contain_package('collectd-netlink').with(
ensure: 'absent'
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_ovs_events_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
end
end

case facts[:os]['family']
case facts['os']['family']
when 'RedHat'
context 'on osfamily => RedHat' do
it 'Will delete packaging config file' do
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_ovs_stats_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
end
end

case facts[:os]['family']
case facts['os']['family']
when 'RedHat'
context 'on osfamily => RedHat' do
it 'Will delete packaging config file' do
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_processes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
end
end

case facts[:os]['family']
case facts['os']['family']
when 'RedHat'
context 'on osfamily => RedHat' do
it 'Will delete packaging config file' do
Expand Down
14 changes: 7 additions & 7 deletions spec/classes/collectd_plugin_rabbitmq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
}
end

case [facts[:os]['family'], facts[:os]['release']['major']]
case [facts['os']['family'], facts['os']['release']['major']]
when %w[RedHat 8], %w[Ubuntu 20.04]
it { is_expected.to raise_error(%r{does not support Python 3}) }
else
Expand Down Expand Up @@ -68,7 +68,7 @@
{ custom_types_db: '/var/custom/types.db' }
end

case [facts[:os]['family'], facts[:os]['release']['major']]
case [facts['os']['family'], facts['os']['release']['major']]
when %w[RedHat 8], %w[Ubuntu 20.04]
it { is_expected.to raise_error(%r{does not support Python 3}) }
else
Expand All @@ -83,7 +83,7 @@
{ config: { 'Username' => 'foo' } }
end

case [facts[:os]['family'], facts[:os]['release']['major']]
case [facts['os']['family'], facts['os']['release']['major']]
when %w[RedHat 8], %w[Ubuntu 20.04]
it { is_expected.to raise_error(%r{does not support Python 3}) }
else
Expand All @@ -98,7 +98,7 @@
{ config: { 'Password' => 'foo' } }
end

case [facts[:os]['family'], facts[:os]['release']['major']]
case [facts['os']['family'], facts['os']['release']['major']]
when %w[RedHat 8], %w[Ubuntu 20.04]
it { is_expected.to raise_error(%r{does not support Python 3}) }
else
Expand All @@ -113,7 +113,7 @@
{ config: { 'Scheme' => 'https' } }
end

case [facts[:os]['family'], facts[:os]['release']['major']]
case [facts['os']['family'], facts['os']['release']['major']]
when %w[RedHat 8], %w[Ubuntu 20.04]
it { is_expected.to raise_error(%r{does not support Python 3}) }
else
Expand All @@ -129,7 +129,7 @@
{ ensure: 'absent' }
end

case [facts[:os]['family'], facts[:os]['release']['major']]
case [facts['os']['family'], facts['os']['release']['major']]
when %w[RedHat 8], %w[Ubuntu 20.04]
it { is_expected.to raise_error(%r{does not support Python 3}) }
else
Expand All @@ -156,7 +156,7 @@
}
end

case [facts[:os]['family'], facts[:os]['release']['major']]
case [facts['os']['family'], facts['os']['release']['major']]
when %w[RedHat 8], %w[Ubuntu 20.04]
it { is_expected.to raise_error(%r{does not support Python 3}) }
else
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_rrdtool_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
)
end

case facts[:os]['family']
case facts['os']['family']
when 'RedHat'

it { is_expected.to contain_package('collectd-rrdtool').with(ensure: 'present') }
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_smart_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
end
end

case facts[:os]['family']
case facts['os']['family']
when 'RedHat'
context ':manage_package => true on osfamily => RedHat' do
let :params do
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/collectd_plugin_virt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
end
end

case facts[:os]['family']
case facts['os']['family']
when 'RedHat'
context 'on osfamily => RedHat' do
it 'Will delete packaging config file' do
Expand Down Expand Up @@ -147,7 +147,7 @@
end
end

case facts[:os]['family']
case facts['os']['family']
when 'RedHat'
context 'on osfamily => RedHat' do
it 'Will delete packaging config file' do
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_write_http_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
)
end

case [facts[:os]['family'], facts[:os]['release']['major']]
case [facts['os']['family'], facts['os']['release']['major']]
when %w[RedHat 8]
it { is_expected.to contain_package('collectd-write_http') }
else
Expand Down
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

require 'voxpupuli/test/spec_helper'

RSpec.configure do |c|
c.facterdb_string_keys = true
end

add_mocked_facts!

if File.exist?(File.join(__dir__, 'default_module_facts.yml'))
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper_methods.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

def os_specific_options(facts)
case facts[:os]['family']
case facts['os']['family']
when 'Gentoo'
{ package: 'app-admin/collectd', service: 'collectd', plugin_conf_dir: '/etc/collectd.d' }
when 'Solaris'
Expand Down
Loading