Skip to content

Commit

Permalink
Switch to stringified facts
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Sep 20, 2024
1 parent e85d510 commit 125104a
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 25 deletions.
1 change: 1 addition & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
- parameter_types
spec/spec_helper.rb:
hiera_config: "'spec/fixtures/hiera/hiera.yaml'"
facterdb_string_keys: true
4 changes: 2 additions & 2 deletions spec/classes/varnish_firewall_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
require 'spec_helper'

describe 'varnish::firewall', type: :class do
on_supported_os.each do |os, facts|
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let :facts do
facts
os_facts
end

context 'default values' do
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/varnish_install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
require 'spec_helper'

describe 'varnish::install', type: :class do
on_supported_os.each do |os, facts|
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let :facts do
facts
os_facts
end

context 'default values' do
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/varnish_ncsa_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
'include varnish'
end

on_supported_os.each do |os, facts|
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let :facts do
facts
os_facts
end

context 'default values' do
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/varnish_repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

it { is_expected.to compile }

case os_facts[:osfamily]
case os_facts['os']['family']
when 'Debian'
it {
is_expected.to contain_apt__source('varnish').with(
Expand Down
6 changes: 3 additions & 3 deletions spec/classes/varnish_shmlog_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
require 'spec_helper'

describe 'varnish::shmlog', type: :class do
on_supported_os.each do |os, facts|
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let :facts do
facts
os_facts
end

context 'default values' do
Expand All @@ -19,7 +19,7 @@
)
}

if facts[:os]['selinux']['enabled'] == true
if os_facts['os']['selinux']['enabled'] == true
it {
is_expected.to contain_mount('shmlog-mount').with(
'target' => '/etc/fstab',
Expand Down
8 changes: 4 additions & 4 deletions spec/classes/varnish_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
require 'spec_helper'

describe 'varnish', type: :class do
on_supported_os.each do |os, facts|
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let :facts do
facts
os_facts
end

# Base Checks for all OS
Expand Down Expand Up @@ -67,7 +67,7 @@
)
}

if facts[:osfamily] == 'RedHat'
if os_facts['os']['family'] == 'RedHat'
it { is_expected.to contain_file('varnish-conf').without_content(%r{\s -j unix,user=vcache}) }
else
it { is_expected.to contain_file('varnish-conf').with_content(%r{\s -j unix,user=vcache}) }
Expand Down Expand Up @@ -161,7 +161,7 @@
it { is_expected.to compile }
it { is_expected.to contain_class('varnish::install').with_version('6.0.0-manual') }

if facts[:osfamily] == 'RedHat'
if os_facts['os']['family'] == 'RedHat'
it { is_expected.to contain_file('varnish-conf').without_content(%r{\s -j unix,user=vcache}) }
else
it { is_expected.to contain_file('varnish-conf').with_content(%r{\s -j unix,user=vcache}) }
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/varnish_vcl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
require 'spec_helper'

describe 'varnish::vcl', type: :class do
on_supported_os.each do |os, facts|
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let :facts do
facts
os_facts
end
let :pre_condition do
'include varnish'
Expand Down
4 changes: 2 additions & 2 deletions spec/defines/varnish_vcl_acl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
let(:title) { 'foo' }
let(:facts) { { concat_basedir: '/dne' } }

on_supported_os.each do |os, facts|
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let :facts do
facts
os_facts
end

let(:params) { { hosts: ['192.168.10.14'] } }
Expand Down
4 changes: 2 additions & 2 deletions spec/defines/varnish_vcl_backend_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
]
end

on_supported_os.each do |os, facts|
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let :facts do
facts
os_facts
end

let(:title) { 'foo' }
Expand Down
4 changes: 2 additions & 2 deletions spec/defines/varnish_vcl_director_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
end
let(:title) { 'foo' }

on_supported_os.each do |os, facts|
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let :facts do
facts
os_facts
end
let(:params) { { backends: ['192.168.10.14'] } }

Expand Down
4 changes: 2 additions & 2 deletions spec/defines/varnish_vcl_selector_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
]
end

on_supported_os.each do |os, facts|
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let :facts do
facts
os_facts
end

let(:title) { 'foo' }
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
require 'voxpupuli/test/spec_helper'

RSpec.configure do |c|
c.facterdb_string_keys = false
c.facterdb_string_keys = true
c.hiera_config = 'spec/fixtures/hiera/hiera.yaml'
end

Expand Down

0 comments on commit 125104a

Please sign in to comment.