summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Hemminger <hemminger@hotmail.com>2023-01-31 15:05:21 -0600
committerGitHub <noreply@github.com>2023-01-31 16:05:21 -0500
commit188364ff4da41dde97b0d9639bf55f0ac35158d9 (patch)
tree0fe97770138e62e1b0f5e680e4d99b0ddd0b9ae5
parentf206b887fa2f75d23f70ef866cfda14c0ecaa44f (diff)
downloadchef-188364ff4da41dde97b0d9639bf55f0ac35158d9.tar.gz
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 <hemminger@hotmail.com>
-rw-r--r--spec/unit/compliance/runner_spec.rb8
1 files changed, 8 insertions, 0 deletions
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" }