diff options
author | Thom May <thom@chef.io> | 2017-04-18 16:29:44 +0100 |
---|---|---|
committer | Thom May <thom@chef.io> | 2017-04-25 10:18:53 +0100 |
commit | c7aa5baef1621b5ccd8dd240befe71e34b84f931 (patch) | |
tree | 87d3e0c5e749664ccea0f47fe7d255f142ed8e22 /spec/integration | |
parent | eec35681949ef35d0f13f6f7425072327ddc4825 (diff) | |
download | chef-c7aa5baef1621b5ccd8dd240befe71e34b84f931.tar.gz |
Add tests for lazy load of cookbook files
Signed-off-by: Thom May <thom@may.lt>
Diffstat (limited to 'spec/integration')
-rw-r--r-- | spec/integration/client/client_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb index 00086c75ca..39c8b24f88 100644 --- a/spec/integration/client/client_spec.rb +++ b/spec/integration/client/client_spec.rb @@ -306,6 +306,7 @@ local_mode true cookbook_path "#{path_to('cookbooks')}" EOM result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z --profile-ruby", :cwd => chef_dir) + result.error! expect(File.exist?(path_to("config/local-mode-cache/cache/graph_profile.out"))).to be true end @@ -315,6 +316,7 @@ local_mode true cookbook_path "#{path_to('cookbooks')}" EOM result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", :cwd => chef_dir) + result.error! expect(File.exist?(path_to("config/local-mode-cache/cache/graph_profile.out"))).to be false end end @@ -464,6 +466,37 @@ end end end + when_the_repository "has a cookbook that deploys a file" do + before do + file "cookbooks/x/recipes/default.rb", <<-RECIPE +cookbook_file #{path_to('tempfile.txt').inspect} do + source "my_file" +end + RECIPE + + file "cookbooks/x/files/my_file", <<-FILE +this is my file + FILE + end + + [true, false].each do |lazy| + context "with no_lazy_load set to #{lazy}" do + it "should create the file" do + file "config/client.rb", <<EOM +no_lazy_load #{lazy} +local_mode true +cookbook_path "#{path_to('cookbooks')}" +EOM + result = shell_out("#{chef_client} -l debug -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", :cwd => chef_dir) + result.error! + + expect(IO.read(path_to("tempfile.txt")).strip).to eq("this is my file") + end + end + end + end + + when_the_repository "has a cookbook with an ohai plugin" do before do file "cookbooks/x/recipes/default.rb", <<-RECIPE |