summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorPete Higgins <pete@peterhiggins.org>2020-11-20 17:47:04 -0800
committerPete Higgins <pete@peterhiggins.org>2020-12-01 16:12:04 -0800
commitf52ed3298edb9f77500d63e01cd8bf7bdd6c34e8 (patch)
tree42888df2b89dd4e779e4276d1403cfe3bc8da997 /spec
parent902bd99f7f2a0c468aa987e9bcf190027df658d9 (diff)
downloadchef-f52ed3298edb9f77500d63e01cd8bf7bdd6c34e8.tar.gz
Warn if unsupported audit-cookbook config values are present.
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/audit/runner_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/unit/audit/runner_spec.rb b/spec/unit/audit/runner_spec.rb
index f227742b6c..45fee29734 100644
--- a/spec/unit/audit/runner_spec.rb
+++ b/spec/unit/audit/runner_spec.rb
@@ -88,4 +88,26 @@ describe Chef::Audit::Runner do
expect { runner.inspec_profiles }.to raise_error(/Inspec profiles specified in an unrecognized format, expected a hash of hashes./)
end
end
+
+ describe "#warn_for_deprecated_config_values!" do
+ it "logs a warning when deprecated config values are present" do
+ node.default["audit"]["owner"] = "my_org"
+ node.default["audit"]["inspec_version"] = "90210"
+
+ expect(logger).to receive(:warn).with(/config values 'inspec_version', 'owner' are not supported/)
+
+ runner.warn_for_deprecated_config_values!
+ end
+
+ it "does not log a warning with no deprecated config values" do
+ node.default["audit"]["profiles"]["linux-baseline"] = {
+ 'compliance': "user/linux-baseline",
+ 'version': "2.1.0",
+ }
+
+ expect(logger).not_to receive(:warn)
+
+ runner.warn_for_deprecated_config_values!
+ end
+ end
end