From 1d42e45fce372c923cb2cc6362213c0bb2cc712c Mon Sep 17 00:00:00 2001 From: Trevor Vaughan Date: Wed, 2 Jun 2021 10:35:26 -0400 Subject: [PATCH] (SIMP-9709) Fix compliance spec tests (#79) * Fix compliance spec tests * Fix fixtures SIMP-9709 #close --- .fixtures.yml | 1 - spec/defines/server/section_spec.rb | 9 ++++++++- .../compliance_engine_enforce_spec.rb | 12 +++++++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 5d89bee..b03380f 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -16,7 +16,6 @@ fixtures: pki: https://github.com/simp/pupmod-simp-pki rsyslog: https://github.com/simp/pupmod-simp-rsyslog selinux_core: https://github.com/puppetlabs/puppetlabs-selinux_core - simp_firewalld: https://github.com/simp/pupmod-simp-simp_firewalld simp_options: https://github.com/simp/pupmod-simp-simp_options simp_firewalld: https://github.com/simp/pupmod-simp-simp_firewalld simplib: https://github.com/simp/pupmod-simp-simplib diff --git a/spec/defines/server/section_spec.rb b/spec/defines/server/section_spec.rb index 231b56d..0ca6852 100644 --- a/spec/defines/server/section_spec.rb +++ b/spec/defines/server/section_spec.rb @@ -5,7 +5,14 @@ context "on #{os}" do let(:title) { 'test' } - let(:facts) { os_facts } + let(:facts) { + _facts = os_facts + _facts[:os] ||= {} + _facts[:os]['selinux'] ||= {} + _facts[:os]['selinux']['enabled'] = true + + _facts + } let(:pre_condition) { 'include "::rsync::server"' diff --git a/spec/unit/compliance_engine/compliance_engine_enforce_spec.rb b/spec/unit/compliance_engine/compliance_engine_enforce_spec.rb index 3c355c1..2f7ccd6 100644 --- a/spec/unit/compliance_engine/compliance_engine_enforce_spec.rb +++ b/spec/unit/compliance_engine/compliance_engine_enforce_spec.rb @@ -33,11 +33,17 @@ context "on #{os}" do compliance_profiles.each do |target_profile| context "with compliance profile '#{target_profile}'" do - let(:facts){ - os_facts.merge({ + let(:facts) do + _facts = os_facts.merge({ :target_compliance_profile => target_profile }) - } + + _facts[:os] ||= {} + _facts[:os]['selinux'] ||= {} + _facts[:os]['selinux']['enabled'] = true + + _facts + end let(:pre_condition) {%( #{expected_classes.map{|c| %{include #{c}}}.join("\n")}