From 188364ff4da41dde97b0d9639bf55f0ac35158d9 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Tue, 31 Jan 2023 15:05:21 -0600 Subject: add missing compliance phase test (#13471) * add missing test Customer ran into this scenario where audit cookbook is present due to base dependencies, profiles are set to pull from automate. CB is using policyfile and setting in kitchen.yml attributes: audit: compliance_phase: false to avoid run failures in test-kitchen. Compliance phase still runs though. Signed-off-by: Corey Hemminger --- spec/unit/compliance/runner_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/unit/compliance/runner_spec.rb b/spec/unit/compliance/runner_spec.rb index e8a08abfc1..bc9286cf46 100644 --- a/spec/unit/compliance/runner_spec.rb +++ b/spec/unit/compliance/runner_spec.rb @@ -49,6 +49,14 @@ describe Chef::Compliance::Runner do expect(runner).not_to be_enabled end + it "is false if the node attributes have audit profiles and the audit cookbook is present, and the complince mode attribute is false" do + stub_const("::Reporter::ChefAutomate", true) + node.normal["audit"]["profiles"]["ssh"] = { 'compliance': "base/ssh" } + node.normal["audit"]["compliance_phase"] = false + + expect(runner).not_to be_enabled + end + it "is true if the node attributes have audit profiles and the audit cookbook is present, and the complince mode attribute is true" do stub_const("::Reporter::ChefAutomate", true) node.normal["audit"]["profiles"]["ssh"] = { 'compliance': "base/ssh" } -- cgit v1.2.1