diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2019-04-29 15:10:36 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2019-04-29 15:10:36 -0700 |
commit | 688b72f47b4c3a23ca042336ea6c5d1f215ec263 (patch) | |
tree | afd7cea189a44758edae6b711be81d7e7f2d31d2 /spec | |
parent | 945b9f6636bb3236999ca43f313113bf74045d82 (diff) | |
download | chef-688b72f47b4c3a23ca042336ea6c5d1f215ec263.tar.gz |
Remove chef-* binstubs from chef gem
This is for the relicensing effort.
Note that this PR leaves the knife and ohai binstubs still in the
gem(s) while that discussion is still ongoing.
This PR extracts the binstubs to chef-binstubs gem which is not intended
to be redistributed outside of the omnibus chef binaries.
A blank gem for chef-binstubs has been pushed to rubygems.org for
obvious security concerns and so that bundler/rubygems can resolve
the gem
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/functional/shell_spec.rb | 5 | ||||
-rw-r--r-- | spec/functional/version_spec.rb | 4 | ||||
-rw-r--r-- | spec/integration/client/client_spec.rb | 22 | ||||
-rw-r--r-- | spec/integration/client/exit_code_spec.rb | 2 | ||||
-rw-r--r-- | spec/integration/client/ipv6_spec.rb | 4 | ||||
-rw-r--r-- | spec/integration/recipes/accumulator_spec.rb | 2 | ||||
-rw-r--r-- | spec/integration/recipes/lwrp_inline_resources_spec.rb | 2 | ||||
-rw-r--r-- | spec/integration/recipes/lwrp_spec.rb | 2 | ||||
-rw-r--r-- | spec/integration/recipes/notifies_spec.rb | 2 | ||||
-rw-r--r-- | spec/integration/recipes/notifying_block_spec.rb | 4 | ||||
-rw-r--r-- | spec/integration/recipes/remote_directory.rb | 2 | ||||
-rw-r--r-- | spec/integration/solo/solo_spec.rb | 4 |
12 files changed, 18 insertions, 37 deletions
diff --git a/spec/functional/shell_spec.rb b/spec/functional/shell_spec.rb index 3990f1afe0..dd0455fc9e 100644 --- a/spec/functional/shell_spec.rb +++ b/spec/functional/shell_spec.rb @@ -1,6 +1,6 @@ # # Author:: Daniel DeLeo (<dan@chef.io>) -# Copyright:: Copyright 2012-2017, Chef Software Inc. +# Copyright:: Copyright 2012-2019, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -82,8 +82,7 @@ describe Shell do require "pty" config = File.expand_path("shef-config.rb", CHEF_SPEC_DATA) - path_to_chef_shell = File.expand_path("../../../bin/chef-shell", __FILE__) - reader, writer, pid = PTY.spawn("#{path_to_chef_shell} -c #{config} #{options}") + reader, writer, pid = PTY.spawn("bundle exec chef-shell -c #{config} #{options}") read_until(reader, "chef (#{Chef::VERSION})>") yield reader, writer if block_given? writer.puts('"done"') diff --git a/spec/functional/version_spec.rb b/spec/functional/version_spec.rb index d968c36e8c..b12d235405 100644 --- a/spec/functional/version_spec.rb +++ b/spec/functional/version_spec.rb @@ -1,6 +1,6 @@ # # Author:: Serdar Sutay (<dan@chef.io>) -# Copyright:: Copyright 2013-2016, Chef Software Inc. +# Copyright:: Copyright 2013-2019, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,7 +28,7 @@ describe "Chef Versions" do binaries.each do |binary| it "#{binary} version should be sane" do - expect(shell_out!("ruby #{File.join("bin", binary)} -v", cwd: chef_dir).stdout.chomp).to match(/.*: #{Chef::VERSION}/) + expect(shell_out!("bundle exec #{binary} -v", cwd: chef_dir).stdout.chomp).to match(/.*: #{Chef::VERSION}/) end end diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb index 006839be3f..cde25662c1 100644 --- a/spec/integration/client/client_spec.rb +++ b/spec/integration/client/client_spec.rb @@ -45,10 +45,8 @@ describe "chef-client" do # machine that has omnibus chef installed. In that case we need to ensure # 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' --legacy-mode --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(" ") } + let(:chef_client) { "bundle exec chef-client --minimal-ohai" } + let(:chef_solo) { "bundle exec chef-solo --legacy-mode --minimal-ohai" } when_the_repository "has a cookbook with a no-op recipe" do before { file "cookbooks/x/recipes/default.rb", "" } @@ -62,22 +60,6 @@ describe "chef-client" do shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) end - it "should complete successfully with no other environment variables", skip: (Chef::Platform.windows?) do - file "config/client.rb", <<~EOM - local_mode true - cookbook_path "#{path_to('cookbooks')}" - EOM - - begin - result = shell_out("env -i #{critical_env_vars} #{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) - result.error! - rescue - Chef::Log.info "Bare invocation will have the following load-path." - Chef::Log.info shell_out!("env -i #{critical_env_vars} ruby -e 'puts $:'").stdout - raise - end - end - it "should complete successfully with --no-listen" do file "config/client.rb", <<~EOM local_mode true diff --git a/spec/integration/client/exit_code_spec.rb b/spec/integration/client/exit_code_spec.rb index 2e29502070..6600a65c9f 100644 --- a/spec/integration/client/exit_code_spec.rb +++ b/spec/integration/client/exit_code_spec.rb @@ -21,7 +21,7 @@ describe "chef-client" do # machine that has omnibus chef installed. In that case we need to ensure # 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' --no-fork --minimal-ohai" } + let(:chef_client) { "bundle exec chef-client --no-fork --minimal-ohai" } let(:critical_env_vars) { %w{PATH RUBYOPT BUNDLE_GEMFILE GEM_PATH}.map { |o| "#{o}=#{ENV[o]}" } .join(" ") } diff --git a/spec/integration/client/ipv6_spec.rb b/spec/integration/client/ipv6_spec.rb index 04154c296f..b97eb4e8b4 100644 --- a/spec/integration/client/ipv6_spec.rb +++ b/spec/integration/client/ipv6_spec.rb @@ -1,6 +1,6 @@ # # Author:: Daniel DeLeo (<dan@chef.io>) -# Copyright:: Copyright 2013-2016, Chef Software Inc. +# Copyright:: Copyright 2013-2019, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -75,7 +75,7 @@ describe "chef-client" do let(:chef_dir) { File.join(File.dirname(__FILE__), "..", "..", "..", "bin") } - let(:chef_client_cmd) { %Q{ruby '#{chef_dir}/chef-client' --minimal-ohai -c "#{path_to('config/client.rb')}" -lwarn} } + let(:chef_client_cmd) { %Q{bundle exec chef-client --minimal-ohai -c "#{path_to('config/client.rb')}" -lwarn} } after do FileUtils.rm_rf(cache_path) diff --git a/spec/integration/recipes/accumulator_spec.rb b/spec/integration/recipes/accumulator_spec.rb index 65a05fcdc5..d19d8637bb 100644 --- a/spec/integration/recipes/accumulator_spec.rb +++ b/spec/integration/recipes/accumulator_spec.rb @@ -16,7 +16,7 @@ describe "Accumulators" do # machine that has omnibus chef installed. In that case we need to ensure # 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_client) { "bundle exec chef-client --minimal-ohai" } let(:aliases_temppath) do t = Tempfile.new("chef_accumulator_test") diff --git a/spec/integration/recipes/lwrp_inline_resources_spec.rb b/spec/integration/recipes/lwrp_inline_resources_spec.rb index 2f4ef92f31..6bc857df48 100644 --- a/spec/integration/recipes/lwrp_inline_resources_spec.rb +++ b/spec/integration/recipes/lwrp_inline_resources_spec.rb @@ -16,7 +16,7 @@ describe "LWRPs with inline resources" do # machine that has omnibus chef installed. In that case we need to ensure # 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_client) { "bundle exec chef-client --minimal-ohai" } context "with a use_inline_resources provider with 'def action_a' instead of action :a" do class LwrpInlineResourcesTest < Chef::Resource diff --git a/spec/integration/recipes/lwrp_spec.rb b/spec/integration/recipes/lwrp_spec.rb index b5af6978ac..ce2861d43b 100644 --- a/spec/integration/recipes/lwrp_spec.rb +++ b/spec/integration/recipes/lwrp_spec.rb @@ -16,7 +16,7 @@ describe "LWRPs" do # machine that has omnibus chef installed. In that case we need to ensure # 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_client) { "bundle exec chef-client --minimal-ohai" } when_the_repository "has a cookbook named l-w-r-p" do before do diff --git a/spec/integration/recipes/notifies_spec.rb b/spec/integration/recipes/notifies_spec.rb index 0df7aa311f..860a109e4d 100644 --- a/spec/integration/recipes/notifies_spec.rb +++ b/spec/integration/recipes/notifies_spec.rb @@ -6,7 +6,7 @@ describe "notifications" do include Chef::Mixin::ShellOut let(:chef_dir) { File.expand_path("../../../../bin", __FILE__) } - let(:chef_client) { "ruby '#{chef_dir}/chef-client' --minimal-ohai" } + let(:chef_client) { "bundle exec chef-client --minimal-ohai" } when_the_repository "notifies a nameless resource" do before do diff --git a/spec/integration/recipes/notifying_block_spec.rb b/spec/integration/recipes/notifying_block_spec.rb index 6c50854038..753e81dadb 100644 --- a/spec/integration/recipes/notifying_block_spec.rb +++ b/spec/integration/recipes/notifying_block_spec.rb @@ -1,6 +1,6 @@ # # Author:: John Keiser (<jkeiser@chef.io>) -# Copyright:: Copyright 2013-2016, Chef Software Inc. +# Copyright:: Copyright 2013-2019, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,7 @@ describe "notifying_block" do include Chef::Mixin::ShellOut let(:chef_dir) { File.expand_path("../../../../bin", __FILE__) } - let(:chef_client) { "ruby '#{chef_dir}/chef-client' --minimal-ohai" } + let(:chef_client) { "bundle exec chef-client --minimal-ohai" } when_the_repository "notifying_block test one" do before do diff --git a/spec/integration/recipes/remote_directory.rb b/spec/integration/recipes/remote_directory.rb index a0e3e23ef3..6f67a38fc8 100644 --- a/spec/integration/recipes/remote_directory.rb +++ b/spec/integration/recipes/remote_directory.rb @@ -16,7 +16,7 @@ describe Chef::Resource::RemoteDirectory do # machine that has omnibus chef installed. In that case we need to ensure # 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_client) { "bundle exec chef-client --minimal-ohai" } when_the_repository "has a cookbook with a source_dir with two subdirectories, each with one file and subdir in a different alphabetical order" do before do diff --git a/spec/integration/solo/solo_spec.rb b/spec/integration/solo/solo_spec.rb index efd889c5d0..a098256d36 100644 --- a/spec/integration/solo/solo_spec.rb +++ b/spec/integration/solo/solo_spec.rb @@ -16,7 +16,7 @@ describe "chef-solo" do let(:cookbook_ancient_100_metadata_rb) { cb_metadata("ancient", "1.0.0") } - let(:chef_solo) { "ruby bin/chef-solo --legacy-mode --minimal-ohai" } + let(:chef_solo) { "bundle exec chef-solo --legacy-mode --minimal-ohai" } when_the_repository "creates nodes" do let(:nodes_dir) { File.join(@repository_dir, "nodes") } @@ -26,7 +26,7 @@ describe "chef-solo" do file "config/solo.rb", <<~EOM chef_repo_path "#{@repository_dir}" EOM - result = shell_out("ruby bin/chef-solo -c \"#{path_to('config/solo.rb')}\" -l debug", cwd: chef_dir) + result = shell_out("bundle exec chef-solo -c \"#{path_to('config/solo.rb')}\" -l debug", cwd: chef_dir) result.error! end |