summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2021-07-13 20:33:05 -0700
committerTim Smith <tsmith84@gmail.com>2021-09-16 18:39:46 -0700
commit65e88a1720ca14089b2570b2135cfb85572bfbb5 (patch)
tree0eaffd5c760c05a896acd53b103a9dcfc63ddcca /spec
parentef0584b4c8fdc418438b40f93fbdea1de05a66d4 (diff)
downloadchef-65e88a1720ca14089b2570b2135cfb85572bfbb5.tar.gz
Deprecate the old policyfile compat mode
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/policy_builder/policyfile_spec.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/spec/unit/policy_builder/policyfile_spec.rb b/spec/unit/policy_builder/policyfile_spec.rb
index 6be0da8f4d..b430ea16e6 100644
--- a/spec/unit/policy_builder/policyfile_spec.rb
+++ b/spec/unit/policy_builder/policyfile_spec.rb
@@ -206,7 +206,7 @@ describe Chef::PolicyBuilder::Policyfile do
end
before do
- Chef::Config[:policy_document_native_api] = false
+ Chef::Config[:policy_document_native_api] = true
Chef::Config[:deployment_group] = "example-policy-stage"
allow(policy_builder).to receive(:api_service).and_return(api_service)
end
@@ -214,6 +214,8 @@ describe Chef::PolicyBuilder::Policyfile do
describe "when using compatibility mode (policy_document_native_api == false)" do
before do
+ Chef::Config[:policy_document_native_api] = false
+ Chef::Config[:treat_deprecation_warnings_as_errors] = false
Chef::Config[:deployment_group] = "example-policy-stage"
end
@@ -339,6 +341,10 @@ describe Chef::PolicyBuilder::Policyfile do
end
describe "validating the Policyfile.lock" do
+ before do
+ Chef::Config[:policy_group] = "policy-stage"
+ Chef::Config[:policy_name] = "example"
+ end
it "errors if the policyfile json contains any non-recipe items" do
parsed_policyfile_json["run_list"] = ["role[foo]"]
@@ -806,6 +812,10 @@ describe Chef::PolicyBuilder::Policyfile do
context "when using compatibility mode (policy_document_native_api == false)" do
let(:cookbook1_url) { "cookbooks/example1/#{example1_xyz_version}" }
let(:cookbook2_url) { "cookbooks/example2/#{example2_xyz_version}" }
+ before do
+ Chef::Config[:policy_document_native_api] = false
+ Chef::Config[:treat_deprecation_warnings_as_errors] = false
+ end
context "when the cookbooks don't exist on the server" do
include_examples "fetching cookbooks when they don't exist"