Skip to content

Commit

Permalink
(SIMP-9709) Fix compliance spec tests (#79)
Browse files Browse the repository at this point in the history
* Fix compliance spec tests
* Fix fixtures

SIMP-9709 #close
  • Loading branch information
trevor-vaughan authored Jun 2, 2021
1 parent 253a009 commit 1d42e45
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
1 change: 0 additions & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion spec/defines/server/section_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"'
Expand Down
12 changes: 9 additions & 3 deletions spec/unit/compliance_engine/compliance_engine_enforce_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")}
Expand Down

0 comments on commit 1d42e45

Please sign in to comment.