diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2017-01-23 12:17:58 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2017-01-24 16:48:36 -0800 |
commit | 021e2596ecdde398da4e286ee0d4876522253eb3 (patch) | |
tree | 53c96a68ad2ac15db7aa180e3b2f62bceae778c3 /spec/integration/client/client_spec.rb | |
parent | 6dbc75814a2ac434e60a46c848d223c04201be76 (diff) | |
download | chef-021e2596ecdde398da4e286ee0d4876522253eb3.tar.gz |
favor metadata.json over metadata.rb
make sure that if we have a metadata.rb that is not valid to read that
we never parse that and use compiled metadata.json instead.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/integration/client/client_spec.rb')
-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 da3a2b98e4..7a8059066a 100644 --- a/spec/integration/client/client_spec.rb +++ b/spec/integration/client/client_spec.rb @@ -46,6 +46,7 @@ describe "chef-client" do # we're running `chef-client` from the source tree and not the external one. # cf. CHEF-4914 let(:chef_client) { "ruby '#{chef_dir}/chef-client' --minimal-ohai" } + let(:chef_solo) { "ruby '#{chef_dir}/chef-solo' --minimal-ohai" } let(:critical_env_vars) { %w{_ORIGINAL_GEM_PATH GEM_PATH GEM_HOME GEM_ROOT BUNDLE_BIN_PATH BUNDLE_GEMFILE RUBYLIB RUBYOPT RUBY_ENGINE RUBY_ROOT RUBY_VERSION PATH}.map { |o| "#{o}=#{ENV[o]}" } .join(" ") } @@ -499,4 +500,36 @@ EOM expect(result.exitstatus).not_to eq(0) end end + + when_the_repository "has a cookbook with broken metadata.rb, but has metadata.json" do + before do + file "cookbooks/x/recipes/default.rb", "" + file "cookbooks/x/metadata.rb", <<EOM +name 'x' +version '0.0.1' +raise "TEH SADNESS" +EOM + file "cookbooks/x/metadata.json", <<EOM +{ + "name": "x", + "version": "0.0.1" +} +EOM + + file "config/client.rb", <<EOM +local_mode true +cookbook_path "#{path_to('cookbooks')}" +EOM + end + + it "the chef client run should succeed" do + command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", :cwd => chef_dir) + command.error! + end + + it "a chef-solo run should succeed" do + command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", :cwd => chef_dir) + command.error! + end + end end |