diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2021-01-12 11:52:53 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2021-01-12 11:52:53 -0800 |
commit | 4fa2a2e7e18aa3e671a1afbdb990ace908475a6c (patch) | |
tree | 015d70f321eb1100df317af6926f2e8d3475f65e /spec/unit/compliance | |
parent | 474bea9632c6863aa05bc3689f8d4d8d54e72c13 (diff) | |
download | chef-4fa2a2e7e18aa3e671a1afbdb990ace908475a6c.tar.gz |
Compliance phase: change the audit cb checker to use the recipes list on the node
The expanded_run_list doesn't capture any recipes which are not in the
run_list but are dynamically `include_recipe`'d. This change uses the
recipes list, which by the end of the run should be complete and
accurate.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/unit/compliance')
-rw-r--r-- | spec/unit/compliance/runner_spec.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/spec/unit/compliance/runner_spec.rb b/spec/unit/compliance/runner_spec.rb index d4d2ba563f..26c7008ccd 100644 --- a/spec/unit/compliance/runner_spec.rb +++ b/spec/unit/compliance/runner_spec.rb @@ -8,41 +8,40 @@ describe Chef::Compliance::Runner do described_class.new.tap do |r| r.node = node r.run_id = "my_run_id" - r.recipes = [] end end describe "#enabled?" do it "is true if the node attributes have audit profiles and the audit cookbook is not present" do node.normal["audit"]["profiles"]["ssh"] = { 'compliance': "base/ssh" } - runner.recipes = %w{ fancy_cookbook::fanciness tacobell::nachos } + node.automatic["recipes"] = %w{ fancy_cookbook::fanciness tacobell::nachos } expect(runner).to be_enabled end it "is false if the node attributes have audit profiles and the audit cookbook is present" do node.normal["audit"]["profiles"]["ssh"] = { 'compliance': "base/ssh" } - runner.recipes = %w{ audit::default fancy_cookbook::fanciness tacobell::nachos } + node.automatic["recipes"] = %w{ audit::default fancy_cookbook::fanciness tacobell::nachos } expect(runner).not_to be_enabled end it "is false if the node attributes do not have audit profiles and the audit cookbook is not present" do node.normal["audit"]["profiles"] = {} - runner.recipes = %w{ fancy_cookbook::fanciness tacobell::nachos } + node.automatic["recipes"] = %w{ fancy_cookbook::fanciness tacobell::nachos } expect(runner).not_to be_enabled end it "is false if the node attributes do not have audit profiles and the audit cookbook is present" do node.normal["audit"]["profiles"] = {} - runner.recipes = %w{ audit::default fancy_cookbook::fanciness tacobell::nachos } + node.automatic["recipes"] = %w{ audit::default fancy_cookbook::fanciness tacobell::nachos } expect(runner).not_to be_enabled end it "is false if the node attributes do not have audit attributes and the audit cookbook is not present" do - runner.recipes = %w{ fancy_cookbook::fanciness tacobell::nachos } + node.automatic["recipes"] = %w{ fancy_cookbook::fanciness tacobell::nachos } expect(runner).not_to be_enabled end end |