summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorChef Expeditor <chef-ci@chef.io>2021-03-11 17:45:48 +0000
committerMarc A. Paradise <marc.paradise@gmail.com>2021-03-31 13:52:49 -0400
commit01c6a9e1753bd4b2166efe747151ba8700ebc0f5 (patch)
tree55f16085d89859139211bf6d2b8fd2dbcf4633b0 /spec
parent497dd4af19ea7dff9a72d704a1de8e9be36b2996 (diff)
downloadchef-01c6a9e1753bd4b2166efe747151ba8700ebc0f5.tar.gz
Move knife to its own gem
This moves knife into /knife, in the same way that chef-utils and chef-config are separated. NOTES: == File History == If you see this message as the first message in the history of an knife file, you can see the complete history by using 'git log --follow', 'git config log.follow true' to make it the default behavior in this repository, or 'git config --globa log.follow true' to make it the global default. == API Changes == At the API level, there is one breaking change: CookbookSiteStreamingUploader has been moved out of chef and into knife/core. There were a combination of reasons we chose this path: - CookbookSiteStreamingUploader (CSSU) is only used within Knife. - CookbookSiteStreamingUploader (CSSU) references the command Chef::Knife::CookbookMetadata in order to generate a metadata file for the cookbook to upload - Chef::Knife::CookbookMetadata is no longer available to Chef:: because Knife has been moved to its own gem. Knife gem depends on the Chef gem, so Chef can't depend on something in Knife. A search for usage in related projects (berks, chef-cli) and the Internet at large shows that there are no known external consumers of CSSU. For now, we'll move this class into Knife::Core, as it's going to be faster than splitting off the metadata generation and time is a concern. If we find that we need the metadata generation in chef/ proper, we should evaluate decoupling that functionality from Knife::CookbookMetadata and exposing it via something like `Chef::Cookbook::Metadata#from_cookbook_files` == spec changes == The specs are kept in their existing locations, though we have separated out a `knife_spec_helper` so that we can ensure knife is not directly accessing chef requires; and chef is relying on knife's at all. We also now clear gem paths with each test, to force gem state to reset. This works around a problem where a combination of tests is corrupting the internal Gem state, causing failures in rubygems_spec. See branch `mp/broken-gems` for many more details around findings so far. Signed-off-by: Marc A. Paradise <marc.paradise@gmail.com>
Diffstat (limited to 'spec')
-rw-r--r--spec/functional/knife/configure_spec.rb2
-rw-r--r--spec/functional/knife/cookbook_delete_spec.rb2
-rw-r--r--spec/functional/knife/exec_spec.rb2
-rw-r--r--spec/functional/knife/rehash_spec.rb2
-rw-r--r--spec/functional/knife/ssh_spec.rb2
-rw-r--r--spec/functional/knife/version_spec.rb26
-rw-r--r--spec/functional/version_spec.rb2
-rw-r--r--spec/integration/knife/chef_fs_data_store_spec.rb2
-rw-r--r--spec/integration/knife/chef_repo_path_spec.rb2
-rw-r--r--spec/integration/knife/chef_repository_file_system_spec.rb2
-rw-r--r--spec/integration/knife/chefignore_spec.rb2
-rw-r--r--spec/integration/knife/client_bulk_delete_spec.rb2
-rw-r--r--spec/integration/knife/client_create_spec.rb2
-rw-r--r--spec/integration/knife/client_delete_spec.rb2
-rw-r--r--spec/integration/knife/client_key_create_spec.rb2
-rw-r--r--spec/integration/knife/client_key_delete_spec.rb2
-rw-r--r--spec/integration/knife/client_key_list_spec.rb2
-rw-r--r--spec/integration/knife/client_key_show_spec.rb2
-rw-r--r--spec/integration/knife/client_list_spec.rb2
-rw-r--r--spec/integration/knife/client_show_spec.rb2
-rw-r--r--spec/integration/knife/common_options_spec.rb2
-rw-r--r--spec/integration/knife/config_list_spec.rb2
-rw-r--r--spec/integration/knife/config_show_spec.rb2
-rw-r--r--spec/integration/knife/config_use_spec.rb2
-rw-r--r--spec/integration/knife/cookbook_api_ipv6_spec.rb6
-rw-r--r--spec/integration/knife/cookbook_bulk_delete_spec.rb2
-rw-r--r--spec/integration/knife/cookbook_download_spec.rb2
-rw-r--r--spec/integration/knife/cookbook_list_spec.rb2
-rw-r--r--spec/integration/knife/cookbook_show_spec.rb2
-rw-r--r--spec/integration/knife/cookbook_upload_spec.rb2
-rw-r--r--spec/integration/knife/data_bag_create_spec.rb2
-rw-r--r--spec/integration/knife/data_bag_delete_spec.rb2
-rw-r--r--spec/integration/knife/data_bag_edit_spec.rb2
-rw-r--r--spec/integration/knife/data_bag_from_file_spec.rb2
-rw-r--r--spec/integration/knife/data_bag_list_spec.rb2
-rw-r--r--spec/integration/knife/data_bag_show_spec.rb2
-rw-r--r--spec/integration/knife/delete_spec.rb2
-rw-r--r--spec/integration/knife/deps_spec.rb2
-rw-r--r--spec/integration/knife/diff_spec.rb2
-rw-r--r--spec/integration/knife/download_spec.rb2
-rw-r--r--spec/integration/knife/environment_compare_spec.rb2
-rw-r--r--spec/integration/knife/environment_create_spec.rb2
-rw-r--r--spec/integration/knife/environment_delete_spec.rb2
-rw-r--r--spec/integration/knife/environment_from_file_spec.rb2
-rw-r--r--spec/integration/knife/environment_list_spec.rb2
-rw-r--r--spec/integration/knife/environment_show_spec.rb2
-rw-r--r--spec/integration/knife/list_spec.rb2
-rw-r--r--spec/integration/knife/node_bulk_delete_spec.rb2
-rw-r--r--spec/integration/knife/node_create_spec.rb2
-rw-r--r--spec/integration/knife/node_delete_spec.rb2
-rw-r--r--spec/integration/knife/node_environment_set_spec.rb2
-rw-r--r--spec/integration/knife/node_from_file_spec.rb2
-rw-r--r--spec/integration/knife/node_list_spec.rb2
-rw-r--r--spec/integration/knife/node_run_list_add_spec.rb2
-rw-r--r--spec/integration/knife/node_run_list_remove_spec.rb2
-rw-r--r--spec/integration/knife/node_run_list_set_spec.rb2
-rw-r--r--spec/integration/knife/node_show_spec.rb2
-rw-r--r--spec/integration/knife/raw_spec.rb2
-rw-r--r--spec/integration/knife/redirection_spec.rb2
-rw-r--r--spec/integration/knife/role_bulk_delete_spec.rb2
-rw-r--r--spec/integration/knife/role_create_spec.rb2
-rw-r--r--spec/integration/knife/role_delete_spec.rb2
-rw-r--r--spec/integration/knife/role_from_file_spec.rb2
-rw-r--r--spec/integration/knife/role_list_spec.rb2
-rw-r--r--spec/integration/knife/role_show_spec.rb2
-rw-r--r--spec/integration/knife/search_node_spec.rb2
-rw-r--r--spec/integration/knife/show_spec.rb2
-rw-r--r--spec/integration/knife/upload_spec.rb2
-rw-r--r--spec/knife_spec_helper.rb245
-rw-r--r--spec/spec_helper.rb15
-rw-r--r--spec/support/lib/chef/resource/with_state.rb1
-rw-r--r--spec/support/lib/chef/resource/zen_follower.rb1
-rw-r--r--spec/support/lib/chef/resource/zen_master.rb1
-rw-r--r--spec/support/platform_helpers.rb2
-rw-r--r--spec/support/shared/integration/integration_helper.rb1
-rw-r--r--spec/unit/application/knife_spec.rb2
-rw-r--r--spec/unit/knife/bootstrap/chef_vault_handler_spec.rb2
-rw-r--r--spec/unit/knife/bootstrap/client_builder_spec.rb2
-rw-r--r--spec/unit/knife/bootstrap/train_connector_spec.rb2
-rw-r--r--spec/unit/knife/bootstrap_spec.rb4
-rw-r--r--spec/unit/knife/client_bulk_delete_spec.rb2
-rw-r--r--spec/unit/knife/client_create_spec.rb2
-rw-r--r--spec/unit/knife/client_delete_spec.rb2
-rw-r--r--spec/unit/knife/client_edit_spec.rb2
-rw-r--r--spec/unit/knife/client_list_spec.rb2
-rw-r--r--spec/unit/knife/client_reregister_spec.rb2
-rw-r--r--spec/unit/knife/client_show_spec.rb2
-rw-r--r--spec/unit/knife/configure_client_spec.rb2
-rw-r--r--spec/unit/knife/configure_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_bulk_delete_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_delete_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_download_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_list_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_metadata_from_file_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_metadata_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_show_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_upload_spec.rb2
-rw-r--r--spec/unit/knife/core/bootstrap_context_spec.rb2
-rw-r--r--spec/unit/knife/core/cookbook_scm_repo_spec.rb2
-rw-r--r--spec/unit/knife/core/cookbook_site_streaming_uploader_spec.rb (renamed from spec/unit/cookbook_site_streaming_uploader_spec.rb)42
-rw-r--r--spec/unit/knife/core/gem_glob_loader_spec.rb39
-rw-r--r--spec/unit/knife/core/hashed_command_loader_spec.rb2
-rw-r--r--spec/unit/knife/core/node_editor_spec.rb2
-rw-r--r--spec/unit/knife/core/object_loader_spec.rb2
-rw-r--r--spec/unit/knife/core/status_presenter_spec.rb2
-rw-r--r--spec/unit/knife/core/subcommand_loader_spec.rb2
-rw-r--r--spec/unit/knife/core/ui_spec.rb2
-rw-r--r--spec/unit/knife/core/windows_bootstrap_context_spec.rb2
-rw-r--r--spec/unit/knife/data_bag_create_spec.rb2
-rw-r--r--spec/unit/knife/data_bag_edit_spec.rb2
-rw-r--r--spec/unit/knife/data_bag_from_file_spec.rb2
-rw-r--r--spec/unit/knife/data_bag_secret_options_spec.rb2
-rw-r--r--spec/unit/knife/data_bag_show_spec.rb2
-rw-r--r--spec/unit/knife/environment_compare_spec.rb2
-rw-r--r--spec/unit/knife/environment_create_spec.rb2
-rw-r--r--spec/unit/knife/environment_delete_spec.rb2
-rw-r--r--spec/unit/knife/environment_edit_spec.rb2
-rw-r--r--spec/unit/knife/environment_from_file_spec.rb2
-rw-r--r--spec/unit/knife/environment_list_spec.rb2
-rw-r--r--spec/unit/knife/environment_show_spec.rb2
-rw-r--r--spec/unit/knife/key_create_spec.rb2
-rw-r--r--spec/unit/knife/key_delete_spec.rb2
-rw-r--r--spec/unit/knife/key_edit_spec.rb2
-rw-r--r--spec/unit/knife/key_helper.rb2
-rw-r--r--spec/unit/knife/key_list_spec.rb2
-rw-r--r--spec/unit/knife/key_show_spec.rb2
-rw-r--r--spec/unit/knife/node_bulk_delete_spec.rb2
-rw-r--r--spec/unit/knife/node_delete_spec.rb2
-rw-r--r--spec/unit/knife/node_edit_spec.rb2
-rw-r--r--spec/unit/knife/node_environment_set_spec.rb2
-rw-r--r--spec/unit/knife/node_from_file_spec.rb2
-rw-r--r--spec/unit/knife/node_list_spec.rb2
-rw-r--r--spec/unit/knife/node_policy_set_spec.rb2
-rw-r--r--spec/unit/knife/node_run_list_add_spec.rb2
-rw-r--r--spec/unit/knife/node_run_list_remove_spec.rb2
-rw-r--r--spec/unit/knife/node_run_list_set_spec.rb2
-rw-r--r--spec/unit/knife/node_show_spec.rb2
-rw-r--r--spec/unit/knife/org_create_spec.rb2
-rw-r--r--spec/unit/knife/org_delete_spec.rb2
-rw-r--r--spec/unit/knife/org_edit_spec.rb2
-rw-r--r--spec/unit/knife/org_list_spec.rb2
-rw-r--r--spec/unit/knife/org_show_spec.rb2
-rw-r--r--spec/unit/knife/org_user_add_spec.rb2
-rw-r--r--spec/unit/knife/raw_spec.rb2
-rw-r--r--spec/unit/knife/role_bulk_delete_spec.rb2
-rw-r--r--spec/unit/knife/role_create_spec.rb2
-rw-r--r--spec/unit/knife/role_delete_spec.rb2
-rw-r--r--spec/unit/knife/role_edit_spec.rb2
-rw-r--r--spec/unit/knife/role_env_run_list_add_spec.rb2
-rw-r--r--spec/unit/knife/role_env_run_list_clear_spec.rb2
-rw-r--r--spec/unit/knife/role_env_run_list_remove_spec.rb2
-rw-r--r--spec/unit/knife/role_env_run_list_replace_spec.rb2
-rw-r--r--spec/unit/knife/role_env_run_list_set_spec.rb2
-rw-r--r--spec/unit/knife/role_from_file_spec.rb2
-rw-r--r--spec/unit/knife/role_list_spec.rb2
-rw-r--r--spec/unit/knife/role_run_list_add_spec.rb2
-rw-r--r--spec/unit/knife/role_run_list_clear_spec.rb2
-rw-r--r--spec/unit/knife/role_run_list_remove_spec.rb2
-rw-r--r--spec/unit/knife/role_run_list_replace_spec.rb2
-rw-r--r--spec/unit/knife/role_run_list_set_spec.rb2
-rw-r--r--spec/unit/knife/role_show_spec.rb2
-rw-r--r--spec/unit/knife/ssh_spec.rb2
-rw-r--r--spec/unit/knife/ssl_check_spec.rb2
-rw-r--r--spec/unit/knife/ssl_fetch_spec.rb2
-rw-r--r--spec/unit/knife/status_spec.rb2
-rw-r--r--spec/unit/knife/supermarket_download_spec.rb2
-rw-r--r--spec/unit/knife/supermarket_install_spec.rb3
-rw-r--r--spec/unit/knife/supermarket_list_spec.rb2
-rw-r--r--spec/unit/knife/supermarket_search_spec.rb2
-rw-r--r--spec/unit/knife/supermarket_share_spec.rb12
-rw-r--r--spec/unit/knife/supermarket_unshare_spec.rb2
-rw-r--r--spec/unit/knife/tag_create_spec.rb2
-rw-r--r--spec/unit/knife/tag_delete_spec.rb2
-rw-r--r--spec/unit/knife/tag_list_spec.rb2
-rw-r--r--spec/unit/knife/user_create_spec.rb2
-rw-r--r--spec/unit/knife/user_delete_spec.rb2
-rw-r--r--spec/unit/knife/user_edit_spec.rb2
-rw-r--r--spec/unit/knife/user_list_spec.rb2
-rw-r--r--spec/unit/knife/user_password_spec.rb2
-rw-r--r--spec/unit/knife/user_reregister_spec.rb2
-rw-r--r--spec/unit/knife/user_show_spec.rb2
-rw-r--r--spec/unit/knife_spec.rb2
-rw-r--r--spec/unit/provider/service/arch_service_spec.rb1
-rw-r--r--spec/unit/provider/service/debian_service_spec.rb1
184 files changed, 522 insertions, 214 deletions
diff --git a/spec/functional/knife/configure_spec.rb b/spec/functional/knife/configure_spec.rb
index 8f2a5b4d6e..402e988132 100644
--- a/spec/functional/knife/configure_spec.rb
+++ b/spec/functional/knife/configure_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/configure"
diff --git a/spec/functional/knife/cookbook_delete_spec.rb b/spec/functional/knife/cookbook_delete_spec.rb
index 650db0ede5..f25999f0fc 100644
--- a/spec/functional/knife/cookbook_delete_spec.rb
+++ b/spec/functional/knife/cookbook_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "tiny_server"
describe Chef::Knife::CookbookDelete do
diff --git a/spec/functional/knife/exec_spec.rb b/spec/functional/knife/exec_spec.rb
index 3905798317..267fe8492e 100644
--- a/spec/functional/knife/exec_spec.rb
+++ b/spec/functional/knife/exec_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "tiny_server"
describe Chef::Knife::Exec do
diff --git a/spec/functional/knife/rehash_spec.rb b/spec/functional/knife/rehash_spec.rb
index 8f59eec270..a4b7e5507c 100644
--- a/spec/functional/knife/rehash_spec.rb
+++ b/spec/functional/knife/rehash_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/rehash"
require "chef/knife/core/subcommand_loader"
diff --git a/spec/functional/knife/ssh_spec.rb b/spec/functional/knife/ssh_spec.rb
index 1d4aff15b5..5a29f995f8 100644
--- a/spec/functional/knife/ssh_spec.rb
+++ b/spec/functional/knife/ssh_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "tiny_server"
describe Chef::Knife::Ssh do
diff --git a/spec/functional/knife/version_spec.rb b/spec/functional/knife/version_spec.rb
new file mode 100644
index 0000000000..b024cc1cda
--- /dev/null
+++ b/spec/functional/knife/version_spec.rb
@@ -0,0 +1,26 @@
+# Copyright:: Copyright (c) Chef Software Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+require "knife_spec_helper"
+require "chef/mixin/shell_out"
+
+describe "Knife Version", :executables do
+ include Chef::Mixin::ShellOut
+ let(:knife_dir) { File.join(__dir__, "..", "..", "..", "knife") }
+ xit "should be sane" do
+ expect(shell_out!("bundle exec knife -v", cwd: knife_dir).stdout.chomp).to match(/.*: #{Chef::Knife::VERSION}/)
+ end
+end
+
diff --git a/spec/functional/version_spec.rb b/spec/functional/version_spec.rb
index 5d0f0fce43..3b348ed024 100644
--- a/spec/functional/version_spec.rb
+++ b/spec/functional/version_spec.rb
@@ -25,7 +25,7 @@ describe "Chef Versions", :executables do
include Chef::Mixin::ShellOut
let(:chef_dir) { File.join(__dir__, "..", "..") }
- binaries = [ ChefUtils::Dist::Infra::CLIENT, "chef-shell", "chef-apply", "knife", ChefUtils::Dist::Solo::EXEC ]
+ binaries = [ ChefUtils::Dist::Infra::CLIENT, "chef-shell", "chef-apply", ChefUtils::Dist::Solo::EXEC ]
binaries.each do |binary|
it "#{binary} version should be sane" do
diff --git a/spec/integration/knife/chef_fs_data_store_spec.rb b/spec/integration/knife/chef_fs_data_store_spec.rb
index 6e04684c33..fda06164a4 100644
--- a/spec/integration/knife/chef_fs_data_store_spec.rb
+++ b/spec/integration/knife/chef_fs_data_store_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "chef/knife/list"
require "chef/knife/delete"
diff --git a/spec/integration/knife/chef_repo_path_spec.rb b/spec/integration/knife/chef_repo_path_spec.rb
index ac7dae15f0..27b45ac428 100644
--- a/spec/integration/knife/chef_repo_path_spec.rb
+++ b/spec/integration/knife/chef_repo_path_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
require "chef/knife/list"
diff --git a/spec/integration/knife/chef_repository_file_system_spec.rb b/spec/integration/knife/chef_repository_file_system_spec.rb
index 295efc0c3a..9a129dcb98 100644
--- a/spec/integration/knife/chef_repository_file_system_spec.rb
+++ b/spec/integration/knife/chef_repository_file_system_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "chef/knife/list"
require "chef/knife/show"
diff --git a/spec/integration/knife/chefignore_spec.rb b/spec/integration/knife/chefignore_spec.rb
index eccd38d928..f111cd56e1 100644
--- a/spec/integration/knife/chefignore_spec.rb
+++ b/spec/integration/knife/chefignore_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "chef/knife/list"
require "chef/knife/show"
diff --git a/spec/integration/knife/client_bulk_delete_spec.rb b/spec/integration/knife/client_bulk_delete_spec.rb
index 5c0ff94867..b7733f638d 100644
--- a/spec/integration/knife/client_bulk_delete_spec.rb
+++ b/spec/integration/knife/client_bulk_delete_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/client_create_spec.rb b/spec/integration/knife/client_create_spec.rb
index 2e48cde7ab..3898ff9d24 100644
--- a/spec/integration/knife/client_create_spec.rb
+++ b/spec/integration/knife/client_create_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
require "openssl"
diff --git a/spec/integration/knife/client_delete_spec.rb b/spec/integration/knife/client_delete_spec.rb
index 76a3b9a686..057561eaea 100644
--- a/spec/integration/knife/client_delete_spec.rb
+++ b/spec/integration/knife/client_delete_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/client_key_create_spec.rb b/spec/integration/knife/client_key_create_spec.rb
index b9838d6718..29b960111c 100644
--- a/spec/integration/knife/client_key_create_spec.rb
+++ b/spec/integration/knife/client_key_create_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
require "openssl"
diff --git a/spec/integration/knife/client_key_delete_spec.rb b/spec/integration/knife/client_key_delete_spec.rb
index 2730ee8cae..8c15377986 100644
--- a/spec/integration/knife/client_key_delete_spec.rb
+++ b/spec/integration/knife/client_key_delete_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/client_key_list_spec.rb b/spec/integration/knife/client_key_list_spec.rb
index 773445eca9..01e5b78585 100644
--- a/spec/integration/knife/client_key_list_spec.rb
+++ b/spec/integration/knife/client_key_list_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
require "date"
diff --git a/spec/integration/knife/client_key_show_spec.rb b/spec/integration/knife/client_key_show_spec.rb
index ee17fc3e5a..05024d40b2 100644
--- a/spec/integration/knife/client_key_show_spec.rb
+++ b/spec/integration/knife/client_key_show_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
require "date"
diff --git a/spec/integration/knife/client_list_spec.rb b/spec/integration/knife/client_list_spec.rb
index f7875b44af..7668b9e455 100644
--- a/spec/integration/knife/client_list_spec.rb
+++ b/spec/integration/knife/client_list_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/client_show_spec.rb b/spec/integration/knife/client_show_spec.rb
index 1520575e48..39a107e37f 100644
--- a/spec/integration/knife/client_show_spec.rb
+++ b/spec/integration/knife/client_show_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/common_options_spec.rb b/spec/integration/knife/common_options_spec.rb
index 468b7af8be..7796bf9923 100644
--- a/spec/integration/knife/common_options_spec.rb
+++ b/spec/integration/knife/common_options_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "chef/knife/raw"
diff --git a/spec/integration/knife/config_list_spec.rb b/spec/integration/knife/config_list_spec.rb
index b05350ed87..5193608f36 100644
--- a/spec/integration/knife/config_list_spec.rb
+++ b/spec/integration/knife/config_list_spec.rb
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/config_show_spec.rb b/spec/integration/knife/config_show_spec.rb
index 9e6ff73aa1..e11d001df9 100644
--- a/spec/integration/knife/config_show_spec.rb
+++ b/spec/integration/knife/config_show_spec.rb
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/config_use_spec.rb b/spec/integration/knife/config_use_spec.rb
index 0431729b25..4a982bc0bd 100644
--- a/spec/integration/knife/config_use_spec.rb
+++ b/spec/integration/knife/config_use_spec.rb
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/cookbook_api_ipv6_spec.rb b/spec/integration/knife/cookbook_api_ipv6_spec.rb
index b65cdc697b..5d0ce0707f 100644
--- a/spec/integration/knife/cookbook_api_ipv6_spec.rb
+++ b/spec/integration/knife/cookbook_api_ipv6_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "chef/mixin/shell_out"
@@ -62,7 +62,7 @@ describe "Knife cookbook API integration with IPv6", :workstation, :not_supporte
Dir.mktmpdir
end
- let(:chef_dir) { File.join(__dir__, "..", "..", "..", "bin") }
+ let(:chef_dir) { File.join(__dir__, "..", "..", "..", "knife", "bin") }
let(:knife) { "ruby '#{chef_dir}/knife'" }
let(:knife_config_flag) { "-c '#{path_to("config/knife.rb")}'" }
@@ -102,7 +102,7 @@ describe "Knife cookbook API integration with IPv6", :workstation, :not_supporte
end
it "downloads the cookbook" do
- shell_out!("knife cookbook download apache2 #{knife_config_flag} -d #{cache_path}", cwd: chef_dir)
+ shell_out!("#{knife} cookbook download apache2 #{knife_config_flag} -d #{cache_path}", cwd: chef_dir)
expect(Dir["#{cache_path}/*"].map { |entry| File.basename(entry) }).to include("apache2-0.0.1")
end
end
diff --git a/spec/integration/knife/cookbook_bulk_delete_spec.rb b/spec/integration/knife/cookbook_bulk_delete_spec.rb
index 677a6aaa31..0e791f5a1e 100644
--- a/spec/integration/knife/cookbook_bulk_delete_spec.rb
+++ b/spec/integration/knife/cookbook_bulk_delete_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
require "chef/knife/cookbook_bulk_delete"
diff --git a/spec/integration/knife/cookbook_download_spec.rb b/spec/integration/knife/cookbook_download_spec.rb
index 1cc05c909a..589417126c 100644
--- a/spec/integration/knife/cookbook_download_spec.rb
+++ b/spec/integration/knife/cookbook_download_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
require "chef/knife/cookbook_download"
diff --git a/spec/integration/knife/cookbook_list_spec.rb b/spec/integration/knife/cookbook_list_spec.rb
index c94df52272..e712ae3235 100644
--- a/spec/integration/knife/cookbook_list_spec.rb
+++ b/spec/integration/knife/cookbook_list_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
require "chef/knife/cookbook_list"
diff --git a/spec/integration/knife/cookbook_show_spec.rb b/spec/integration/knife/cookbook_show_spec.rb
index 57701d4426..d8c2e38f64 100644
--- a/spec/integration/knife/cookbook_show_spec.rb
+++ b/spec/integration/knife/cookbook_show_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
require "chef/knife/cookbook_show"
diff --git a/spec/integration/knife/cookbook_upload_spec.rb b/spec/integration/knife/cookbook_upload_spec.rb
index 7139f0accd..f42683b2a3 100644
--- a/spec/integration/knife/cookbook_upload_spec.rb
+++ b/spec/integration/knife/cookbook_upload_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
require "chef/knife/cookbook_upload"
diff --git a/spec/integration/knife/data_bag_create_spec.rb b/spec/integration/knife/data_bag_create_spec.rb
index ca01a2d8ab..439d69507c 100644
--- a/spec/integration/knife/data_bag_create_spec.rb
+++ b/spec/integration/knife/data_bag_create_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
require "chef/knife/data_bag_create"
diff --git a/spec/integration/knife/data_bag_delete_spec.rb b/spec/integration/knife/data_bag_delete_spec.rb
index c0a17779b9..a7fac7e2ee 100644
--- a/spec/integration/knife/data_bag_delete_spec.rb
+++ b/spec/integration/knife/data_bag_delete_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
require "chef/knife/data_bag_delete"
diff --git a/spec/integration/knife/data_bag_edit_spec.rb b/spec/integration/knife/data_bag_edit_spec.rb
index 1063b5d14f..1071df2a78 100644
--- a/spec/integration/knife/data_bag_edit_spec.rb
+++ b/spec/integration/knife/data_bag_edit_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
require "chef/knife/data_bag_edit"
diff --git a/spec/integration/knife/data_bag_from_file_spec.rb b/spec/integration/knife/data_bag_from_file_spec.rb
index 93801226d0..bb8bd192f0 100644
--- a/spec/integration/knife/data_bag_from_file_spec.rb
+++ b/spec/integration/knife/data_bag_from_file_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/data_bag_list_spec.rb b/spec/integration/knife/data_bag_list_spec.rb
index 0216b90c5d..1e7734db64 100644
--- a/spec/integration/knife/data_bag_list_spec.rb
+++ b/spec/integration/knife/data_bag_list_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
require "chef/knife/data_bag_list"
diff --git a/spec/integration/knife/data_bag_show_spec.rb b/spec/integration/knife/data_bag_show_spec.rb
index b332b1b114..91ebf605f1 100644
--- a/spec/integration/knife/data_bag_show_spec.rb
+++ b/spec/integration/knife/data_bag_show_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
require "chef/knife/data_bag_show"
diff --git a/spec/integration/knife/delete_spec.rb b/spec/integration/knife/delete_spec.rb
index 851c492a66..e00949e7f4 100644
--- a/spec/integration/knife/delete_spec.rb
+++ b/spec/integration/knife/delete_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "chef/knife/delete"
require "chef/knife/list"
diff --git a/spec/integration/knife/deps_spec.rb b/spec/integration/knife/deps_spec.rb
index 77505e6332..9875277f14 100644
--- a/spec/integration/knife/deps_spec.rb
+++ b/spec/integration/knife/deps_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
require "chef/knife/deps"
diff --git a/spec/integration/knife/diff_spec.rb b/spec/integration/knife/diff_spec.rb
index 41ae5ea519..c69573735a 100644
--- a/spec/integration/knife/diff_spec.rb
+++ b/spec/integration/knife/diff_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "chef/knife/diff"
diff --git a/spec/integration/knife/download_spec.rb b/spec/integration/knife/download_spec.rb
index 7bdec7b356..29200d66f2 100644
--- a/spec/integration/knife/download_spec.rb
+++ b/spec/integration/knife/download_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "chef/knife/download"
require "chef/knife/diff"
diff --git a/spec/integration/knife/environment_compare_spec.rb b/spec/integration/knife/environment_compare_spec.rb
index 7a623adf4c..a8d207466a 100644
--- a/spec/integration/knife/environment_compare_spec.rb
+++ b/spec/integration/knife/environment_compare_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/environment_create_spec.rb b/spec/integration/knife/environment_create_spec.rb
index 66ba9ed6e6..496828073d 100644
--- a/spec/integration/knife/environment_create_spec.rb
+++ b/spec/integration/knife/environment_create_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/environment_delete_spec.rb b/spec/integration/knife/environment_delete_spec.rb
index f55a1c96bd..93427aaf2f 100644
--- a/spec/integration/knife/environment_delete_spec.rb
+++ b/spec/integration/knife/environment_delete_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/environment_from_file_spec.rb b/spec/integration/knife/environment_from_file_spec.rb
index f9d35f4d47..e5ba056bb7 100644
--- a/spec/integration/knife/environment_from_file_spec.rb
+++ b/spec/integration/knife/environment_from_file_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/environment_list_spec.rb b/spec/integration/knife/environment_list_spec.rb
index dba685a82e..f74b2b6360 100644
--- a/spec/integration/knife/environment_list_spec.rb
+++ b/spec/integration/knife/environment_list_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/environment_show_spec.rb b/spec/integration/knife/environment_show_spec.rb
index de6ad1efd4..b961e85734 100644
--- a/spec/integration/knife/environment_show_spec.rb
+++ b/spec/integration/knife/environment_show_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/list_spec.rb b/spec/integration/knife/list_spec.rb
index 4c711f3306..8228ba6056 100644
--- a/spec/integration/knife/list_spec.rb
+++ b/spec/integration/knife/list_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
require "chef/knife/list"
diff --git a/spec/integration/knife/node_bulk_delete_spec.rb b/spec/integration/knife/node_bulk_delete_spec.rb
index dcaa71ef58..8784b5ea8a 100644
--- a/spec/integration/knife/node_bulk_delete_spec.rb
+++ b/spec/integration/knife/node_bulk_delete_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/node_create_spec.rb b/spec/integration/knife/node_create_spec.rb
index e8f6d71694..d3debb8f00 100644
--- a/spec/integration/knife/node_create_spec.rb
+++ b/spec/integration/knife/node_create_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
require "openssl"
diff --git a/spec/integration/knife/node_delete_spec.rb b/spec/integration/knife/node_delete_spec.rb
index c743d6e03f..3cece6ebaf 100644
--- a/spec/integration/knife/node_delete_spec.rb
+++ b/spec/integration/knife/node_delete_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/node_environment_set_spec.rb b/spec/integration/knife/node_environment_set_spec.rb
index 16a86dbc30..51b288fe39 100644
--- a/spec/integration/knife/node_environment_set_spec.rb
+++ b/spec/integration/knife/node_environment_set_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/node_from_file_spec.rb b/spec/integration/knife/node_from_file_spec.rb
index 6f7e0780f0..5dcaaaa463 100644
--- a/spec/integration/knife/node_from_file_spec.rb
+++ b/spec/integration/knife/node_from_file_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/node_list_spec.rb b/spec/integration/knife/node_list_spec.rb
index 8d3bc29a5a..65c201be3f 100644
--- a/spec/integration/knife/node_list_spec.rb
+++ b/spec/integration/knife/node_list_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/node_run_list_add_spec.rb b/spec/integration/knife/node_run_list_add_spec.rb
index f13e584526..72b5328b17 100644
--- a/spec/integration/knife/node_run_list_add_spec.rb
+++ b/spec/integration/knife/node_run_list_add_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/node_run_list_remove_spec.rb b/spec/integration/knife/node_run_list_remove_spec.rb
index 55f224b5ac..19aeb81806 100644
--- a/spec/integration/knife/node_run_list_remove_spec.rb
+++ b/spec/integration/knife/node_run_list_remove_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/node_run_list_set_spec.rb b/spec/integration/knife/node_run_list_set_spec.rb
index e642afc1ce..d83e74dd04 100644
--- a/spec/integration/knife/node_run_list_set_spec.rb
+++ b/spec/integration/knife/node_run_list_set_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/node_show_spec.rb b/spec/integration/knife/node_show_spec.rb
index cf3f166699..be63011ef8 100644
--- a/spec/integration/knife/node_show_spec.rb
+++ b/spec/integration/knife/node_show_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/raw_spec.rb b/spec/integration/knife/raw_spec.rb
index ba26def473..8e7e913b02 100644
--- a/spec/integration/knife/raw_spec.rb
+++ b/spec/integration/knife/raw_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
require "chef/knife/raw"
diff --git a/spec/integration/knife/redirection_spec.rb b/spec/integration/knife/redirection_spec.rb
index 34d5fe6efc..eea5556cff 100644
--- a/spec/integration/knife/redirection_spec.rb
+++ b/spec/integration/knife/redirection_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "tiny_server"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/role_bulk_delete_spec.rb b/spec/integration/knife/role_bulk_delete_spec.rb
index 6810cebc91..76745d9b6a 100644
--- a/spec/integration/knife/role_bulk_delete_spec.rb
+++ b/spec/integration/knife/role_bulk_delete_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/role_create_spec.rb b/spec/integration/knife/role_create_spec.rb
index 80ef1d9a9f..03f59d4b99 100644
--- a/spec/integration/knife/role_create_spec.rb
+++ b/spec/integration/knife/role_create_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/role_delete_spec.rb b/spec/integration/knife/role_delete_spec.rb
index c4c6498c51..22b36e5572 100644
--- a/spec/integration/knife/role_delete_spec.rb
+++ b/spec/integration/knife/role_delete_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/role_from_file_spec.rb b/spec/integration/knife/role_from_file_spec.rb
index 4a2912935c..ae296122ce 100644
--- a/spec/integration/knife/role_from_file_spec.rb
+++ b/spec/integration/knife/role_from_file_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/role_list_spec.rb b/spec/integration/knife/role_list_spec.rb
index 9e4b983698..39aa28783f 100644
--- a/spec/integration/knife/role_list_spec.rb
+++ b/spec/integration/knife/role_list_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/role_show_spec.rb b/spec/integration/knife/role_show_spec.rb
index dfa989bf69..a4ecea1d61 100644
--- a/spec/integration/knife/role_show_spec.rb
+++ b/spec/integration/knife/role_show_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/search_node_spec.rb b/spec/integration/knife/search_node_spec.rb
index 8eaa30f7fa..9e7935b83c 100644
--- a/spec/integration/knife/search_node_spec.rb
+++ b/spec/integration/knife/search_node_spec.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
diff --git a/spec/integration/knife/show_spec.rb b/spec/integration/knife/show_spec.rb
index 4bee492e7b..6913494916 100644
--- a/spec/integration/knife/show_spec.rb
+++ b/spec/integration/knife/show_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "support/shared/context/config"
require "chef/knife/show"
diff --git a/spec/integration/knife/upload_spec.rb b/spec/integration/knife/upload_spec.rb
index 37cfcefa32..e4bb44ad7e 100644
--- a/spec/integration/knife/upload_spec.rb
+++ b/spec/integration/knife/upload_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "support/shared/integration/integration_helper"
require "chef/knife/upload"
require "chef/knife/diff"
diff --git a/spec/knife_spec_helper.rb b/spec/knife_spec_helper.rb
new file mode 100644
index 0000000000..fd40f4002e
--- /dev/null
+++ b/spec/knife_spec_helper.rb
@@ -0,0 +1,245 @@
+#
+# Author:: Adam Jacob (<adam@chef.io>)
+# Copyright:: Copyright (c) Chef Software Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# If you need to add anything in here, don't.
+# Add it to one of the files in spec/support
+
+# Abuse ruby's constant lookup to avoid undefined constant errors
+
+$LOAD_PATH.unshift File.expand_path("..", __dir__)
+$LOAD_PATH.unshift File.expand_path("../../chef-config/lib", __dir__)
+$LOAD_PATH.unshift File.expand_path("../../chef-utils/lib", __dir__)
+
+require "rubygems"
+require "rspec/mocks"
+require "rexml/document"
+require "webmock/rspec"
+
+require "chef/knife"
+
+# cwd is knife/
+Dir["lib/chef/knife/**/*.rb"]
+ .map { |f| f.gsub("lib/", "") }
+ .map { |f| f.gsub(/\.rb$/, "") }
+ .each { |f| require f }
+
+require "chef/resource_resolver"
+require "chef/provider_resolver"
+
+require "chef/mixins"
+require "chef/dsl"
+
+require "chef/shell"
+require "chef/util/file_edit"
+
+require "chef/config"
+
+require "chef/chef_fs/file_system_cache"
+
+require "chef/api_client_v1"
+
+require "chef/mixin/versioned_api"
+require "chef/server_api_versions"
+
+# MPTD relevant for knife?
+if ENV["CHEF_FIPS"] == "1"
+ Chef::Config.init_openssl
+end
+
+# If you want to load anything into the testing environment
+# without versioning it, add it to spec/support/local_gems.rb
+require "spec/support/local_gems" if File.exist?(File.join(File.dirname(__FILE__), "support", "local_gems.rb"))
+
+# Explicitly require spec helpers that need to load first
+require "spec/support/platform_helpers"
+require "spec/support/shared/unit/mock_shellout"
+require "spec/support/recipe_dsl_helper"
+
+# MPTD - I had to add each of these manually, but I'm not clear why they were
+# _not_ required before splitting the gem.
+require "spec/support/key_helpers"
+require "spec/support/shared/unit/knife_shared"
+require "spec/support/shared/functional/knife"
+require "spec/support/shared/integration/knife_support"
+require "spec/support/shared/matchers/exit_with_code"
+require "spec/support/shared/matchers/match_environment_variable"
+
+# Autoloads support files
+# Excludes support/platforms by default
+# Do not change the gsub.
+Dir["spec/support/**/*.rb"]
+ .reject { |f| f =~ %r{^spec/support/platforms} }
+ .reject { |f| f =~ %r{^spec/support/pedant} }
+ .map { |f| f.gsub(/.rb$/, "") }
+ .map { |f| f.gsub(%r{spec/}, "") }
+ .each { |f| require f }
+
+OHAI_SYSTEM = Ohai::System.new
+OHAI_SYSTEM.all_plugins(["platform", "hostname", "languages/powershell", "uptime"])
+
+test_node = Chef::Node.new
+test_node.automatic["os"] = (OHAI_SYSTEM["os"] || "unknown_os").dup.freeze
+test_node.automatic["platform_family"] = (OHAI_SYSTEM["platform_family"] || "unknown_platform_family").dup.freeze
+test_node.automatic["platform"] = (OHAI_SYSTEM["platform"] || "unknown_platform").dup.freeze
+test_node.automatic["platform_version"] = (OHAI_SYSTEM["platform_version"] || "unknown_platform_version").dup.freeze
+TEST_NODE = test_node.freeze
+TEST_OS = TEST_NODE["os"]
+TEST_PLATFORM = TEST_NODE["platform"]
+TEST_PLATFORM_VERSION = TEST_NODE["platform_version"]
+TEST_PLATFORM_FAMILY = TEST_NODE["platform_family"]
+
+provider_priority_map ||= nil
+resource_priority_map ||= nil
+provider_handler_map ||= nil
+resource_handler_map ||= nil
+
+class UnexpectedSystemExit < RuntimeError
+ def self.from(system_exit)
+ new(system_exit.message).tap { |e| e.set_backtrace(system_exit.backtrace) }
+ end
+end
+
+RSpec.configure do |config|
+ config.include(RSpec::Matchers)
+ config.include(MockShellout::RSpec)
+ config.filter_run focus: true
+ config.filter_run_excluding external: true
+ config.raise_on_warning = true
+
+ # Explicitly disable :should syntax
+ # And set max_formatted_output_length to nil to prevent RSpec from doing truncation.
+ config.expect_with :rspec do |c|
+ c.syntax = :expect
+ c.max_formatted_output_length = nil
+ end
+ config.mock_with :rspec do |c|
+ c.syntax = :expect
+ c.allow_message_expectations_on_nil = false
+ end
+
+ # TODO - which if any of these filters apply to knife tests?
+ #
+ # Only run these tests on platforms that are also chef workstations
+ config.filter_run_excluding :workstation if solaris? || aix?
+
+ # Tests that randomly fail, but may have value.
+ config.filter_run_excluding volatile: true
+ config.filter_run_excluding volatile_on_solaris: true if solaris?
+ config.filter_run_excluding volatile_from_verify: false
+
+ config.filter_run_excluding skip_buildkite: true if ENV["BUILDKITE"]
+
+ config.filter_run_excluding windows_only: true unless windows?
+ config.filter_run_excluding unix_only: true unless unix?
+
+ # check for particular binaries we need
+
+ running_platform_arch = `uname -m`.strip unless windows?
+
+ config.filter_run_excluding arch: lambda { |target_arch|
+ running_platform_arch != target_arch
+ }
+
+ config.run_all_when_everything_filtered = true
+
+ config.before(:each) do
+ # it'd be nice to run this with connections blocked or only to localhost, but we do make lots
+ # of real connections, so cannot. we reset it to allow connections every time to avoid
+ # tests setting connections to be disabled and that state leaking into other tests.
+ WebMock.allow_net_connect!
+ Chef.reset!
+ Chef::ChefFS::FileSystemCache.instance.reset!
+ Chef::Config.reset
+ Chef::Log.setup!
+ Chef::ServerAPIVersions.instance.reset!
+ Chef::Config[:log_level] = :fatal
+ Chef::Log.level(Chef::Config[:log_level])
+
+ # By default, treat deprecation warnings as errors in tests.
+ # and set environment variable so the setting persists in child processes
+ Chef::Config.treat_deprecation_warnings_as_errors(true)
+ ENV["CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS"] = "1"
+ end
+
+ # This bit of jankiness guards against specs which accidentally drop privs when running as
+ # root -- which are nearly impossible to debug and so we bail out very hard if this
+ # condition ever happens. If a spec stubs Process.[e]uid this can throw a false positive
+ # which the spec must work around by unmocking Process.[e]uid to and_call_original in its
+ # after block.
+ # Should not be a problem with knife which does not escalate local privs, but
+ # it seems wise to continue to guard against.
+ if Process.euid == 0 && Process.uid == 0
+ config.after(:each) do
+ if Process.uid != 0
+ RSpec.configure { |c| c.fail_fast = true }
+ raise "rspec was invoked as root, but the last test dropped real uid to #{Process.uid}"
+ end
+ if Process.euid != 0
+ RSpec.configure { |c| c.fail_fast = true }
+ raise "rspec was invoked as root, but the last test dropped effective uid to #{Process.euid}"
+ end
+ end
+ end
+
+ # raise if anyone commits any test to CI with :focus set on it
+ if ENV["CI"]
+ config.before(:example, :focus) do
+ raise "This example was committed with `:focus` and should not have been"
+ end
+ end
+
+ config.before(:suite) do
+ ARGV.clear
+ end
+
+ # Protect Rspec from accidental exit(0) causing rspec to terminate without error
+ config.around(:example) do |ex|
+ ex.run
+ rescue SystemExit => e
+ raise UnexpectedSystemExit.from(e)
+
+ end
+end
+
+require "webrick/utils"
+# Webrick uses a centralized/synchronized timeout manager. It works by
+# starting a thread to check for timeouts on an interval. The timeout
+# checker thread cannot be stopped or canceled in any easy way, and it
+# makes calls to Time.new, which fail when rspec is in the process of
+# creating a method stub for that method. Since our tests don't rely on
+# any timeout behavior enforced by webrick, disable the timeout manager
+# via a monkey patch.
+#
+# Hopefully this fails loudly if the webrick code should change. As of this
+# writing, the relevant code is in webrick/utils, which can be located on
+# your system with:
+#
+# $ gem which webrick/utils
+module WEBrick
+ module Utils
+ class TimeoutHandler
+ def initialize; end
+
+ def register(*args); end
+
+ def cancel(*args); end
+ end
+ end
+end
+
+# Enough stuff needs json serialization that I'm just adding it here for equality asserts
+require "chef/json_compat"
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 83cec749a7..2924b2abdb 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -35,12 +35,6 @@ require "rexml/document"
require "webmock/rspec"
require "chef"
-require "chef/knife"
-
-Dir["lib/chef/knife/**/*.rb"]
- .map { |f| f.gsub("lib/", "") }
- .map { |f| f.gsub(/\.rb$/, "") }
- .each { |f| require f }
require "chef/resource_resolver"
require "chef/provider_resolver"
@@ -82,6 +76,7 @@ require "spec/support/recipe_dsl_helper"
Dir["spec/support/**/*.rb"]
.reject { |f| f =~ %r{^spec/support/platforms} }
.reject { |f| f =~ %r{^spec/support/pedant} }
+ .reject { |f| f =~ %r{^spec/support/shared/integration/knife_support} }
.map { |f| f.gsub(/.rb$/, "") }
.map { |f| f.gsub(%r{spec/}, "") }
.each { |f| require f }
@@ -232,6 +227,14 @@ RSpec.configure do |config|
Chef.reset!
+ # Hack warning:
+ #
+ # Something across gem_installer_spec and mixlib_cli specs are polluting gem state so that the 'unmockening' test in rubygems_spec fails.
+ # This works around that until we can understand root cause.
+ #
+ # To explore the minimal test case around that and see more detailed notes, see branch `mp/broken-gems`
+ Gem.clear_paths
+
Chef::ChefFS::FileSystemCache.instance.reset!
Chef::Config.reset
diff --git a/spec/support/lib/chef/resource/with_state.rb b/spec/support/lib/chef/resource/with_state.rb
index 98e4033e01..1977fb3f6a 100644
--- a/spec/support/lib/chef/resource/with_state.rb
+++ b/spec/support/lib/chef/resource/with_state.rb
@@ -16,7 +16,6 @@
# limitations under the License.
#
-require "chef/knife"
require "chef/json_compat"
class Chef
diff --git a/spec/support/lib/chef/resource/zen_follower.rb b/spec/support/lib/chef/resource/zen_follower.rb
index 44de913f8b..c7d01dcebb 100644
--- a/spec/support/lib/chef/resource/zen_follower.rb
+++ b/spec/support/lib/chef/resource/zen_follower.rb
@@ -15,7 +15,6 @@
# limitations under the License.
#
-require "chef/knife"
require "chef/json_compat"
class Chef
diff --git a/spec/support/lib/chef/resource/zen_master.rb b/spec/support/lib/chef/resource/zen_master.rb
index ba2f950bed..0e0853d0b3 100644
--- a/spec/support/lib/chef/resource/zen_master.rb
+++ b/spec/support/lib/chef/resource/zen_master.rb
@@ -16,7 +16,6 @@
# limitations under the License.
#
-require "chef/knife"
require "chef/json_compat"
class Chef
diff --git a/spec/support/platform_helpers.rb b/spec/support/platform_helpers.rb
index 83f2fcf172..4cc9943709 100644
--- a/spec/support/platform_helpers.rb
+++ b/spec/support/platform_helpers.rb
@@ -2,6 +2,8 @@ require "fcntl"
require "chef/mixin/shell_out"
require "ohai/mixin/http_helper"
require "ohai/mixin/gce_metadata"
+# MPTD - why has nobody had to do this before now?
+require "spec/support/chef_helpers"
class ShellHelpers
extend Chef::Mixin::ShellOut
diff --git a/spec/support/shared/integration/integration_helper.rb b/spec/support/shared/integration/integration_helper.rb
index 41f2b46995..c42a04004a 100644
--- a/spec/support/shared/integration/integration_helper.rb
+++ b/spec/support/shared/integration/integration_helper.rb
@@ -22,7 +22,6 @@ require "fileutils"
require "chef/config"
require "chef/json_compat"
require "chef/server_api"
-require "support/shared/integration/knife_support"
require "cheffish/rspec/chef_run_support"
module Cheffish
diff --git a/spec/unit/application/knife_spec.rb b/spec/unit/application/knife_spec.rb
index bce6b19366..ad705ab1e5 100644
--- a/spec/unit/application/knife_spec.rb
+++ b/spec/unit/application/knife_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
require "#{CHEF_SPEC_DATA}/knife_subcommand/test_yourself"
describe Chef::Application::Knife do
diff --git a/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb b/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb
index 4d36208be0..a4d007611e 100644
--- a/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb
+++ b/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::Bootstrap::ChefVaultHandler do
diff --git a/spec/unit/knife/bootstrap/client_builder_spec.rb b/spec/unit/knife/bootstrap/client_builder_spec.rb
index 10edd13882..cf6999b093 100644
--- a/spec/unit/knife/bootstrap/client_builder_spec.rb
+++ b/spec/unit/knife/bootstrap/client_builder_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::Bootstrap::ClientBuilder do
diff --git a/spec/unit/knife/bootstrap/train_connector_spec.rb b/spec/unit/knife/bootstrap/train_connector_spec.rb
index 4c384100fa..0a1091fa8d 100644
--- a/spec/unit/knife/bootstrap/train_connector_spec.rb
+++ b/spec/unit/knife/bootstrap/train_connector_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "ostruct"
require "chef/knife/bootstrap/train_connector"
diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb
index a3dd714094..f2f2f48f98 100644
--- a/spec/unit/knife/bootstrap_spec.rb
+++ b/spec/unit/knife/bootstrap_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
Chef::Knife::Bootstrap.load_deps
@@ -185,7 +185,7 @@ describe Chef::Knife::Bootstrap do
context "when :bootstrap_template config is set to a template name" do
let(:bootstrap_template) { "example" }
- let(:builtin_template_path) { File.expand_path(File.join(__dir__, "../../../lib/chef/knife/bootstrap/templates", "example.erb")) }
+ let(:builtin_template_path) { File.expand_path(File.join(__dir__, "../../../knife/lib/chef/knife/bootstrap/templates", "example.erb")) }
let(:chef_config_dir_template_path) { "/knife/chef/config/bootstrap/example.erb" }
diff --git a/spec/unit/knife/client_bulk_delete_spec.rb b/spec/unit/knife/client_bulk_delete_spec.rb
index 435eb888aa..86d69ff4d6 100644
--- a/spec/unit/knife/client_bulk_delete_spec.rb
+++ b/spec/unit/knife/client_bulk_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::ClientBulkDelete do
let(:stdout_io) { StringIO.new }
diff --git a/spec/unit/knife/client_create_spec.rb b/spec/unit/knife/client_create_spec.rb
index d8b67de101..48a7e71df5 100644
--- a/spec/unit/knife/client_create_spec.rb
+++ b/spec/unit/knife/client_create_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
Chef::Knife::ClientCreate.load_deps
diff --git a/spec/unit/knife/client_delete_spec.rb b/spec/unit/knife/client_delete_spec.rb
index 41a83b05e4..ec20878ade 100644
--- a/spec/unit/knife/client_delete_spec.rb
+++ b/spec/unit/knife/client_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::ClientDelete do
before(:each) do
diff --git a/spec/unit/knife/client_edit_spec.rb b/spec/unit/knife/client_edit_spec.rb
index e7c9030883..03ac450b3e 100644
--- a/spec/unit/knife/client_edit_spec.rb
+++ b/spec/unit/knife/client_edit_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/api_client_v1"
describe Chef::Knife::ClientEdit do
diff --git a/spec/unit/knife/client_list_spec.rb b/spec/unit/knife/client_list_spec.rb
index d1b379a787..b6a205e6b1 100644
--- a/spec/unit/knife/client_list_spec.rb
+++ b/spec/unit/knife/client_list_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::ClientList do
before(:each) do
diff --git a/spec/unit/knife/client_reregister_spec.rb b/spec/unit/knife/client_reregister_spec.rb
index 6b6519d44f..f1217edee4 100644
--- a/spec/unit/knife/client_reregister_spec.rb
+++ b/spec/unit/knife/client_reregister_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::ClientReregister do
before(:each) do
diff --git a/spec/unit/knife/client_show_spec.rb b/spec/unit/knife/client_show_spec.rb
index 47b4b6ccb0..39928a6289 100644
--- a/spec/unit/knife/client_show_spec.rb
+++ b/spec/unit/knife/client_show_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::ClientShow do
before(:each) do
diff --git a/spec/unit/knife/configure_client_spec.rb b/spec/unit/knife/configure_client_spec.rb
index b104718c89..f88ffb31ed 100644
--- a/spec/unit/knife/configure_client_spec.rb
+++ b/spec/unit/knife/configure_client_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::ConfigureClient do
before do
diff --git a/spec/unit/knife/configure_spec.rb b/spec/unit/knife/configure_spec.rb
index 7d6c840d1f..f9d1bea8fd 100644
--- a/spec/unit/knife/configure_spec.rb
+++ b/spec/unit/knife/configure_spec.rb
@@ -1,4 +1,4 @@
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::Configure do
before do
diff --git a/spec/unit/knife/cookbook_bulk_delete_spec.rb b/spec/unit/knife/cookbook_bulk_delete_spec.rb
index 3527d39bd8..52f9c1eeb9 100644
--- a/spec/unit/knife/cookbook_bulk_delete_spec.rb
+++ b/spec/unit/knife/cookbook_bulk_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::CookbookBulkDelete do
before(:each) do
diff --git a/spec/unit/knife/cookbook_delete_spec.rb b/spec/unit/knife/cookbook_delete_spec.rb
index f2aa7e1be0..b05006f2d3 100644
--- a/spec/unit/knife/cookbook_delete_spec.rb
+++ b/spec/unit/knife/cookbook_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::CookbookDelete do
before(:each) do
diff --git a/spec/unit/knife/cookbook_download_spec.rb b/spec/unit/knife/cookbook_download_spec.rb
index c8903dea5b..b3dbc81205 100644
--- a/spec/unit/knife/cookbook_download_spec.rb
+++ b/spec/unit/knife/cookbook_download_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::CookbookDownload do
before(:each) do
diff --git a/spec/unit/knife/cookbook_list_spec.rb b/spec/unit/knife/cookbook_list_spec.rb
index 4cf806c6f0..42c3ef1bfd 100644
--- a/spec/unit/knife/cookbook_list_spec.rb
+++ b/spec/unit/knife/cookbook_list_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::CookbookList do
before do
diff --git a/spec/unit/knife/cookbook_metadata_from_file_spec.rb b/spec/unit/knife/cookbook_metadata_from_file_spec.rb
index f9bbffae2d..c595aef96f 100644
--- a/spec/unit/knife/cookbook_metadata_from_file_spec.rb
+++ b/spec/unit/knife/cookbook_metadata_from_file_spec.rb
@@ -18,7 +18,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::CookbookMetadataFromFile do
before(:each) do
diff --git a/spec/unit/knife/cookbook_metadata_spec.rb b/spec/unit/knife/cookbook_metadata_spec.rb
index 732cf78421..1a274cc6f4 100644
--- a/spec/unit/knife/cookbook_metadata_spec.rb
+++ b/spec/unit/knife/cookbook_metadata_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::CookbookMetadata do
let(:knife) do
diff --git a/spec/unit/knife/cookbook_show_spec.rb b/spec/unit/knife/cookbook_show_spec.rb
index defc243de3..94e080cb15 100644
--- a/spec/unit/knife/cookbook_show_spec.rb
+++ b/spec/unit/knife/cookbook_show_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::CookbookShow do
before do
diff --git a/spec/unit/knife/cookbook_upload_spec.rb b/spec/unit/knife/cookbook_upload_spec.rb
index dbed8b8a67..0893f6a6b3 100644
--- a/spec/unit/knife/cookbook_upload_spec.rb
+++ b/spec/unit/knife/cookbook_upload_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/cookbook_uploader"
require "timeout"
diff --git a/spec/unit/knife/core/bootstrap_context_spec.rb b/spec/unit/knife/core/bootstrap_context_spec.rb
index a55047a739..79fddc8184 100644
--- a/spec/unit/knife/core/bootstrap_context_spec.rb
+++ b/spec/unit/knife/core/bootstrap_context_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/core/bootstrap_context"
describe Chef::Knife::Core::BootstrapContext do
diff --git a/spec/unit/knife/core/cookbook_scm_repo_spec.rb b/spec/unit/knife/core/cookbook_scm_repo_spec.rb
index 316cbdfaa6..68a155bbbe 100644
--- a/spec/unit/knife/core/cookbook_scm_repo_spec.rb
+++ b/spec/unit/knife/core/cookbook_scm_repo_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/core/cookbook_scm_repo"
describe Chef::Knife::CookbookSCMRepo do
diff --git a/spec/unit/cookbook_site_streaming_uploader_spec.rb b/spec/unit/knife/core/cookbook_site_streaming_uploader_spec.rb
index af714094d0..f40626990a 100644
--- a/spec/unit/cookbook_site_streaming_uploader_spec.rb
+++ b/spec/unit/knife/core/cookbook_site_streaming_uploader_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
-require "chef/cookbook_site_streaming_uploader"
+require "chef/knife/core/cookbook_site_streaming_uploader"
class FakeTempfile
def initialize(basename)
@@ -33,10 +33,10 @@ class FakeTempfile
end
-describe Chef::CookbookSiteStreamingUploader do
+describe Chef::Knife::Core::CookbookSiteStreamingUploader do
+ let(:subject) { Chef::Knife::Core::CookbookSiteStreamingUploader }
describe "create_build_dir" do
-
before(:each) do
@cookbook_repo = File.expand_path(File.join(CHEF_SPEC_DATA, "cookbooks"))
@loader = Chef::CookbookLoader.new(@cookbook_repo)
@@ -51,7 +51,7 @@ describe Chef::CookbookSiteStreamingUploader do
expect(Tempfile).to receive(:new).with("chef-#{cookbook.name}-build").and_return(FakeTempfile.new("chef-#{cookbook.name}-build"))
expect(FileUtils).to receive(:mkdir_p).exactly(files_count + 1).times
expect(FileUtils).to receive(:cp).exactly(files_count).times
- Chef::CookbookSiteStreamingUploader.create_build_dir(cookbook)
+ subject.create_build_dir(cookbook)
end
end # create_build_dir
@@ -68,17 +68,17 @@ describe Chef::CookbookSiteStreamingUploader do
it "should send an http request" do
expect_any_instance_of(Net::HTTP).to receive(:request)
- Chef::CookbookSiteStreamingUploader.make_request(:post, @uri, "bill", @secret_filename)
+ subject.make_request(:post, @uri, "bill", @secret_filename)
end
it "should read the private key file" do
expect(File).to receive(:read).with(@secret_filename).and_return(@rsa_key)
- Chef::CookbookSiteStreamingUploader.make_request(:post, @uri, "bill", @secret_filename)
+ subject.make_request(:post, @uri, "bill", @secret_filename)
end
it "should add the authentication signed header" do
expect_any_instance_of(Mixlib::Authentication::SigningObject).to receive(:sign).and_return({})
- Chef::CookbookSiteStreamingUploader.make_request(:post, @uri, "bill", @secret_filename)
+ subject.make_request(:post, @uri, "bill", @secret_filename)
end
it "should be able to send post requests" do
@@ -87,7 +87,7 @@ describe Chef::CookbookSiteStreamingUploader do
expect(Net::HTTP::Post).to receive(:new).once.and_return(post)
expect(Net::HTTP::Put).not_to receive(:new)
expect(Net::HTTP::Get).not_to receive(:new)
- Chef::CookbookSiteStreamingUploader.make_request(:post, @uri, "bill", @secret_filename)
+ subject.make_request(:post, @uri, "bill", @secret_filename)
end
it "should be able to send put requests" do
@@ -96,23 +96,23 @@ describe Chef::CookbookSiteStreamingUploader do
expect(Net::HTTP::Post).not_to receive(:new)
expect(Net::HTTP::Put).to receive(:new).once.and_return(put)
expect(Net::HTTP::Get).not_to receive(:new)
- Chef::CookbookSiteStreamingUploader.make_request(:put, @uri, "bill", @secret_filename)
+ subject.make_request(:put, @uri, "bill", @secret_filename)
end
it "should be able to receive files to attach as argument" do
- Chef::CookbookSiteStreamingUploader.make_request(:put, @uri, "bill", @secret_filename, {
+ subject.make_request(:put, @uri, "bill", @secret_filename, {
myfile: File.new(File.join(CHEF_SPEC_DATA, "config.rb")), # a dummy file
})
end
it "should be able to receive strings to attach as argument" do
- Chef::CookbookSiteStreamingUploader.make_request(:put, @uri, "bill", @secret_filename, {
+ subject.make_request(:put, @uri, "bill", @secret_filename, {
mystring: "Lorem ipsum",
})
end
it "should be able to receive strings and files as argument at the same time" do
- Chef::CookbookSiteStreamingUploader.make_request(:put, @uri, "bill", @secret_filename, {
+ subject.make_request(:put, @uri, "bill", @secret_filename, {
myfile1: File.new(File.join(CHEF_SPEC_DATA, "config.rb")),
mystring1: "Lorem ipsum",
myfile2: File.new(File.join(CHEF_SPEC_DATA, "config.rb")),
@@ -125,11 +125,11 @@ describe Chef::CookbookSiteStreamingUploader do
describe "StreamPart" do
before(:each) do
@file = File.new(File.join(CHEF_SPEC_DATA, "config.rb"))
- @stream_part = Chef::CookbookSiteStreamingUploader::StreamPart.new(@file, File.size(@file))
+ @stream_part = Chef::Knife::Core::CookbookSiteStreamingUploader::StreamPart.new(@file, File.size(@file))
end
it "should create a StreamPart" do
- expect(@stream_part).to be_instance_of(Chef::CookbookSiteStreamingUploader::StreamPart)
+ expect(@stream_part).to be_instance_of(Chef::Knife::Core::CookbookSiteStreamingUploader::StreamPart)
end
it "should expose its size" do
@@ -147,11 +147,11 @@ describe Chef::CookbookSiteStreamingUploader do
describe "StringPart" do
before(:each) do
@str = "What a boring string"
- @string_part = Chef::CookbookSiteStreamingUploader::StringPart.new(@str)
+ @string_part = Chef::Knife::Core::CookbookSiteStreamingUploader::StringPart.new(@str)
end
it "should create a StringPart" do
- expect(@string_part).to be_instance_of(Chef::CookbookSiteStreamingUploader::StringPart)
+ expect(@string_part).to be_instance_of(Chef::Knife::Core::CookbookSiteStreamingUploader::StringPart)
end
it "should expose its size" do
@@ -168,15 +168,15 @@ describe Chef::CookbookSiteStreamingUploader do
before(:each) do
@string1 = "stream1"
@string2 = "stream2"
- @stream1 = Chef::CookbookSiteStreamingUploader::StringPart.new(@string1)
- @stream2 = Chef::CookbookSiteStreamingUploader::StringPart.new(@string2)
+ @stream1 = Chef::Knife::Core::CookbookSiteStreamingUploader::StringPart.new(@string1)
+ @stream2 = Chef::Knife::Core::CookbookSiteStreamingUploader::StringPart.new(@string2)
@parts = [ @stream1, @stream2 ]
- @multipart_stream = Chef::CookbookSiteStreamingUploader::MultipartStream.new(@parts)
+ @multipart_stream = Chef::Knife::Core::CookbookSiteStreamingUploader::MultipartStream.new(@parts)
end
it "should create a MultipartStream" do
- expect(@multipart_stream).to be_instance_of(Chef::CookbookSiteStreamingUploader::MultipartStream)
+ expect(@multipart_stream).to be_instance_of(Chef::Knife::Core::CookbookSiteStreamingUploader::MultipartStream)
end
it "should expose its size" do
diff --git a/spec/unit/knife/core/gem_glob_loader_spec.rb b/spec/unit/knife/core/gem_glob_loader_spec.rb
index f0c29b86a0..a6a94cc57a 100644
--- a/spec/unit/knife/core/gem_glob_loader_spec.rb
+++ b/spec/unit/knife/core/gem_glob_loader_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::SubcommandLoader::GemGlobLoader do
let(:loader) { Chef::Knife::SubcommandLoader::GemGlobLoader.new(File.join(CHEF_SPEC_DATA, "knife-site-subcommands")) }
@@ -24,11 +24,11 @@ describe Chef::Knife::SubcommandLoader::GemGlobLoader do
before do
allow(ChefUtils).to receive(:windows?) { false }
- Chef::Util::PathHelper.class_variable_set(:@@home_dir, home)
+ ChefConfig::PathHelper.class_variable_set(:@@home_dir, home)
end
after do
- Chef::Util::PathHelper.class_variable_set(:@@home_dir, nil)
+ ChefConfig::PathHelper.class_variable_set(:@@home_dir, nil)
end
it "builds a list of the core subcommand file require paths" do
@@ -62,12 +62,42 @@ describe Chef::Knife::SubcommandLoader::GemGlobLoader do
expect(loader).to receive(:find_subcommands_via_dirglob).and_return({})
expect(loader.subcommand_files.select { |file| file.include?("knife-ec2") }.sort).to eq(gem_files)
end
+ it "excludes knife version file if loaded from a gem" do
+ gems = [ double("knife-ec2-0.5.12") ]
+ gem_files = [
+ "/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/ec2_base.rb",
+ "/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/ec2_otherstuff.rb",
+ "/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/version.rb",
+ ]
+ expected_files = [
+ "/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/ec2_base.rb",
+ "/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/ec2_otherstuff.rb"
+ ]
+
+ expect($LOAD_PATH).to receive(:map).and_return([])
+ if Gem::Specification.respond_to? :latest_specs
+ expect(Gem::Specification).to receive(:latest_specs).with(true).and_return(gems)
+ expect(gems[0]).to receive(:matches_for_glob).with(%r{chef/knife/\*\.rb\{(.*),\.rb,(.*)\}}).and_return(gem_files)
+ else
+ expect(Gem.source_index).to receive(:latest_specs).with(true).and_return(gems)
+ expect(gems[0]).to receive(:require_paths).twice.and_return(["lib"])
+ expect(gems[0]).to receive(:full_gem_path).and_return("/usr/lib/ruby/gems/knife-ec2-0.5.12")
+ expect(Dir).to receive(:[]).with("/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/*.rb").and_return(gem_files)
+ end
+ expect(loader).to receive(:find_subcommands_via_dirglob).and_return({})
+ expect(loader.subcommand_files.select { |file| file.include?("knife-ec2") }.sort).to eq(expected_files)
+ end
it "finds files using a dirglob when rubygems is not available" do
expect(loader.find_subcommands_via_dirglob).to include("chef/knife/node_create")
loader.find_subcommands_via_dirglob.each_value { |abs_path| expect(abs_path).to match(%r{chef/knife/.+}) }
end
+ it "excludes chef/knife/version.rb using a dirglob when rubygems is not available" do
+ expect(loader.find_subcommands_via_dirglob).to_not include("chef/knife/version")
+ loader.find_subcommands_via_dirglob.each_value { |abs_path| expect(abs_path).to match(%r{chef/knife/.+}) }
+ end
+
it "finds user-specific subcommands in the user's ~/.chef directory" do
expected_command = File.join(home, ".chef", "plugins", "knife", "example_home_subcommand.rb")
expect(loader.site_subcommands).to include(expected_command)
@@ -86,6 +116,9 @@ describe Chef::Knife::SubcommandLoader::GemGlobLoader do
# source tree of the "primary" chef install, it can be loaded and cause an
# error. We also want to ensure that we only load builtin commands from the
# "primary" chef install.
+ #
+ # NOTE - we need to revisit coverage now that we're moving knife to its own gem;
+ # or remove this test if it's no longer a supported scenario.
context "when a different version of chef is also installed as a gem" do
let(:all_found_commands) do
diff --git a/spec/unit/knife/core/hashed_command_loader_spec.rb b/spec/unit/knife/core/hashed_command_loader_spec.rb
index c88656945b..305c928309 100644
--- a/spec/unit/knife/core/hashed_command_loader_spec.rb
+++ b/spec/unit/knife/core/hashed_command_loader_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::SubcommandLoader::HashedCommandLoader do
before do
diff --git a/spec/unit/knife/core/node_editor_spec.rb b/spec/unit/knife/core/node_editor_spec.rb
index d8e5c86d2c..f4fbe76695 100644
--- a/spec/unit/knife/core/node_editor_spec.rb
+++ b/spec/unit/knife/core/node_editor_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/core/node_editor"
describe Chef::Knife::NodeEditor do
diff --git a/spec/unit/knife/core/object_loader_spec.rb b/spec/unit/knife/core/object_loader_spec.rb
index 0dcabff46d..00a9ed4553 100644
--- a/spec/unit/knife/core/object_loader_spec.rb
+++ b/spec/unit/knife/core/object_loader_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/core/object_loader"
describe Chef::Knife::Core::ObjectLoader do
diff --git a/spec/unit/knife/core/status_presenter_spec.rb b/spec/unit/knife/core/status_presenter_spec.rb
index 377c581bfc..a3f297045b 100644
--- a/spec/unit/knife/core/status_presenter_spec.rb
+++ b/spec/unit/knife/core/status_presenter_spec.rb
@@ -14,7 +14,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::Core::StatusPresenter do
describe "#summarize_json" do
diff --git a/spec/unit/knife/core/subcommand_loader_spec.rb b/spec/unit/knife/core/subcommand_loader_spec.rb
index e8bc045946..ad53a422fe 100644
--- a/spec/unit/knife/core/subcommand_loader_spec.rb
+++ b/spec/unit/knife/core/subcommand_loader_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::SubcommandLoader do
let(:loader) { Chef::Knife::SubcommandLoader.new(File.join(CHEF_SPEC_DATA, "knife-site-subcommands")) }
diff --git a/spec/unit/knife/core/ui_spec.rb b/spec/unit/knife/core/ui_spec.rb
index 3bbe799267..d5d09c0fdf 100644
--- a/spec/unit/knife/core/ui_spec.rb
+++ b/spec/unit/knife/core/ui_spec.rb
@@ -19,7 +19,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::UI do
before do
diff --git a/spec/unit/knife/core/windows_bootstrap_context_spec.rb b/spec/unit/knife/core/windows_bootstrap_context_spec.rb
index 76b90c955e..1243dd1559 100644
--- a/spec/unit/knife/core/windows_bootstrap_context_spec.rb
+++ b/spec/unit/knife/core/windows_bootstrap_context_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/core/windows_bootstrap_context"
describe Chef::Knife::Core::WindowsBootstrapContext do
let(:config) { {} }
diff --git a/spec/unit/knife/data_bag_create_spec.rb b/spec/unit/knife/data_bag_create_spec.rb
index 93082c190e..6700d886fc 100644
--- a/spec/unit/knife/data_bag_create_spec.rb
+++ b/spec/unit/knife/data_bag_create_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "tempfile"
describe Chef::Knife::DataBagCreate do
diff --git a/spec/unit/knife/data_bag_edit_spec.rb b/spec/unit/knife/data_bag_edit_spec.rb
index 6ebcaf4945..1be75ba014 100644
--- a/spec/unit/knife/data_bag_edit_spec.rb
+++ b/spec/unit/knife/data_bag_edit_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "tempfile"
describe Chef::Knife::DataBagEdit do
diff --git a/spec/unit/knife/data_bag_from_file_spec.rb b/spec/unit/knife/data_bag_from_file_spec.rb
index 12211eede3..4d7c506d0d 100644
--- a/spec/unit/knife/data_bag_from_file_spec.rb
+++ b/spec/unit/knife/data_bag_from_file_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/data_bag_item"
require "chef/encrypted_data_bag_item"
diff --git a/spec/unit/knife/data_bag_secret_options_spec.rb b/spec/unit/knife/data_bag_secret_options_spec.rb
index e8f99c3f79..9946b82110 100644
--- a/spec/unit/knife/data_bag_secret_options_spec.rb
+++ b/spec/unit/knife/data_bag_secret_options_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife"
require "chef/config"
require "tempfile"
diff --git a/spec/unit/knife/data_bag_show_spec.rb b/spec/unit/knife/data_bag_show_spec.rb
index 2b806b8a65..0cc0bdf766 100644
--- a/spec/unit/knife/data_bag_show_spec.rb
+++ b/spec/unit/knife/data_bag_show_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/data_bag_item"
require "chef/encrypted_data_bag_item"
diff --git a/spec/unit/knife/environment_compare_spec.rb b/spec/unit/knife/environment_compare_spec.rb
index bfaeed0c82..001c725624 100644
--- a/spec/unit/knife/environment_compare_spec.rb
+++ b/spec/unit/knife/environment_compare_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::EnvironmentCompare do
before(:each) do
diff --git a/spec/unit/knife/environment_create_spec.rb b/spec/unit/knife/environment_create_spec.rb
index d54cab8dc9..0535276e9c 100644
--- a/spec/unit/knife/environment_create_spec.rb
+++ b/spec/unit/knife/environment_create_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::EnvironmentCreate do
before(:each) do
diff --git a/spec/unit/knife/environment_delete_spec.rb b/spec/unit/knife/environment_delete_spec.rb
index 643bf1cc13..e088f6a791 100644
--- a/spec/unit/knife/environment_delete_spec.rb
+++ b/spec/unit/knife/environment_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::EnvironmentDelete do
before(:each) do
diff --git a/spec/unit/knife/environment_edit_spec.rb b/spec/unit/knife/environment_edit_spec.rb
index 1feb1c05fd..f05de2cb2f 100644
--- a/spec/unit/knife/environment_edit_spec.rb
+++ b/spec/unit/knife/environment_edit_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::EnvironmentEdit do
before(:each) do
diff --git a/spec/unit/knife/environment_from_file_spec.rb b/spec/unit/knife/environment_from_file_spec.rb
index 2090ec7bbd..fb9329eb57 100644
--- a/spec/unit/knife/environment_from_file_spec.rb
+++ b/spec/unit/knife/environment_from_file_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
Chef::Knife::EnvironmentFromFile.load_deps
diff --git a/spec/unit/knife/environment_list_spec.rb b/spec/unit/knife/environment_list_spec.rb
index 7bb0e723aa..4f44a93f60 100644
--- a/spec/unit/knife/environment_list_spec.rb
+++ b/spec/unit/knife/environment_list_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::EnvironmentList do
before(:each) do
diff --git a/spec/unit/knife/environment_show_spec.rb b/spec/unit/knife/environment_show_spec.rb
index 8f67e593bc..536afcc058 100644
--- a/spec/unit/knife/environment_show_spec.rb
+++ b/spec/unit/knife/environment_show_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::EnvironmentShow do
before(:each) do
diff --git a/spec/unit/knife/key_create_spec.rb b/spec/unit/knife/key_create_spec.rb
index 12826ae7e2..91d3fc0f69 100644
--- a/spec/unit/knife/key_create_spec.rb
+++ b/spec/unit/knife/key_create_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/user_key_create"
require "chef/knife/client_key_create"
require "chef/knife/key_create"
diff --git a/spec/unit/knife/key_delete_spec.rb b/spec/unit/knife/key_delete_spec.rb
index fd39c7381a..ff669446bb 100644
--- a/spec/unit/knife/key_delete_spec.rb
+++ b/spec/unit/knife/key_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/user_key_delete"
require "chef/knife/client_key_delete"
require "chef/knife/key_delete"
diff --git a/spec/unit/knife/key_edit_spec.rb b/spec/unit/knife/key_edit_spec.rb
index b42503af59..ae58d281b7 100644
--- a/spec/unit/knife/key_edit_spec.rb
+++ b/spec/unit/knife/key_edit_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/user_key_edit"
require "chef/knife/client_key_edit"
require "chef/knife/key_edit"
diff --git a/spec/unit/knife/key_helper.rb b/spec/unit/knife/key_helper.rb
index 6dbfb567f4..c58d383703 100644
--- a/spec/unit/knife/key_helper.rb
+++ b/spec/unit/knife/key_helper.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
shared_examples_for "a knife key command" do
let(:stderr) { StringIO.new }
diff --git a/spec/unit/knife/key_list_spec.rb b/spec/unit/knife/key_list_spec.rb
index 51ed73b64f..3cb8a1c58d 100644
--- a/spec/unit/knife/key_list_spec.rb
+++ b/spec/unit/knife/key_list_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/user_key_list"
require "chef/knife/client_key_list"
require "chef/knife/key_list"
diff --git a/spec/unit/knife/key_show_spec.rb b/spec/unit/knife/key_show_spec.rb
index 6d1ca2ccc7..ace6dad990 100644
--- a/spec/unit/knife/key_show_spec.rb
+++ b/spec/unit/knife/key_show_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/user_key_show"
require "chef/knife/client_key_show"
require "chef/knife/key_show"
diff --git a/spec/unit/knife/node_bulk_delete_spec.rb b/spec/unit/knife/node_bulk_delete_spec.rb
index e23f286999..cf38d542fa 100644
--- a/spec/unit/knife/node_bulk_delete_spec.rb
+++ b/spec/unit/knife/node_bulk_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::NodeBulkDelete do
before(:each) do
diff --git a/spec/unit/knife/node_delete_spec.rb b/spec/unit/knife/node_delete_spec.rb
index e6c677c041..92932c0b6f 100644
--- a/spec/unit/knife/node_delete_spec.rb
+++ b/spec/unit/knife/node_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::NodeDelete do
before(:each) do
diff --git a/spec/unit/knife/node_edit_spec.rb b/spec/unit/knife/node_edit_spec.rb
index 7b2ebb5b2c..e89322d415 100644
--- a/spec/unit/knife/node_edit_spec.rb
+++ b/spec/unit/knife/node_edit_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
Chef::Knife::NodeEdit.load_deps
describe Chef::Knife::NodeEdit do
diff --git a/spec/unit/knife/node_environment_set_spec.rb b/spec/unit/knife/node_environment_set_spec.rb
index 6a6d48cc2f..c2d55d0ab1 100644
--- a/spec/unit/knife/node_environment_set_spec.rb
+++ b/spec/unit/knife/node_environment_set_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::NodeEnvironmentSet do
before(:each) do
diff --git a/spec/unit/knife/node_from_file_spec.rb b/spec/unit/knife/node_from_file_spec.rb
index 00d6dd5d1a..359b9726b6 100644
--- a/spec/unit/knife/node_from_file_spec.rb
+++ b/spec/unit/knife/node_from_file_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
Chef::Knife::NodeFromFile.load_deps
diff --git a/spec/unit/knife/node_list_spec.rb b/spec/unit/knife/node_list_spec.rb
index d594fffc14..baa79cb81f 100644
--- a/spec/unit/knife/node_list_spec.rb
+++ b/spec/unit/knife/node_list_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::NodeList do
before(:each) do
diff --git a/spec/unit/knife/node_policy_set_spec.rb b/spec/unit/knife/node_policy_set_spec.rb
index 40b1d2617d..5815da29df 100644
--- a/spec/unit/knife/node_policy_set_spec.rb
+++ b/spec/unit/knife/node_policy_set_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::NodePolicySet do
let(:node) do
diff --git a/spec/unit/knife/node_run_list_add_spec.rb b/spec/unit/knife/node_run_list_add_spec.rb
index 0148711fac..87b75d9818 100644
--- a/spec/unit/knife/node_run_list_add_spec.rb
+++ b/spec/unit/knife/node_run_list_add_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::NodeRunListAdd do
before(:each) do
diff --git a/spec/unit/knife/node_run_list_remove_spec.rb b/spec/unit/knife/node_run_list_remove_spec.rb
index 1974821728..0eff7c6d27 100644
--- a/spec/unit/knife/node_run_list_remove_spec.rb
+++ b/spec/unit/knife/node_run_list_remove_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::NodeRunListRemove do
before(:each) do
diff --git a/spec/unit/knife/node_run_list_set_spec.rb b/spec/unit/knife/node_run_list_set_spec.rb
index 6246dfce6a..35fdd63e4d 100644
--- a/spec/unit/knife/node_run_list_set_spec.rb
+++ b/spec/unit/knife/node_run_list_set_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::NodeRunListSet do
before(:each) do
diff --git a/spec/unit/knife/node_show_spec.rb b/spec/unit/knife/node_show_spec.rb
index 037672501e..c26ae94f40 100644
--- a/spec/unit/knife/node_show_spec.rb
+++ b/spec/unit/knife/node_show_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::NodeShow do
diff --git a/spec/unit/knife/org_create_spec.rb b/spec/unit/knife/org_create_spec.rb
index 3c33817b55..f45ade2df7 100644
--- a/spec/unit/knife/org_create_spec.rb
+++ b/spec/unit/knife/org_create_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/org"
describe Chef::Knife::OrgCreate do
diff --git a/spec/unit/knife/org_delete_spec.rb b/spec/unit/knife/org_delete_spec.rb
index baa102f8c8..33311bd678 100644
--- a/spec/unit/knife/org_delete_spec.rb
+++ b/spec/unit/knife/org_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/org"
describe Chef::Knife::OrgDelete do
diff --git a/spec/unit/knife/org_edit_spec.rb b/spec/unit/knife/org_edit_spec.rb
index 05339e8f21..af9dae2c49 100644
--- a/spec/unit/knife/org_edit_spec.rb
+++ b/spec/unit/knife/org_edit_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::OrgEdit do
let(:knife) { Chef::Knife::OrgEdit.new }
diff --git a/spec/unit/knife/org_list_spec.rb b/spec/unit/knife/org_list_spec.rb
index de77b4b0c7..aa5fca5099 100644
--- a/spec/unit/knife/org_list_spec.rb
+++ b/spec/unit/knife/org_list_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/org"
describe Chef::Knife::OrgList do
diff --git a/spec/unit/knife/org_show_spec.rb b/spec/unit/knife/org_show_spec.rb
index 2f5246dd84..364b879a7c 100644
--- a/spec/unit/knife/org_show_spec.rb
+++ b/spec/unit/knife/org_show_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/org"
describe Chef::Knife::OrgShow do
diff --git a/spec/unit/knife/org_user_add_spec.rb b/spec/unit/knife/org_user_add_spec.rb
index 20e28d6919..72ee1d0607 100644
--- a/spec/unit/knife/org_user_add_spec.rb
+++ b/spec/unit/knife/org_user_add_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/org"
describe Chef::Knife::OrgUserAdd do
diff --git a/spec/unit/knife/raw_spec.rb b/spec/unit/knife/raw_spec.rb
index 1f88195e65..90a09a31e6 100644
--- a/spec/unit/knife/raw_spec.rb
+++ b/spec/unit/knife/raw_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::Raw do
let(:rest) do
diff --git a/spec/unit/knife/role_bulk_delete_spec.rb b/spec/unit/knife/role_bulk_delete_spec.rb
index 5af7c51584..f68efba57c 100644
--- a/spec/unit/knife/role_bulk_delete_spec.rb
+++ b/spec/unit/knife/role_bulk_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleBulkDelete do
before(:each) do
diff --git a/spec/unit/knife/role_create_spec.rb b/spec/unit/knife/role_create_spec.rb
index 0d563e40dd..13f47492b1 100644
--- a/spec/unit/knife/role_create_spec.rb
+++ b/spec/unit/knife/role_create_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleCreate do
before(:each) do
diff --git a/spec/unit/knife/role_delete_spec.rb b/spec/unit/knife/role_delete_spec.rb
index d43f99689d..658da5299d 100644
--- a/spec/unit/knife/role_delete_spec.rb
+++ b/spec/unit/knife/role_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleDelete do
before(:each) do
diff --git a/spec/unit/knife/role_edit_spec.rb b/spec/unit/knife/role_edit_spec.rb
index faf9cf7d84..adade177a7 100644
--- a/spec/unit/knife/role_edit_spec.rb
+++ b/spec/unit/knife/role_edit_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleEdit do
before(:each) do
diff --git a/spec/unit/knife/role_env_run_list_add_spec.rb b/spec/unit/knife/role_env_run_list_add_spec.rb
index 13a05db33e..b42ec6141f 100644
--- a/spec/unit/knife/role_env_run_list_add_spec.rb
+++ b/spec/unit/knife/role_env_run_list_add_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleEnvRunListAdd do
before(:each) do
diff --git a/spec/unit/knife/role_env_run_list_clear_spec.rb b/spec/unit/knife/role_env_run_list_clear_spec.rb
index d4b9625550..ad88d1ae37 100644
--- a/spec/unit/knife/role_env_run_list_clear_spec.rb
+++ b/spec/unit/knife/role_env_run_list_clear_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleEnvRunListClear do
before(:each) do
diff --git a/spec/unit/knife/role_env_run_list_remove_spec.rb b/spec/unit/knife/role_env_run_list_remove_spec.rb
index 7f9b41475c..8755ce452b 100644
--- a/spec/unit/knife/role_env_run_list_remove_spec.rb
+++ b/spec/unit/knife/role_env_run_list_remove_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleEnvRunListRemove do
before(:each) do
diff --git a/spec/unit/knife/role_env_run_list_replace_spec.rb b/spec/unit/knife/role_env_run_list_replace_spec.rb
index 93b233efdc..457f4efbd7 100644
--- a/spec/unit/knife/role_env_run_list_replace_spec.rb
+++ b/spec/unit/knife/role_env_run_list_replace_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleEnvRunListReplace do
before(:each) do
diff --git a/spec/unit/knife/role_env_run_list_set_spec.rb b/spec/unit/knife/role_env_run_list_set_spec.rb
index d35e4dbb17..34233398f5 100644
--- a/spec/unit/knife/role_env_run_list_set_spec.rb
+++ b/spec/unit/knife/role_env_run_list_set_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleEnvRunListSet do
before(:each) do
diff --git a/spec/unit/knife/role_from_file_spec.rb b/spec/unit/knife/role_from_file_spec.rb
index 51e94d31e3..6e2fdf7cfb 100644
--- a/spec/unit/knife/role_from_file_spec.rb
+++ b/spec/unit/knife/role_from_file_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
Chef::Knife::RoleFromFile.load_deps
diff --git a/spec/unit/knife/role_list_spec.rb b/spec/unit/knife/role_list_spec.rb
index dea2e874a4..f37a85b6dc 100644
--- a/spec/unit/knife/role_list_spec.rb
+++ b/spec/unit/knife/role_list_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleList do
before(:each) do
diff --git a/spec/unit/knife/role_run_list_add_spec.rb b/spec/unit/knife/role_run_list_add_spec.rb
index 6f222ee80a..7b038c2e81 100644
--- a/spec/unit/knife/role_run_list_add_spec.rb
+++ b/spec/unit/knife/role_run_list_add_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleRunListAdd do
before(:each) do
diff --git a/spec/unit/knife/role_run_list_clear_spec.rb b/spec/unit/knife/role_run_list_clear_spec.rb
index 327a9979b0..5479b01811 100644
--- a/spec/unit/knife/role_run_list_clear_spec.rb
+++ b/spec/unit/knife/role_run_list_clear_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleRunListClear do
before(:each) do
diff --git a/spec/unit/knife/role_run_list_remove_spec.rb b/spec/unit/knife/role_run_list_remove_spec.rb
index 200a559c08..353ae36c1a 100644
--- a/spec/unit/knife/role_run_list_remove_spec.rb
+++ b/spec/unit/knife/role_run_list_remove_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleRunListRemove do
before(:each) do
diff --git a/spec/unit/knife/role_run_list_replace_spec.rb b/spec/unit/knife/role_run_list_replace_spec.rb
index 1957403fb1..e59b704f00 100644
--- a/spec/unit/knife/role_run_list_replace_spec.rb
+++ b/spec/unit/knife/role_run_list_replace_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleRunListReplace do
before(:each) do
diff --git a/spec/unit/knife/role_run_list_set_spec.rb b/spec/unit/knife/role_run_list_set_spec.rb
index 06098c585e..b75f1ab377 100644
--- a/spec/unit/knife/role_run_list_set_spec.rb
+++ b/spec/unit/knife/role_run_list_set_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleRunListSet do
before(:each) do
diff --git a/spec/unit/knife/role_show_spec.rb b/spec/unit/knife/role_show_spec.rb
index fe48e2f940..a79cb40e81 100644
--- a/spec/unit/knife/role_show_spec.rb
+++ b/spec/unit/knife/role_show_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleShow do
let(:role) { "base" }
diff --git a/spec/unit/knife/ssh_spec.rb b/spec/unit/knife/ssh_spec.rb
index 8606045e8c..59015f024a 100644
--- a/spec/unit/knife/ssh_spec.rb
+++ b/spec/unit/knife/ssh_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "net/ssh"
require "net/ssh/multi"
diff --git a/spec/unit/knife/ssl_check_spec.rb b/spec/unit/knife/ssl_check_spec.rb
index 1165da4539..4412ee0be9 100644
--- a/spec/unit/knife/ssl_check_spec.rb
+++ b/spec/unit/knife/ssl_check_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "stringio"
describe Chef::Knife::SslCheck do
diff --git a/spec/unit/knife/ssl_fetch_spec.rb b/spec/unit/knife/ssl_fetch_spec.rb
index 2184994dc0..c2dc5bdade 100644
--- a/spec/unit/knife/ssl_fetch_spec.rb
+++ b/spec/unit/knife/ssl_fetch_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/ssl_fetch"
describe Chef::Knife::SslFetch do
diff --git a/spec/unit/knife/status_spec.rb b/spec/unit/knife/status_spec.rb
index 838e4c9600..f3b31c1897 100644
--- a/spec/unit/knife/status_spec.rb
+++ b/spec/unit/knife/status_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::Status do
before(:each) do
diff --git a/spec/unit/knife/supermarket_download_spec.rb b/spec/unit/knife/supermarket_download_spec.rb
index 5d15e74966..3796140d61 100644
--- a/spec/unit/knife/supermarket_download_spec.rb
+++ b/spec/unit/knife/supermarket_download_spec.rb
@@ -18,7 +18,7 @@
#
require "chef/knife/supermarket_download"
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::SupermarketDownload do
diff --git a/spec/unit/knife/supermarket_install_spec.rb b/spec/unit/knife/supermarket_install_spec.rb
index 03cc5d1992..6ebbbc005c 100644
--- a/spec/unit/knife/supermarket_install_spec.rb
+++ b/spec/unit/knife/supermarket_install_spec.rb
@@ -16,8 +16,9 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/supermarket_install"
+require "mixlib/archive"
describe Chef::Knife::SupermarketInstall do
let(:knife) { Chef::Knife::SupermarketInstall.new }
diff --git a/spec/unit/knife/supermarket_list_spec.rb b/spec/unit/knife/supermarket_list_spec.rb
index a1acccaaaa..bbaf733f44 100644
--- a/spec/unit/knife/supermarket_list_spec.rb
+++ b/spec/unit/knife/supermarket_list_spec.rb
@@ -17,7 +17,7 @@
#
require "chef/knife/supermarket_list"
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::SupermarketList do
let(:knife) { described_class.new }
diff --git a/spec/unit/knife/supermarket_search_spec.rb b/spec/unit/knife/supermarket_search_spec.rb
index cba2f615aa..18092f52c8 100644
--- a/spec/unit/knife/supermarket_search_spec.rb
+++ b/spec/unit/knife/supermarket_search_spec.rb
@@ -17,7 +17,7 @@
#
require "chef/knife/supermarket_search"
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::SupermarketSearch do
let(:knife) { described_class.new }
diff --git a/spec/unit/knife/supermarket_share_spec.rb b/spec/unit/knife/supermarket_share_spec.rb
index 088cef9dfd..d362edf3c0 100644
--- a/spec/unit/knife/supermarket_share_spec.rb
+++ b/spec/unit/knife/supermarket_share_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/supermarket_share"
require "chef/cookbook_uploader"
-require "chef/cookbook_site_streaming_uploader"
+require "chef/knife/core/cookbook_site_streaming_uploader"
describe Chef::Knife::SupermarketShare do
@@ -42,7 +42,7 @@ describe Chef::Knife::SupermarketShare do
@cookbook_uploader = Chef::CookbookUploader.new("herpderp", rest: "norest")
allow(Chef::CookbookUploader).to receive(:new).and_return(@cookbook_uploader)
allow(@cookbook_uploader).to receive(:validate_cookbooks).and_return(true)
- allow(Chef::CookbookSiteStreamingUploader).to receive(:create_build_dir).and_return(Dir.mktmpdir)
+ allow(Chef::Knife::Core::CookbookSiteStreamingUploader).to receive(:create_build_dir).and_return(Dir.mktmpdir)
allow(@knife).to receive(:shell_out!).and_return(true)
@stdout = StringIO.new
@@ -140,7 +140,7 @@ describe Chef::Knife::SupermarketShare do
context "when the --dry-run flag is specified" do
before do
- allow(Chef::CookbookSiteStreamingUploader).to receive(:create_build_dir).and_return("/var/tmp/dummy")
+ allow(Chef::Knife::Core::CookbookSiteStreamingUploader).to receive(:create_build_dir).and_return("/var/tmp/dummy")
@knife.config = { dry_run: true }
@so = instance_double("Mixlib::ShellOut")
allow(@knife).to receive(:shell_out!).and_return(@so)
@@ -165,7 +165,7 @@ describe Chef::Knife::SupermarketShare do
before(:each) do
@upload_response = double("Net::HTTPResponse")
- allow(Chef::CookbookSiteStreamingUploader).to receive(:post).and_return(@upload_response)
+ allow(Chef::Knife::Core::CookbookSiteStreamingUploader).to receive(:post).and_return(@upload_response)
allow(File).to receive(:open).and_return(true)
end
@@ -174,7 +174,7 @@ describe Chef::Knife::SupermarketShare do
response_text = Chef::JSONCompat.to_json({ uri: "https://supermarket.chef.io/cookbooks/cookbook_name" })
allow(@upload_response).to receive(:body).and_return(response_text)
allow(@upload_response).to receive(:code).and_return(201)
- expect(Chef::CookbookSiteStreamingUploader).to receive(:post).with(/supermarket\.chef\.io/, anything, anything, anything)
+ expect(Chef::Knife::Core::CookbookSiteStreamingUploader).to receive(:post).with(/supermarket\.chef\.io/, anything, anything, anything)
@knife.run
end
diff --git a/spec/unit/knife/supermarket_unshare_spec.rb b/spec/unit/knife/supermarket_unshare_spec.rb
index 8ae4d03cb5..63682a663c 100644
--- a/spec/unit/knife/supermarket_unshare_spec.rb
+++ b/spec/unit/knife/supermarket_unshare_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/supermarket_unshare"
describe Chef::Knife::SupermarketUnshare do
diff --git a/spec/unit/knife/tag_create_spec.rb b/spec/unit/knife/tag_create_spec.rb
index a1a4923871..290b925f4e 100644
--- a/spec/unit/knife/tag_create_spec.rb
+++ b/spec/unit/knife/tag_create_spec.rb
@@ -1,4 +1,4 @@
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::TagCreate do
before(:each) do
diff --git a/spec/unit/knife/tag_delete_spec.rb b/spec/unit/knife/tag_delete_spec.rb
index 4201196de0..dd01fba50f 100644
--- a/spec/unit/knife/tag_delete_spec.rb
+++ b/spec/unit/knife/tag_delete_spec.rb
@@ -1,4 +1,4 @@
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::TagDelete do
before(:each) do
diff --git a/spec/unit/knife/tag_list_spec.rb b/spec/unit/knife/tag_list_spec.rb
index dceec9a5ea..5da7803e09 100644
--- a/spec/unit/knife/tag_list_spec.rb
+++ b/spec/unit/knife/tag_list_spec.rb
@@ -1,4 +1,4 @@
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::TagList do
before(:each) do
diff --git a/spec/unit/knife/user_create_spec.rb b/spec/unit/knife/user_create_spec.rb
index c69a668f7e..fb6a2c3ba0 100644
--- a/spec/unit/knife/user_create_spec.rb
+++ b/spec/unit/knife/user_create_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
Chef::Knife::UserCreate.load_deps
diff --git a/spec/unit/knife/user_delete_spec.rb b/spec/unit/knife/user_delete_spec.rb
index 4dd2665cda..57d4072c50 100644
--- a/spec/unit/knife/user_delete_spec.rb
+++ b/spec/unit/knife/user_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/org"
Chef::Knife::UserDelete.load_deps
diff --git a/spec/unit/knife/user_edit_spec.rb b/spec/unit/knife/user_edit_spec.rb
index 2fde328c0c..12e2f19561 100644
--- a/spec/unit/knife/user_edit_spec.rb
+++ b/spec/unit/knife/user_edit_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::UserEdit do
let(:knife) { Chef::Knife::UserEdit.new }
diff --git a/spec/unit/knife/user_list_spec.rb b/spec/unit/knife/user_list_spec.rb
index 63df590591..01013de352 100644
--- a/spec/unit/knife/user_list_spec.rb
+++ b/spec/unit/knife/user_list_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
Chef::Knife::UserList.load_deps
diff --git a/spec/unit/knife/user_password_spec.rb b/spec/unit/knife/user_password_spec.rb
index 098597a14c..139ed242de 100644
--- a/spec/unit/knife/user_password_spec.rb
+++ b/spec/unit/knife/user_password_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/org"
Chef::Knife::UserDelete.load_deps
diff --git a/spec/unit/knife/user_reregister_spec.rb b/spec/unit/knife/user_reregister_spec.rb
index 481415e432..9178996abf 100644
--- a/spec/unit/knife/user_reregister_spec.rb
+++ b/spec/unit/knife/user_reregister_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::UserReregister do
let(:knife) { Chef::Knife::UserReregister.new }
diff --git a/spec/unit/knife/user_show_spec.rb b/spec/unit/knife/user_show_spec.rb
index 30742d8c21..3bcbbcb648 100644
--- a/spec/unit/knife/user_show_spec.rb
+++ b/spec/unit/knife/user_show_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/org"
Chef::Knife::UserShow.load_deps
diff --git a/spec/unit/knife_spec.rb b/spec/unit/knife_spec.rb
index 88f36a3973..f3315f3cf5 100644
--- a/spec/unit/knife_spec.rb
+++ b/spec/unit/knife_spec.rb
@@ -21,7 +21,7 @@
module KnifeSpecs
end
-require "spec_helper"
+require "knife_spec_helper"
require "uri"
require "chef/knife/core/gem_glob_loader"
diff --git a/spec/unit/provider/service/arch_service_spec.rb b/spec/unit/provider/service/arch_service_spec.rb
index 026db3dc75..c92af83de5 100644
--- a/spec/unit/provider/service/arch_service_spec.rb
+++ b/spec/unit/provider/service/arch_service_spec.rb
@@ -44,6 +44,7 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do
describe "when first created" do
it "should set the current resources service name to the new resources service name" do
+ allow(@provider).to receive(:determine_current_status!)
allow(@provider).to receive(:shell_out).and_return(OpenStruct.new(exitstatus: 0, stdout: ""))
@provider.load_current_resource
expect(@provider.current_resource.service_name).to eq("chef")
diff --git a/spec/unit/provider/service/debian_service_spec.rb b/spec/unit/provider/service/debian_service_spec.rb
index d0cd048c4f..0ae1d28cd3 100644
--- a/spec/unit/provider/service/debian_service_spec.rb
+++ b/spec/unit/provider/service/debian_service_spec.rb
@@ -33,6 +33,7 @@ describe Chef::Provider::Service::Debian do
@pid, @stdin, @stdout, @stderr = nil, nil, nil, nil
allow(File).to receive(:exist?).with("/etc/init.d/chef").and_return true
+ allow(@provider).to receive(:determine_current_status!)
end
let(:init_lines) do