diff options
author | Tor Magnus Rakvåg <tm@intility.no> | 2017-09-28 11:08:00 +0200 |
---|---|---|
committer | Tor Magnus Rakvåg <tm@intility.no> | 2017-09-28 11:08:00 +0200 |
commit | 3756a09333bce1644babe0ed05d8725d364d9c1b (patch) | |
tree | 20bb4681b8afbb74424e18b4573221bedb5175dc /spec/unit/cookbook | |
parent | 85957c76e2981fca06c9377a1363a79e1277199d (diff) | |
download | chef-3756a09333bce1644babe0ed05d8725d364d9c1b.tar.gz |
only warn about skipping sync once
Signed-off-by: Tor Magnus Rakvåg <tm@intility.no>
Diffstat (limited to 'spec/unit/cookbook')
-rw-r--r-- | spec/unit/cookbook/synchronizer_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/unit/cookbook/synchronizer_spec.rb b/spec/unit/cookbook/synchronizer_spec.rb index 6578a9e670..d55c840269 100644 --- a/spec/unit/cookbook/synchronizer_spec.rb +++ b/spec/unit/cookbook/synchronizer_spec.rb @@ -116,9 +116,12 @@ describe Chef::CookbookSynchronizer do let(:no_lazy_load) { true } + let(:skip_cookbook_sync) { false } + let(:synchronizer) do Chef::Config[:no_lazy_load] = no_lazy_load Chef::Config[:file_cache_path] = "/file-cache" + Chef::Config[:skip_cookbook_sync] = skip_cookbook_sync Chef::CookbookSynchronizer.new(cookbook_manifest, events) end @@ -523,5 +526,30 @@ describe Chef::CookbookSynchronizer do end end end + + context "when Chef::Config[:skip_cookbook_sync] is true" do + let(:skip_cookbook_sync) { true } + + it "loads the cookbook files and warns the user that this isn't supported" do + expect(file_cache).to receive(:load). + with("cookbooks/cookbook_a/recipes/default.rb", false). + once. + and_return("/file-cache/cookbooks/cookbook_a/recipes/default.rb") + expect(file_cache).to receive(:load). + with("cookbooks/cookbook_a/attributes/default.rb", false). + once. + and_return("/file-cache/cookbooks/cookbook_a/attributes/default.rb") + expect(file_cache).to receive(:load). + with("cookbooks/cookbook_a/templates/default/apache2.conf.erb", false). + once. + and_return("/file-cache/cookbooks/cookbook_a/templates/default/apache2.conf.erb") + expect(file_cache).to receive(:load). + with("cookbooks/cookbook_a/files/default/megaman.conf", false). + once. + and_return("/file-cache/cookbooks/cookbook_a/files/default/megaman.conf") + expect(Chef::Log).to receive(:warn).with("skipping cookbook synchronization! DO NOT LEAVE THIS ENABLED IN PRODUCTION!!!").once + synchronizer.sync_cookbooks + end + end end end |