diff options
author | Corey Hemminger <hemminger@hotmail.com> | 2023-01-31 15:05:21 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-31 16:05:21 -0500 |
commit | 188364ff4da41dde97b0d9639bf55f0ac35158d9 (patch) | |
tree | 0fe97770138e62e1b0f5e680e4d99b0ddd0b9ae5 | |
parent | f206b887fa2f75d23f70ef866cfda14c0ecaa44f (diff) | |
download | chef-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.rb | 8 |
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" } |