Skip to content

Commit 948ed06

Browse files
committed
spec: us os_fact instead of fact
Some of the older `facts` for both the local and rspec facts. This PR updates theses spec test to use `os_facts` for the local facts which is the convention elsewhere in vox
1 parent 6d9ba2b commit 948ed06

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

spec/classes/dnstap_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
require 'spec_helper'
44

55
describe 'unbound::dnstap' do
6-
on_supported_os.each do |os, facts|
6+
on_supported_os.each do |os, os_facts|
77
context "on #{os}" do
8-
let(:facts) { facts.merge(concat_basedir: '/dne', unbound_version: '1.21.0') }
8+
let(:facts) { os_facts.merge(concat_basedir: '/dne', unbound_version: '1.21.0') }
99

10-
case facts[:os]['family']
10+
case os_facts[:os]['family']
1111
when 'FreeBSD'
1212
let(:config_file) { '/usr/local/etc/unbound/unbound.conf' }
1313
when 'OpenBSD'

spec/classes/init_spec.rb

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
let(:params) { {} }
77

88
# rubocop:disable RSpec/MultipleMemoizedHelpers
9-
on_supported_os.each do |os, facts|
9+
on_supported_os.each do |os, os_facts|
1010
context "on #{os}" do
11-
let(:facts) { facts.merge(concat_basedir: '/dne') }
11+
let(:facts) { os_facts.merge(concat_basedir: '/dne') }
1212
let(:package) { 'unbound' }
1313
let(:conf_file) { "#{conf_dir}/unbound.conf" }
1414
let(:conf_d_dir) { "#{conf_dir}/conf.d" }
@@ -18,7 +18,7 @@
1818

1919
pidfile = nil
2020

21-
case facts[:os]['family']
21+
case os_facts[:os]['family']
2222
when 'Debian'
2323
pidfile = '/run/unbound.pid'
2424
let(:service) { 'unbound' }
@@ -54,15 +54,15 @@
5454
it { is_expected.to compile.with_all_deps }
5555
it { is_expected.to contain_class('unbound') }
5656

57-
it { is_expected.to contain_package(package) } if facts[:os]['family'] != 'OpenBSD'
57+
it { is_expected.to contain_package(package) } if os_facts[:os]['family'] != 'OpenBSD'
5858
it { is_expected.to contain_service(service) }
5959
it { is_expected.to contain_concat(conf_file) }
6060
it { is_expected.to contain_file(conf_dir) }
6161
it { is_expected.to contain_file(conf_d_dir) }
6262
it { is_expected.to contain_file(keys_d_dir) }
6363
it { is_expected.to contain_file(hints_file) }
6464

65-
context 'on Linux', if: facts[:kernel] == 'Linux' do
65+
context 'on Linux', if: os_facts[:kernel] == 'Linux' do
6666
it { is_expected.to contain_systemd__timer('roothints.timer') }
6767
end
6868

@@ -118,7 +118,7 @@
118118
end
119119

120120
context 'with access control configured' do
121-
let(:facts) { facts.merge(unbound_version: '1.6.1') }
121+
let(:facts) { os_facts.merge(unbound_version: '1.6.1') }
122122
let :params do
123123
{
124124
access_control: {
@@ -227,7 +227,7 @@
227227
end
228228

229229
context 'subnetcache' do
230-
let(:facts) { facts.merge(unbound_version: '1.6.1') }
230+
let(:facts) { os_facts.merge(unbound_version: '1.6.1') }
231231

232232
before { params.merge!(module_config: %w[subnetcache]) }
233233

@@ -249,7 +249,7 @@
249249
end
250250

251251
context 'subnetcache send-client-subnet' do
252-
let(:facts) { facts.merge(unbound_version: '1.6.1') }
252+
let(:facts) { os_facts.merge(unbound_version: '1.6.1') }
253253

254254
before do
255255
params.merge!(
@@ -407,7 +407,7 @@
407407
end
408408

409409
context 'ipsecmod disable' do
410-
let(:facts) { facts.merge(unbound_version: '1.6.4') }
410+
let(:facts) { os_facts.merge(unbound_version: '1.6.4') }
411411

412412
before do
413413
params.merge!(
@@ -437,7 +437,7 @@
437437
end
438438

439439
context 'ipsecmod default' do
440-
let(:facts) { facts.merge(unbound_version: '1.6.4') }
440+
let(:facts) { os_facts.merge(unbound_version: '1.6.4') }
441441

442442
before do
443443
params.merge!(
@@ -466,7 +466,7 @@
466466
end
467467

468468
context 'ipsecmod ipsecmod-hook' do
469-
let(:facts) { facts.merge(unbound_version: '1.6.4') }
469+
let(:facts) { os_facts.merge(unbound_version: '1.6.4') }
470470

471471
before do
472472
params.merge!(
@@ -495,7 +495,7 @@
495495
end
496496

497497
context 'ipsecmod ipsecmod_strict' do
498-
let(:facts) { facts.merge(unbound_version: '1.6.4') }
498+
let(:facts) { os_facts.merge(unbound_version: '1.6.4') }
499499

500500
before do
501501
params.merge!(
@@ -525,7 +525,7 @@
525525
end
526526

527527
context 'ipsecmod ipsecmod_max_ttl' do
528-
let(:facts) { facts.merge(unbound_version: '1.6.4') }
528+
let(:facts) { os_facts.merge(unbound_version: '1.6.4') }
529529

530530
before do
531531
params.merge!(
@@ -555,7 +555,7 @@
555555
end
556556

557557
context 'ipsecmod ipsecmod-ignore-bogus' do
558-
let(:facts) { facts.merge(unbound_version: '1.6.4') }
558+
let(:facts) { os_facts.merge(unbound_version: '1.6.4') }
559559

560560
before do
561561
params.merge!(
@@ -585,7 +585,7 @@
585585
end
586586

587587
context 'ipsecmod ipsecmod-whitelist' do
588-
let(:facts) { facts.merge(unbound_version: '1.6.4') }
588+
let(:facts) { os_facts.merge(unbound_version: '1.6.4') }
589589

590590
before do
591591
params.merge!(
@@ -893,7 +893,7 @@
893893
end
894894

895895
context 'custom log_identity passed to class' do
896-
let(:facts) { facts.merge(unbound_version: '1.6.1') }
896+
let(:facts) { os_facts.merge(unbound_version: '1.6.1') }
897897
let(:params) { { log_identity: 'bind' } }
898898

899899
it do
@@ -924,7 +924,7 @@
924924
end
925925

926926
context 'custom log_replies passed to class' do
927-
let(:facts) { facts.merge(unbound_version: '1.6.1') }
927+
let(:facts) { os_facts.merge(unbound_version: '1.6.1') }
928928
let(:params) { { log_replies: true } }
929929

930930
it do
@@ -951,7 +951,7 @@
951951

952952
it { is_expected.to contain_service(service).with_restart("#{control_path} reload") }
953953

954-
case facts[:os]['family']
954+
case os_facts[:os]['family']
955955
when 'FreeBSD'
956956
it { is_expected.to contain_exec('unbound-control-setup').with_command('/usr/local/sbin/unbound-control-setup -d /usr/local/etc/unbound') }
957957
when 'OpenBSD'

spec/defines/stub_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
describe 'unbound::stub' do
66
let(:title) { 'lab.example.com' }
77

8-
on_supported_os.each do |os, facts|
8+
on_supported_os.each do |os, os_facts|
99
context "on #{os}" do
10-
let(:facts) { facts }
10+
let(:facts) { os_facts }
1111

1212
context 'basic' do
1313
let(:params) do

0 commit comments

Comments
 (0)