Skip to content

Commit

Permalink
(SIMP-MAINT) Compliance engine test update (#43)
Browse files Browse the repository at this point in the history
Updated to align with the latest tests
  • Loading branch information
trevor-vaughan authored and lnemsick-simp committed Aug 5, 2019
1 parent 07d1a1a commit 2e65f1d
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions spec/unit/compliance_engine/compliance_engine_enforce_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,21 @@
# This needs to be well defined since we can also manipulate defined type
# defaults
expected_classes = [
'simp_options',
'simp_options'
]

allowed_failures = {
'documented_missing_parameters' => [],
'documented_missing_resources' => []
'documented_missing_parameters' => [
] + expected_classes.map{|c| Regexp.new("^(?!#{c}(::.*)?)")},
'documented_missing_resources' => [
] + expected_classes.map{|c| Regexp.new("^(?!#{c}(::.*)?)")}
}

on_supported_os.each do |os, os_facts|
if ENV['RSPEC_COMPLIANCE_ENGINE_OS']
next unless os.match?(Regexp.new(ENV['RSPEC_COMPLIANCE_ENGINE_OS']))
end

context "on #{os}" do
compliance_profiles.each do |target_profile|
context "with compliance profile '#{target_profile}'" do
Expand Down Expand Up @@ -89,9 +95,24 @@
it "should have no issues with the '#{report_section}' report" do
if compliance_profile_data[report_section]
# This just gets us a good print out of what went wrong
expect(
compliance_profile_data[report_section] - Array(allowed_failures[report_section])
).to eq([])
compliance_profile_data[report_section].delete_if{ |item|
rm = false

Array(allowed_failures[report_section]).each do |allowed|
if allowed.is_a?(Regexp)
if allowed.match?(item)
rm = true
break
end
else
rm = (allowed == item)
end
end

rm
}

expect(compliance_profile_data[report_section]).to eq([])
end
end
end
Expand Down

0 comments on commit 2e65f1d

Please # to comment.