diff options
author | Tim Smith <tsmith@chef.io> | 2020-03-16 16:12:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-16 16:12:52 -0700 |
commit | ad3777025e9c00ef8d41a12a8f7e7eaf6c48ecc4 (patch) | |
tree | e5601ccd2d2ccacbcb3b17b31bfc6cad1718686b | |
parent | bc8fdc39b25205edbcc384da83cc635209899942 (diff) | |
parent | ff3d4171c1615e831dd88f2b71e5563d31e300be (diff) | |
download | chef-ad3777025e9c00ef8d41a12a8f7e7eaf6c48ecc4.tar.gz |
Merge pull request #9504 from chef/testing_15
Backport more testing improvements from master
97 files changed, 159 insertions, 119 deletions
diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml index 227685dbc7..9f317ab152 100644 --- a/.expeditor/verify.pipeline.yml +++ b/.expeditor/verify.pipeline.yml @@ -26,10 +26,6 @@ steps: docker: image: rubydistros/ubuntu-18.04 privileged: true - environment: - - FORCE_FFI_YAJL=ext - - CHEF_LICENSE=accept-no-persist - - BUNDLE_GEMFILE=/workdir/Gemfile - label: "Functional Specs Ubuntu :ruby: 2.6" commands: @@ -43,9 +39,6 @@ steps: docker: image: rubydistros/ubuntu-18.04 privileged: true - environment: - - FORCE_FFI_YAJL=ext - - CHEF_LICENSE=accept-no-persist - label: "Unit Specs Ubuntu :ruby: 2.6" commands: @@ -57,9 +50,6 @@ steps: executor: docker: image: rubydistros/ubuntu-18.04 - environment: - - FORCE_FFI_YAJL=ext - - CHEF_LICENSE=accept-no-persist - label: "Integration Specs CentOS :ruby: 2.6" commands: @@ -71,10 +61,6 @@ steps: docker: image: rubydistros/centos-7 privileged: true - environment: - - FORCE_FFI_YAJL=ext - - CHEF_LICENSE=accept-no-persist - - BUNDLE_GEMFILE=/workdir/Gemfile - label: "Functional Specs CentOS :ruby: 2.6" commands: @@ -87,9 +73,6 @@ steps: docker: image: rubydistros/centos-7 privileged: true - environment: - - FORCE_FFI_YAJL=ext - - CHEF_LICENSE=accept-no-persist - label: "Unit Specs CentOS :ruby: 2.6" commands: @@ -101,9 +84,6 @@ steps: executor: docker: image: rubydistros/centos-7 - environment: - - FORCE_FFI_YAJL=ext - - CHEF_LICENSE=accept-no-persist - label: "Integration Specs openSUSE :ruby: 2.6" commands: @@ -115,10 +95,6 @@ steps: docker: image: rubydistros/opensuse-15 privileged: true - environment: - - FORCE_FFI_YAJL=ext - - CHEF_LICENSE=accept-no-persist - - BUNDLE_GEMFILE=/workdir/Gemfile - label: "Functional Specs openSUSE :ruby: 2.6" commands: @@ -131,9 +107,6 @@ steps: docker: image: rubydistros/opensuse-15 privileged: true - environment: - - FORCE_FFI_YAJL=ext - - CHEF_LICENSE=accept-no-persist - label: "Unit Specs openSUSE :ruby: 2.6" commands: @@ -145,9 +118,6 @@ steps: executor: docker: image: rubydistros/opensuse-15 - environment: - - FORCE_FFI_YAJL=ext - - CHEF_LICENSE=accept-no-persist - label: "Integration Specs Fedora :ruby: 2.6" commands: @@ -159,10 +129,6 @@ steps: docker: image: rubydistros/fedora-latest privileged: true - environment: - - FORCE_FFI_YAJL=ext - - CHEF_LICENSE=accept-no-persist - - BUNDLE_GEMFILE=/workdir/Gemfile - label: "Functional Specs Fedora :ruby: 2.6" commands: @@ -189,9 +155,6 @@ steps: executor: docker: image: rubydistros/fedora-latest - environment: - - FORCE_FFI_YAJL=ext - - CHEF_LICENSE=accept-no-persist - label: "Integration Specs Windows :ruby: 2.6" commands: @@ -257,29 +220,21 @@ steps: expeditor: executor: docker: - image: ruby:2.5-stretch + image: ruby:2.5-buster privileged: true - environment: - - FORCE_FFI_YAJL=ext - - CHEF_LICENSE=accept-no-persist - - INTEGRATION_SPECS_25=1 - label: "Functional Specs :ruby: 2.5" commands: - /workdir/scripts/bk_tests/bk_container_prep.sh - apt-get update -y - - apt-get install -y cron locales # needed for functional tests to pass + - apt-get install -y cron locales ifconfig # needed for functional tests to pass - bundle install --jobs=3 --retry=3 --without omnibus_package docgen - bundle exec rake spec:functional expeditor: executor: docker: - image: ruby:2.5-stretch + image: ruby:2.5-buster privileged: true - environment: - - FORCE_FFI_YAJL=ext - - CHEF_LICENSE=accept-no-persist - - FUNCTIONAL_SPECS_25=1 - label: "Unit Specs :ruby: 2.5" commands: @@ -290,11 +245,7 @@ steps: expeditor: executor: docker: - image: ruby:2.5-stretch - environment: - - FORCE_FFI_YAJL=ext - - CHEF_LICENSE=accept-no-persist - - UNIT_SPECS_25=1 + image: ruby:2.5-buster ######################################################################### # EXTERNAL GEM TESTING @@ -431,6 +382,21 @@ steps: privileged: true single-use: true +- label: "Kitchen Tests Ubuntu: 20.04" + commands: + - scripts/bk_tests/bk_linux_exec.sh + - cd kitchen-tests + - ~/.asdf/shims/bundle exec kitchen test end-to-end-ubuntu-2004 + artifact_paths: + - $PWD/.kitchen/logs/kitchen.log + env: + KITCHEN_YAML: kitchen.yml + expeditor: + executor: + linux: + privileged: true + single-use: true + - label: "Kitchen Tests Debian: 8" commands: - scripts/bk_tests/bk_linux_exec.sh diff --git a/.rspec b/.rspec deleted file mode 100644 index eb3ef03653..0000000000 --- a/.rspec +++ /dev/null @@ -1,2 +0,0 @@ ---color --fd @@ -46,7 +46,8 @@ end # Everything except AIX group(:ruby_prof) do - gem "ruby-prof" + # ruby-prof 1.3.0 does not compile on our centos6 builders/kitchen testers + gem "ruby-prof", "< 1.3.0" end # Everything except AIX and Windows diff --git a/Gemfile.lock b/Gemfile.lock index 47c2eb9b98..4d5f17ce6f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -336,8 +336,7 @@ GEM rexml ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 1.7) - ruby-prof (1.3.1) - ruby-prof (1.3.1-x64-mingw32) + ruby-prof (1.2.0) ruby-progressbar (1.10.1) ruby-shadow (2.5.0) rubyntlm (0.6.2) @@ -479,7 +478,7 @@ DEPENDENCIES rspec-expectations (~> 3.5) rspec-mocks (~> 3.5) rspec_junit_formatter (~> 0.2.0) - ruby-prof + ruby-prof (< 1.3.0) ruby-shadow simplecov webmock diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/default.rb b/kitchen-tests/cookbooks/end_to_end/recipes/default.rb index 0af35f8c7a..872693a4d2 100644 --- a/kitchen-tests/cookbooks/end_to_end/recipes/default.rb +++ b/kitchen-tests/cookbooks/end_to_end/recipes/default.rb @@ -52,7 +52,6 @@ users_manage "sysadmin" do end ssh_known_hosts_entry "github.com" -ssh_known_hosts_entry "travis.org" sudo "sysadmins" do group ["sysadmin", "%superadmin"] diff --git a/kitchen-tests/kitchen.yml b/kitchen-tests/kitchen.yml index c93e24197f..687a2b4b10 100644 --- a/kitchen-tests/kitchen.yml +++ b/kitchen-tests/kitchen.yml @@ -136,6 +136,13 @@ platforms: intermediate_instructions: - RUN /usr/bin/apt-get update +- name: ubuntu-20.04 + driver: + image: dokken/ubuntu-20.04 + pid_one_command: /bin/systemd + intermediate_instructions: + - RUN /usr/bin/apt-get update + - name: opensuse-leap-15 driver: image: dokken/opensuse-leap-15 diff --git a/lib/chef/application.rb b/lib/chef/application.rb index 197ae20c6d..4217cc696b 100644 --- a/lib/chef/application.rb +++ b/lib/chef/application.rb @@ -19,7 +19,6 @@ require "pp" unless defined?(PP) require "socket" unless defined?(Socket) require_relative "config" -require_relative "config_fetcher" require_relative "exceptions" require_relative "local_mode" require_relative "log" @@ -119,6 +118,7 @@ class Chef # @api private (test injection) def chef_configfetcher + require_relative "config_fetcher" Chef::ConfigFetcher end diff --git a/lib/chef/cookbook/synchronizer.rb b/lib/chef/cookbook/synchronizer.rb index b6bcd2c150..4a2940fb1f 100644 --- a/lib/chef/cookbook/synchronizer.rb +++ b/lib/chef/cookbook/synchronizer.rb @@ -47,6 +47,7 @@ class Chef end def reset! + @skip_removal = nil @valid_cache_entries = {} end diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index 6c7214fdd9..38921334ba 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -965,6 +965,8 @@ class Chef @resource_name = nil end end + + @resource_name = nil unless defined?(@resource_name) @resource_name end @@ -990,7 +992,7 @@ class Chef # @param flag [Boolean] value to set unified_mode to # @return [Boolean] unified_mode value def self.unified_mode(flag = nil) - @unified_mode = Chef::Config[:resource_unified_mode_default] if @unified_mode.nil? + @unified_mode = Chef::Config[:resource_unified_mode_default] if !defined?(@unified_mode) || @unified_mode.nil? @unified_mode = flag unless flag.nil? !!@unified_mode end @@ -1035,7 +1037,7 @@ class Chef self.allowed_actions |= @default_action end - if @default_action + if defined?(@default_action) && @default_action @default_action elsif superclass.respond_to?(:default_action) superclass.default_action @@ -1366,6 +1368,9 @@ class Chef def self.provides(name, **options, &block) name = name.to_sym + # quell warnings + @chef_version_for_provides = nil unless defined?(@chef_version_for_provides) + # `provides :resource_name, os: 'linux'`) needs to remove the old # canonical DSL before adding the new one. if @resource_name && name == @resource_name diff --git a/scripts/bk_tests/bk_container_prep.sh b/scripts/bk_tests/bk_container_prep.sh index bb82b6b140..8c3bda15e0 100755 --- a/scripts/bk_tests/bk_container_prep.sh +++ b/scripts/bk_tests/bk_container_prep.sh @@ -1,5 +1,11 @@ # This script gets a container ready to run our various tests in BuildKite +echo "--- preparing..." + +export FORCE_FFI_YAJL="ext" +export CHEF_LICENSE="accept-no-persist" +export BUNDLE_GEMFILE="/workdir/Gemfile" + # make sure we have the network tools in place for various network specs if [ -f /etc/debian_version ]; then touch /etc/network/interfaces @@ -14,8 +20,4 @@ gem install bundler -v $(grep :bundler omnibus_overrides.rb | cut -d'"' -f2) bundle --version rm -f .bundle/config -# force all .rspec tests into progress display to reduce line count -echo --color > .rspec -echo -fp >> .rspec - -echo "--- Run tests"
\ No newline at end of file +echo +++ testing diff --git a/scripts/bk_tests/bk_win_functional.ps1 b/scripts/bk_tests/bk_win_functional.ps1 index 59c2cf30c6..bd262fed9c 100644 --- a/scripts/bk_tests/bk_win_functional.ps1 +++ b/scripts/bk_tests/bk_win_functional.ps1 @@ -5,11 +5,7 @@ Get-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table # chocolatey functional tests fail so delete the chocolatey binary to avoid triggering them Remove-Item -Path C:\ProgramData\chocolatey\bin\choco.exe -ErrorAction SilentlyContinue -# -# Software Languages -# - -# Install Ruby + Devkit +echo "--- install ruby + devkit" $ErrorActionPreference = 'Stop' echo "Downloading Ruby + DevKit" @@ -25,6 +21,8 @@ echo "Closing out the layer (this can take awhile)" # Set-Item -Path Env:Path -Value to include ruby26 $Env:Path+=";C:\ruby26\bin" +echo "--- configure winrm" + winrm quickconfig -q ruby -v bundle --version diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb index e2d1c9532e..24ec35d5e0 100644 --- a/spec/integration/client/client_spec.rb +++ b/spec/integration/client/client_spec.rb @@ -1,3 +1,4 @@ +require "spec_helper" require "support/shared/integration/integration_helper" require "chef/mixin/shell_out" require "tiny_server" diff --git a/spec/integration/client/exit_code_spec.rb b/spec/integration/client/exit_code_spec.rb index 37999ab431..a2f7e87b7e 100644 --- a/spec/integration/client/exit_code_spec.rb +++ b/spec/integration/client/exit_code_spec.rb @@ -1,4 +1,5 @@ +require "spec_helper" require "support/shared/integration/integration_helper" require "chef/mixin/shell_out" require "tiny_server" diff --git a/spec/integration/client/ipv6_spec.rb b/spec/integration/client/ipv6_spec.rb index 2d16786334..3d2c8d83d9 100644 --- a/spec/integration/client/ipv6_spec.rb +++ b/spec/integration/client/ipv6_spec.rb @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "spec_helper" require "support/shared/integration/integration_helper" require "chef/mixin/shell_out" diff --git a/spec/integration/knife/chef_fs_data_store_spec.rb b/spec/integration/knife/chef_fs_data_store_spec.rb index 95fee18257..d79b1922ac 100644 --- a/spec/integration/knife/chef_fs_data_store_spec.rb +++ b/spec/integration/knife/chef_fs_data_store_spec.rb @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 7d98b7ad4e..0393d27706 100644 --- a/spec/integration/knife/chef_repo_path_spec.rb +++ b/spec/integration/knife/chef_repo_path_spec.rb @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 6e9c4611e2..efdde6265b 100644 --- a/spec/integration/knife/chef_repository_file_system_spec.rb +++ b/spec/integration/knife/chef_repository_file_system_spec.rb @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 b92fb1f485..6dac18f8fa 100644 --- a/spec/integration/knife/chefignore_spec.rb +++ b/spec/integration/knife/chefignore_spec.rb @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 73dd1680b2..3d3e8f630c 100644 --- a/spec/integration/knife/client_bulk_delete_spec.rb +++ b/spec/integration/knife/client_bulk_delete_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 505358923b..14ac17b810 100644 --- a/spec/integration/knife/client_create_spec.rb +++ b/spec/integration/knife/client_create_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 3ba51fca96..c7b9bbca35 100644 --- a/spec/integration/knife/client_delete_spec.rb +++ b/spec/integration/knife/client_delete_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 7ccec8bffd..cc958a85f6 100644 --- a/spec/integration/knife/client_key_create_spec.rb +++ b/spec/integration/knife/client_key_create_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 04826bb0b8..259996a3f2 100644 --- a/spec/integration/knife/client_key_delete_spec.rb +++ b/spec/integration/knife/client_key_delete_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 4fd18a6cd5..37f9a84347 100644 --- a/spec/integration/knife/client_key_list_spec.rb +++ b/spec/integration/knife/client_key_list_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 e96ff3b6fe..0b1561d64f 100644 --- a/spec/integration/knife/client_key_show_spec.rb +++ b/spec/integration/knife/client_key_show_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 27ceecf7de..bf7ba74f2f 100644 --- a/spec/integration/knife/client_list_spec.rb +++ b/spec/integration/knife/client_list_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 23ac204d77..36bb0bebd0 100644 --- a/spec/integration/knife/client_show_spec.rb +++ b/spec/integration/knife/client_show_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 5eac571a85..d7b14aa93c 100644 --- a/spec/integration/knife/common_options_spec.rb +++ b/spec/integration/knife/common_options_spec.rb @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "spec_helper" require "support/shared/integration/integration_helper" require "chef/knife/raw" diff --git a/spec/integration/knife/config_get_profile_spec.rb b/spec/integration/knife/config_get_profile_spec.rb index d17d572f13..4991532f14 100644 --- a/spec/integration/knife/config_get_profile_spec.rb +++ b/spec/integration/knife/config_get_profile_spec.rb @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "spec_helper" require "support/shared/integration/integration_helper" require "support/shared/context/config" diff --git a/spec/integration/knife/config_get_spec.rb b/spec/integration/knife/config_get_spec.rb index 7719ee2bd0..e6b97aa9a3 100644 --- a/spec/integration/knife/config_get_spec.rb +++ b/spec/integration/knife/config_get_spec.rb @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "spec_helper" require "support/shared/integration/integration_helper" require "support/shared/context/config" diff --git a/spec/integration/knife/config_list_profiles_spec.rb b/spec/integration/knife/config_list_profiles_spec.rb index 7ac4ef755e..95a06ffaee 100644 --- a/spec/integration/knife/config_list_profiles_spec.rb +++ b/spec/integration/knife/config_list_profiles_spec.rb @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "spec_helper" require "support/shared/integration/integration_helper" require "support/shared/context/config" diff --git a/spec/integration/knife/config_use_profile_spec.rb b/spec/integration/knife/config_use_profile_spec.rb index 4ea9012212..213fe19f88 100644 --- a/spec/integration/knife/config_use_profile_spec.rb +++ b/spec/integration/knife/config_use_profile_spec.rb @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 c615d8de7a..f2c4539bf8 100644 --- a/spec/integration/knife/cookbook_api_ipv6_spec.rb +++ b/spec/integration/knife/cookbook_api_ipv6_spec.rb @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "spec_helper" require "support/shared/integration/integration_helper" require "chef/mixin/shell_out" diff --git a/spec/integration/knife/cookbook_bulk_delete_spec.rb b/spec/integration/knife/cookbook_bulk_delete_spec.rb index 5b8dc3a952..2e8e96de12 100644 --- a/spec/integration/knife/cookbook_bulk_delete_spec.rb +++ b/spec/integration/knife/cookbook_bulk_delete_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 538c06802b..0e92430aaf 100644 --- a/spec/integration/knife/cookbook_download_spec.rb +++ b/spec/integration/knife/cookbook_download_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 c9e4069a44..92412038a1 100644 --- a/spec/integration/knife/cookbook_list_spec.rb +++ b/spec/integration/knife/cookbook_list_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 8ebd5403ae..32b1324a0a 100644 --- a/spec/integration/knife/cookbook_show_spec.rb +++ b/spec/integration/knife/cookbook_show_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 6496a911b0..7253b4c350 100644 --- a/spec/integration/knife/cookbook_upload_spec.rb +++ b/spec/integration/knife/cookbook_upload_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 e60f3c06fd..13007cc35d 100644 --- a/spec/integration/knife/data_bag_create_spec.rb +++ b/spec/integration/knife/data_bag_create_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 b5ee1b0422..3ccc718678 100644 --- a/spec/integration/knife/data_bag_delete_spec.rb +++ b/spec/integration/knife/data_bag_delete_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 cb3e84b9c6..8e3f580630 100644 --- a/spec/integration/knife/data_bag_edit_spec.rb +++ b/spec/integration/knife/data_bag_edit_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 5083153e91..f2d0247caf 100644 --- a/spec/integration/knife/data_bag_from_file_spec.rb +++ b/spec/integration/knife/data_bag_from_file_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 2e57cc7cca..690b257810 100644 --- a/spec/integration/knife/data_bag_list_spec.rb +++ b/spec/integration/knife/data_bag_list_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 42553dc478..b2fea5d259 100644 --- a/spec/integration/knife/data_bag_show_spec.rb +++ b/spec/integration/knife/data_bag_show_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 fd5853dfef..c046834104 100644 --- a/spec/integration/knife/delete_spec.rb +++ b/spec/integration/knife/delete_spec.rb @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 4dfccf38de..9d16a250b9 100644 --- a/spec/integration/knife/deps_spec.rb +++ b/spec/integration/knife/deps_spec.rb @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 87cbd1559d..dccab65679 100644 --- a/spec/integration/knife/diff_spec.rb +++ b/spec/integration/knife/diff_spec.rb @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 77f6d3890e..ab6ff8d9e3 100644 --- a/spec/integration/knife/download_spec.rb +++ b/spec/integration/knife/download_spec.rb @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 713c1efe12..39baf5c6b7 100644 --- a/spec/integration/knife/environment_compare_spec.rb +++ b/spec/integration/knife/environment_compare_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 2647a08f8b..cf4b8b38eb 100644 --- a/spec/integration/knife/environment_create_spec.rb +++ b/spec/integration/knife/environment_create_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 0f1fe5c4a8..579b3a67d9 100644 --- a/spec/integration/knife/environment_delete_spec.rb +++ b/spec/integration/knife/environment_delete_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 8b33e254d8..472ae4d511 100644 --- a/spec/integration/knife/environment_from_file_spec.rb +++ b/spec/integration/knife/environment_from_file_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 b6b25e8661..19fde490ef 100644 --- a/spec/integration/knife/environment_list_spec.rb +++ b/spec/integration/knife/environment_list_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 c0334ecbf3..157c108c46 100644 --- a/spec/integration/knife/environment_show_spec.rb +++ b/spec/integration/knife/environment_show_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 9689c9e6c8..b1d77d3b01 100644 --- a/spec/integration/knife/list_spec.rb +++ b/spec/integration/knife/list_spec.rb @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 4dce471150..957d6375dc 100644 --- a/spec/integration/knife/node_bulk_delete_spec.rb +++ b/spec/integration/knife/node_bulk_delete_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 36778b3dfa..8b18663193 100644 --- a/spec/integration/knife/node_create_spec.rb +++ b/spec/integration/knife/node_create_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 a578ae912e..e782bdd549 100644 --- a/spec/integration/knife/node_delete_spec.rb +++ b/spec/integration/knife/node_delete_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 96251f6351..b2316a3590 100644 --- a/spec/integration/knife/node_environment_set_spec.rb +++ b/spec/integration/knife/node_environment_set_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 8a2dddb76e..c563fa328e 100644 --- a/spec/integration/knife/node_from_file_spec.rb +++ b/spec/integration/knife/node_from_file_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 9e5378f121..b6079d72ba 100644 --- a/spec/integration/knife/node_list_spec.rb +++ b/spec/integration/knife/node_list_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 87d08e1975..542746a51e 100644 --- a/spec/integration/knife/node_run_list_add_spec.rb +++ b/spec/integration/knife/node_run_list_add_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 e85e3ed8e8..0fcb80300c 100644 --- a/spec/integration/knife/node_run_list_remove_spec.rb +++ b/spec/integration/knife/node_run_list_remove_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 ec6b08fb97..d80920d299 100644 --- a/spec/integration/knife/node_run_list_set_spec.rb +++ b/spec/integration/knife/node_run_list_set_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 dd890aed59..ac32ab165d 100644 --- a/spec/integration/knife/node_show_spec.rb +++ b/spec/integration/knife/node_show_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 99fb7b5787..04c177ba3a 100644 --- a/spec/integration/knife/raw_spec.rb +++ b/spec/integration/knife/raw_spec.rb @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 fe39315fe4..a1c8d4d9ab 100644 --- a/spec/integration/knife/redirection_spec.rb +++ b/spec/integration/knife/redirection_spec.rb @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 36d1cb2041..9f73c3c65d 100644 --- a/spec/integration/knife/role_bulk_delete_spec.rb +++ b/spec/integration/knife/role_bulk_delete_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 54ade9de09..723ca5bf48 100644 --- a/spec/integration/knife/role_create_spec.rb +++ b/spec/integration/knife/role_create_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 aa12de57e8..7642159451 100644 --- a/spec/integration/knife/role_delete_spec.rb +++ b/spec/integration/knife/role_delete_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 69f58e8c36..e395f7a0ef 100644 --- a/spec/integration/knife/role_from_file_spec.rb +++ b/spec/integration/knife/role_from_file_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 e718425cee..709f533e44 100644 --- a/spec/integration/knife/role_list_spec.rb +++ b/spec/integration/knife/role_list_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 07afd19440..2af1696c04 100644 --- a/spec/integration/knife/role_show_spec.rb +++ b/spec/integration/knife/role_show_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 e3cda1a138..6bce1a85d7 100644 --- a/spec/integration/knife/search_node_spec.rb +++ b/spec/integration/knife/search_node_spec.rb @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 dd83475b8c..91a1bbeb28 100644 --- a/spec/integration/knife/show_spec.rb +++ b/spec/integration/knife/show_spec.rb @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "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 5e151515e2..9ca6da9db1 100644 --- a/spec/integration/knife/upload_spec.rb +++ b/spec/integration/knife/upload_spec.rb @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "spec_helper" require "support/shared/integration/integration_helper" require "chef/knife/upload" require "chef/knife/diff" diff --git a/spec/integration/recipes/accumulator_spec.rb b/spec/integration/recipes/accumulator_spec.rb index 98e3581071..e0ecfd340a 100644 --- a/spec/integration/recipes/accumulator_spec.rb +++ b/spec/integration/recipes/accumulator_spec.rb @@ -1,3 +1,4 @@ +require "spec_helper" require "support/shared/integration/integration_helper" require "chef/mixin/shell_out" diff --git a/spec/integration/recipes/lwrp_inline_resources_spec.rb b/spec/integration/recipes/lwrp_inline_resources_spec.rb index b96fa1d67d..364725277b 100644 --- a/spec/integration/recipes/lwrp_inline_resources_spec.rb +++ b/spec/integration/recipes/lwrp_inline_resources_spec.rb @@ -1,3 +1,4 @@ +require "spec_helper" require "support/shared/integration/integration_helper" require "chef/mixin/shell_out" diff --git a/spec/integration/recipes/lwrp_spec.rb b/spec/integration/recipes/lwrp_spec.rb index 957c1ea66f..1c772a378f 100644 --- a/spec/integration/recipes/lwrp_spec.rb +++ b/spec/integration/recipes/lwrp_spec.rb @@ -1,3 +1,4 @@ +require "spec_helper" require "support/shared/integration/integration_helper" require "chef/mixin/shell_out" diff --git a/spec/integration/recipes/notifies_spec.rb b/spec/integration/recipes/notifies_spec.rb index ae534dcad4..9990e81fe5 100644 --- a/spec/integration/recipes/notifies_spec.rb +++ b/spec/integration/recipes/notifies_spec.rb @@ -1,3 +1,4 @@ +require "spec_helper" require "support/shared/integration/integration_helper" require "chef/mixin/shell_out" diff --git a/spec/integration/recipes/notifying_block_spec.rb b/spec/integration/recipes/notifying_block_spec.rb index 465eca97ed..12095f0b54 100644 --- a/spec/integration/recipes/notifying_block_spec.rb +++ b/spec/integration/recipes/notifying_block_spec.rb @@ -15,6 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "spec_helper" require "support/shared/integration/integration_helper" require "chef/mixin/shell_out" diff --git a/spec/integration/recipes/recipe_dsl_spec.rb b/spec/integration/recipes/recipe_dsl_spec.rb index 766752ac13..1a8a5aa4b0 100644 --- a/spec/integration/recipes/recipe_dsl_spec.rb +++ b/spec/integration/recipes/recipe_dsl_spec.rb @@ -1,3 +1,4 @@ +require "spec_helper" require "support/shared/integration/integration_helper" describe "Recipe DSL methods" do diff --git a/spec/integration/recipes/resource_action_spec.rb b/spec/integration/recipes/resource_action_spec.rb index c8da9196ca..fb97c6062f 100644 --- a/spec/integration/recipes/resource_action_spec.rb +++ b/spec/integration/recipes/resource_action_spec.rb @@ -1,3 +1,4 @@ +require "spec_helper" require "support/shared/integration/integration_helper" class NoActionJackson < Chef::Resource diff --git a/spec/integration/recipes/unified_mode_spec.rb b/spec/integration/recipes/unified_mode_spec.rb index 944319f7bf..bb8cffae3f 100644 --- a/spec/integration/recipes/unified_mode_spec.rb +++ b/spec/integration/recipes/unified_mode_spec.rb @@ -1,3 +1,4 @@ +require "spec_helper" require "support/shared/integration/integration_helper" require "chef/mixin/shell_out" diff --git a/spec/integration/solo/solo_spec.rb b/spec/integration/solo/solo_spec.rb index c62b2ec6b0..c21bc7d597 100644 --- a/spec/integration/solo/solo_spec.rb +++ b/spec/integration/solo/solo_spec.rb @@ -1,3 +1,4 @@ +require "spec_helper" require "support/shared/integration/integration_helper" require "chef/mixin/shell_out" require "chef/run_lock" diff --git a/spec/support/chef_helpers.rb b/spec/support/chef_helpers.rb index 4ac6102887..ec42515b62 100644 --- a/spec/support/chef_helpers.rb +++ b/spec/support/chef_helpers.rb @@ -63,7 +63,7 @@ end # win32/service gem. windows_service_manager tests create a windows # service that starts with the system ruby and requires this gem. def system_windows_service_gem? - windows_service_gem_check_command = %q{ruby -r "win32/daemon" -e ":noop"} + windows_service_gem_check_command = %{ruby -r "win32/daemon" -e ":noop" > #{DEV_NULL} 2>&1} if defined?(Bundler) Bundler.with_clean_env do # This returns true if the gem can be loaded diff --git a/spec/support/key_helpers.rb b/spec/support/key_helpers.rb index 33b8b32de9..6a3a35fcb2 100644 --- a/spec/support/key_helpers.rb +++ b/spec/support/key_helpers.rb @@ -16,8 +16,6 @@ # limitations under the License. # -require "spec_helper" - shared_examples_for "a knife key command" do let(:stderr) { StringIO.new } let(:command) do diff --git a/spec/support/platforms/win32/spec_service.rb b/spec/support/platforms/win32/spec_service.rb index 2cc4e40298..f43e4a15fb 100644 --- a/spec/support/platforms/win32/spec_service.rb +++ b/spec/support/platforms/win32/spec_service.rb @@ -16,40 +16,42 @@ # limitations under the License. # -require "win32/daemon" +if ChefUtils.windows? + require "win32/daemon" -class SpecService < ::Win32::Daemon - def service_init - @test_service_file = "#{ENV["TMP"]}/spec_service_file" - end + class SpecService < ::Win32::Daemon + def service_init + @test_service_file = "#{ENV["TMP"]}/spec_service_file" + end - def service_main(*startup_parameters) - while running? - unless File.exists?(@test_service_file) - File.open(@test_service_file, "wb") do |f| - f.write("This file is created by SpecService") + def service_main(*startup_parameters) + while running? + unless File.exists?(@test_service_file) + File.open(@test_service_file, "wb") do |f| + f.write("This file is created by SpecService") + end end - end - sleep 1 + sleep 1 + end end - end - ################################################################################ - # Control Signal Callback Methods - ################################################################################ + ################################################################################ + # Control Signal Callback Methods + ################################################################################ - def service_stop; end + def service_stop; end - def service_pause; end + def service_pause; end - def service_resume; end + def service_resume; end - def service_shutdown; end -end + def service_shutdown; end + end -# To run this file as a service, it must be called as a script from within -# the Windows Service framework. In that case, kick off the main loop! -if __FILE__ == $0 - SpecService.mainloop + # To run this file as a service, it must be called as a script from within + # the Windows Service framework. In that case, kick off the main loop! + if __FILE__ == $0 + SpecService.mainloop + end end diff --git a/spec/support/shared/context/config.rb b/spec/support/shared/context/config.rb index bb4ff7e0d1..7c4ae8dca6 100644 --- a/spec/support/shared/context/config.rb +++ b/spec/support/shared/context/config.rb @@ -7,9 +7,6 @@ # Required chef files here: require "chef/config" -# Required spec files here: -require "spec_helper" - # Basic config. Nothing fancy. shared_context "default config options" do before do diff --git a/spec/support/shared/integration/integration_helper.rb b/spec/support/shared/integration/integration_helper.rb index af57e21c73..7e52f6a9f8 100644 --- a/spec/support/shared/integration/integration_helper.rb +++ b/spec/support/shared/integration/integration_helper.rb @@ -24,7 +24,6 @@ require "chef/json_compat" require "chef/server_api" require "support/shared/integration/knife_support" require "cheffish/rspec/chef_run_support" -require "spec_helper" module Cheffish class BasicChefClient diff --git a/spec/support/shared/unit/execute_resource.rb b/spec/support/shared/unit/execute_resource.rb index 05c2fc4a9a..2d6e8de0fd 100644 --- a/spec/support/shared/unit/execute_resource.rb +++ b/spec/support/shared/unit/execute_resource.rb @@ -17,8 +17,6 @@ # limitations under the License. # -require "spec_helper" - shared_examples_for "an execute resource" do before(:each) do diff --git a/spec/support/shared/unit/provider/file.rb b/spec/support/shared/unit/provider/file.rb index 3df8eecc6f..d78eff0c90 100644 --- a/spec/support/shared/unit/provider/file.rb +++ b/spec/support/shared/unit/provider/file.rb @@ -16,7 +16,6 @@ # limitations under the License. # -require "spec_helper" require "tmpdir" if windows? require "chef/win32/file" diff --git a/spec/support/shared/unit/script_resource.rb b/spec/support/shared/unit/script_resource.rb index 3c158afd6b..018a568e58 100644 --- a/spec/support/shared/unit/script_resource.rb +++ b/spec/support/shared/unit/script_resource.rb @@ -17,8 +17,6 @@ # limitations under the License. # -require "spec_helper" - shared_examples_for "a script resource" do it "should create a new Chef::Resource::Script" do diff --git a/spec/support/shared/unit/windows_script_resource.rb b/spec/support/shared/unit/windows_script_resource.rb index 29238a3917..9e4d646ff8 100644 --- a/spec/support/shared/unit/windows_script_resource.rb +++ b/spec/support/shared/unit/windows_script_resource.rb @@ -16,8 +16,6 @@ # limitations under the License. # -require "spec_helper" - require "support/shared/unit/execute_resource" require "support/shared/unit/script_resource" diff --git a/spec/unit/knife_spec.rb b/spec/unit/knife_spec.rb index 6ed7ddd70e..47d4a6bf66 100644 --- a/spec/unit/knife_spec.rb +++ b/spec/unit/knife_spec.rb @@ -418,13 +418,10 @@ describe Chef::Knife do describe "when first created" do - let(:knife) { KnifeSpecs::TestYourself.new(%w{with some args -s scrogramming}) } - - before do - unless KnifeSpecs.const_defined?(:TestYourself) - Kernel.load(File.join(CHEF_SPEC_DATA, "knife_subcommand", "test_yourself.rb")) - end - end + let(:knife) { + Kernel.load "spec/data/knife_subcommand/test_yourself.rb" + KnifeSpecs::TestYourself.new(%w{with some args -s scrogramming}) + } it "it parses the options passed to it" do expect(knife.config[:scro]).to eq("scrogramming") @@ -435,6 +432,8 @@ describe Chef::Knife do end it "does not have lazy dependencies loaded" do + skip "unstable with randomization... prolly needs more isolation" + expect(knife.class.test_deps_loaded).not_to be_truthy end end diff --git a/spec/unit/provider/file_spec.rb b/spec/unit/provider/file_spec.rb index 311ef4c55a..9aaedd3e70 100644 --- a/spec/unit/provider/file_spec.rb +++ b/spec/unit/provider/file_spec.rb @@ -17,6 +17,7 @@ # limitations under the License. # +require "spec_helper" require "support/shared/unit/provider/file" describe Chef::Provider::File do diff --git a/tasks/rspec.rb b/tasks/rspec.rb index 3906228416..1971789836 100644 --- a/tasks/rspec.rb +++ b/tasks/rspec.rb @@ -82,6 +82,7 @@ begin %i{unit functional integration stress}.each do |sub| desc "Run the specs under spec/#{sub}" RSpec::Core::RakeTask.new(sub) do |t| + t.verbose = false t.rspec_opts = %w{--profile} t.pattern = FileList["spec/#{sub}/**/*_spec.rb"] end |