summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavin Taddeo <davin@chef.io>2020-07-15 14:09:15 -0400
committerDavin Taddeo <davin@chef.io>2020-07-15 14:09:15 -0400
commit9bdf2b344af5b98905f8bc5b4744cc9d2830b08d (patch)
tree126962b91215a5cab72c1e4394050e1b87b7a748
parent90c9c18ae56baa10daf77dcd4f52846657a7e38f (diff)
parent885e007cfc4381ac4a22f988e154ed2325636366 (diff)
downloadchef-9bdf2b344af5b98905f8bc5b4744cc9d2830b08d.tar.gz
Merge branch 'master' of github.com:chef/chef into windows_firewall_profile
-rw-r--r--CHANGELOG.md14
-rw-r--r--Gemfile.lock36
-rw-r--r--VERSION2
-rw-r--r--chef-bin/chef-bin.gemspec1
-rw-r--r--chef-bin/lib/chef-bin/version.rb2
-rw-r--r--chef-config/chef-config.gemspec1
-rw-r--r--chef-config/lib/chef-config/version.rb2
-rw-r--r--chef-utils/chef-utils.gemspec1
-rw-r--r--chef-utils/lib/chef-utils/version.rb2
-rw-r--r--lib/chef/http/authenticator.rb2
-rw-r--r--lib/chef/knife/cookbook_upload.rb8
-rw-r--r--lib/chef/provider/mount/solaris.rb1
-rw-r--r--lib/chef/provider/package/zypper.rb1
-rw-r--r--lib/chef/resource/execute.rb4
-rw-r--r--lib/chef/version.rb2
-rw-r--r--omnibus/Gemfile.lock12
-rwxr-xr-xomnibus/package-scripts/angrychef/postinst9
-rwxr-xr-xomnibus/package-scripts/angrychef/postrm8
-rwxr-xr-xomnibus/package-scripts/chef/postinst9
-rwxr-xr-xomnibus/package-scripts/chef/postrm8
-rwxr-xr-xspec/functional/resource/aix_service_spec.rb1
-rwxr-xr-xspec/functional/resource/aixinit_service_spec.rb1
-rw-r--r--spec/functional/resource/apt_package_spec.rb1
-rw-r--r--spec/functional/resource/cron_spec.rb1
-rw-r--r--spec/functional/resource/insserv_spec.rb1
-rw-r--r--spec/integration/knife/cookbook_upload_spec.rb27
-rw-r--r--spec/spec_helper.rb1
-rw-r--r--spec/unit/chef_fs/file_system/operation_failed_error_spec.rb6
-rw-r--r--spec/unit/cookbook/gem_installer_spec.rb3
-rw-r--r--spec/unit/mixin/securable_spec.rb1
-rw-r--r--spec/unit/provider/package/rubygems_spec.rb15
-rw-r--r--spec/unit/provider/service/windows_spec.rb8
-rw-r--r--spec/unit/resource/execute_spec.rb10
33 files changed, 100 insertions, 101 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0343a672fd..51f460bc8a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,15 +1,23 @@
<!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ -->
-<!-- latest_release 16.3.4 -->
-## [v16.3.4](https://github.com/chef/chef/tree/v16.3.4) (2020-07-14)
+<!-- latest_release unreleased -->
+## Unreleased
#### Merged Pull Requests
-- Fix extra quote in habitat test pipeline config [#10156](https://github.com/chef/chef/pull/10156) ([christopher-snapp](https://github.com/christopher-snapp))
+- Workaround rubygems ssl test failure [#10160](https://github.com/chef/chef/pull/10160) ([phiggins](https://github.com/phiggins))
<!-- latest_release -->
<!-- release_rollup since=16.2.73 -->
### Changes not yet released to stable
#### Merged Pull Requests
+- Workaround rubygems ssl test failure [#10160](https://github.com/chef/chef/pull/10160) ([phiggins](https://github.com/phiggins)) <!-- 16.3.9 -->
+- Remove smartos detection / support in our package scripts [#10161](https://github.com/chef/chef/pull/10161) ([tas50](https://github.com/tas50)) <!-- 16.3.9 -->
+- Update to Chefstyle 1.2 + some fixes [#10158](https://github.com/chef/chef/pull/10158) ([tas50](https://github.com/tas50)) <!-- 16.3.8 -->
+- Don&#39;t allow setting expectations on nil. [#10154](https://github.com/chef/chef/pull/10154) ([phiggins](https://github.com/phiggins)) <!-- 16.3.7 -->
+- Use rspec constant stubbing. [#10155](https://github.com/chef/chef/pull/10155) ([phiggins](https://github.com/phiggins)) <!-- 16.3.7 -->
+- Bump the server api version to 2 [#10140](https://github.com/chef/chef/pull/10140) ([lamont-granquist](https://github.com/lamont-granquist)) <!-- 16.3.7 -->
+- Fixed `knife cookbook upload -o` windows path issue [#10146](https://github.com/chef/chef/pull/10146) ([antima-gupta](https://github.com/antima-gupta)) <!-- 16.3.6 -->
+- Fix execute resource with integer user parameter. [#10157](https://github.com/chef/chef/pull/10157) ([phiggins](https://github.com/phiggins)) <!-- 16.3.5 -->
- Fix extra quote in habitat test pipeline config [#10156](https://github.com/chef/chef/pull/10156) ([christopher-snapp](https://github.com/christopher-snapp)) <!-- 16.3.4 -->
- Test and Promote Habitat builds on Linux [#10102](https://github.com/chef/chef/pull/10102) ([christopher-snapp](https://github.com/christopher-snapp)) <!-- 16.3.3 -->
- Fix two warnings in tests. [#10150](https://github.com/chef/chef/pull/10150) ([phiggins](https://github.com/phiggins)) <!-- 16.3.2 -->
diff --git a/Gemfile.lock b/Gemfile.lock
index b54dc9ff45..732e25ee75 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,10 +1,10 @@
GIT
remote: https://github.com/chef/chefstyle.git
- revision: d8d6cc3aa61b8ba9611be452f43618f5a6138ade
+ revision: 605f02c66120e999c00895fe3d53769472759aa5
branch: master
specs:
- chefstyle (1.1.2)
- rubocop (= 0.86.0)
+ chefstyle (1.2.0)
+ rubocop (= 0.88.0)
GIT
remote: https://github.com/chef/ohai.git
@@ -28,12 +28,12 @@ GIT
PATH
remote: .
specs:
- chef (16.3.4)
+ chef (16.3.9)
addressable
bcrypt_pbkdf (= 1.1.0.rc1)
bundler (>= 1.10)
- chef-config (= 16.3.4)
- chef-utils (= 16.3.4)
+ chef-config (= 16.3.9)
+ chef-utils (= 16.3.9)
chef-vault
chef-zero (>= 14.0.11)
diff-lcs (>= 1.2.4, < 1.4.0)
@@ -62,12 +62,12 @@ PATH
train-winrm (>= 0.2.5)
tty-screen (~> 0.6)
uuidtools (~> 2.1.5)
- chef (16.3.4-universal-mingw32)
+ chef (16.3.9-universal-mingw32)
addressable
bcrypt_pbkdf (= 1.1.0.rc1)
bundler (>= 1.10)
- chef-config (= 16.3.4)
- chef-utils (= 16.3.4)
+ chef-config (= 16.3.9)
+ chef-utils (= 16.3.9)
chef-vault
chef-zero (>= 14.0.11)
diff-lcs (>= 1.2.4, < 1.4.0)
@@ -112,15 +112,15 @@ PATH
PATH
remote: chef-bin
specs:
- chef-bin (16.3.4)
- chef (= 16.3.4)
+ chef-bin (16.3.9)
+ chef (= 16.3.9)
PATH
remote: chef-config
specs:
- chef-config (16.3.4)
+ chef-config (16.3.9)
addressable
- chef-utils (= 16.3.4)
+ chef-utils (= 16.3.9)
fuzzyurl
mixlib-config (>= 2.2.12, < 4.0)
mixlib-shellout (>= 2.0, < 4.0)
@@ -129,7 +129,7 @@ PATH
PATH
remote: chef-utils
specs:
- chef-utils (16.3.4)
+ chef-utils (16.3.9)
GEM
remote: https://rubygems.org/
@@ -228,7 +228,7 @@ GEM
ipaddress (0.8.3)
iso8601 (0.13.0)
json (2.3.1)
- json_schemer (0.2.11)
+ json_schemer (0.2.12)
ecma-re-validator (~> 0.2)
hana (~> 1.3)
regexp_parser (~> 1.5)
@@ -318,13 +318,13 @@ GEM
rspec_junit_formatter (0.2.3)
builder (< 4)
rspec-core (>= 2, < 4, != 2.12.0)
- rubocop (0.86.0)
+ rubocop (0.88.0)
parallel (~> 1.10)
- parser (>= 2.7.0.1)
+ parser (>= 2.7.1.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
rexml
- rubocop-ast (>= 0.0.3, < 1.0)
+ rubocop-ast (>= 0.1.0, < 1.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.1.0)
diff --git a/VERSION b/VERSION
index f0cc64aa12..50b2fb1e47 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-16.3.4 \ No newline at end of file
+16.3.9 \ No newline at end of file
diff --git a/chef-bin/chef-bin.gemspec b/chef-bin/chef-bin.gemspec
index 1e7c45d8e9..bbf57f3d21 100644
--- a/chef-bin/chef-bin.gemspec
+++ b/chef-bin/chef-bin.gemspec
@@ -1,4 +1,3 @@
-# coding: utf-8
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "chef-bin/version"
diff --git a/chef-bin/lib/chef-bin/version.rb b/chef-bin/lib/chef-bin/version.rb
index 11d9692024..edeb92764f 100644
--- a/chef-bin/lib/chef-bin/version.rb
+++ b/chef-bin/lib/chef-bin/version.rb
@@ -21,7 +21,7 @@
module ChefBin
CHEFBIN_ROOT = File.expand_path("..", __dir__)
- VERSION = "16.3.4".freeze
+ VERSION = "16.3.9".freeze
end
#
diff --git a/chef-config/chef-config.gemspec b/chef-config/chef-config.gemspec
index 6229acdade..6b4312c13d 100644
--- a/chef-config/chef-config.gemspec
+++ b/chef-config/chef-config.gemspec
@@ -1,4 +1,3 @@
-# coding: utf-8
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "chef-config/version"
diff --git a/chef-config/lib/chef-config/version.rb b/chef-config/lib/chef-config/version.rb
index 4230df129b..74dac4db51 100644
--- a/chef-config/lib/chef-config/version.rb
+++ b/chef-config/lib/chef-config/version.rb
@@ -15,5 +15,5 @@
module ChefConfig
CHEFCONFIG_ROOT = File.expand_path("..", __dir__)
- VERSION = "16.3.4".freeze
+ VERSION = "16.3.9".freeze
end
diff --git a/chef-utils/chef-utils.gemspec b/chef-utils/chef-utils.gemspec
index cbd745e991..0fd6ad668d 100644
--- a/chef-utils/chef-utils.gemspec
+++ b/chef-utils/chef-utils.gemspec
@@ -1,4 +1,3 @@
-# coding: utf-8
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "chef-utils/version"
diff --git a/chef-utils/lib/chef-utils/version.rb b/chef-utils/lib/chef-utils/version.rb
index 026ece80a4..197dc51ef8 100644
--- a/chef-utils/lib/chef-utils/version.rb
+++ b/chef-utils/lib/chef-utils/version.rb
@@ -15,5 +15,5 @@
module ChefUtils
CHEFUTILS_ROOT = File.expand_path("..", __dir__)
- VERSION = "16.3.4".freeze
+ VERSION = "16.3.9".freeze
end
diff --git a/lib/chef/http/authenticator.rb b/lib/chef/http/authenticator.rb
index c93c8121bc..e65e93d2ac 100644
--- a/lib/chef/http/authenticator.rb
+++ b/lib/chef/http/authenticator.rb
@@ -24,7 +24,7 @@ class Chef
class HTTP
class Authenticator
- DEFAULT_SERVER_API_VERSION = "1".freeze
+ DEFAULT_SERVER_API_VERSION = "2".freeze
attr_reader :signing_key_filename
attr_reader :raw_key
diff --git a/lib/chef/knife/cookbook_upload.rb b/lib/chef/knife/cookbook_upload.rb
index 14e8419bec..5a46972b43 100644
--- a/lib/chef/knife/cookbook_upload.rb
+++ b/lib/chef/knife/cookbook_upload.rb
@@ -34,10 +34,10 @@ class Chef
banner "knife cookbook upload [COOKBOOKS...] (options)"
option :cookbook_path,
- short: "-o PATH:PATH",
- long: "--cookbook-path PATH:PATH",
- description: "A colon-separated path to look for cookbooks in.",
- proc: lambda { |o| o.split(":") }
+ short: "-o 'PATH:PATH'",
+ long: "--cookbook-path 'PATH:PATH'",
+ description: "A delimited path to search for cookbooks. On Unix the delimiter is ':', on Windows it is ';'.",
+ proc: lambda { |o| o.split(File::PATH_SEPARATOR) }
option :freeze,
long: "--freeze",
diff --git a/lib/chef/provider/mount/solaris.rb b/lib/chef/provider/mount/solaris.rb
index 203efa2cd4..245e04f40e 100644
--- a/lib/chef/provider/mount/solaris.rb
+++ b/lib/chef/provider/mount/solaris.rb
@@ -1,4 +1,3 @@
-# Encoding: utf-8
# Author:: Hugo Fichter
# Author:: Lamont Granquist (<lamont@chef.io>)
# Author:: Joshua Timberman (<joshua@chef.io>)
diff --git a/lib/chef/provider/package/zypper.rb b/lib/chef/provider/package/zypper.rb
index 5532f89d1f..1096dcd044 100644
--- a/lib/chef/provider/package/zypper.rb
+++ b/lib/chef/provider/package/zypper.rb
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Authors:: Adam Jacob (<adam@chef.io>)
# Ionuț Arțăriși (<iartarisi@suse.cz>)
diff --git a/lib/chef/resource/execute.rb b/lib/chef/resource/execute.rb
index 2584a6e4b5..cc4837c901 100644
--- a/lib/chef/resource/execute.rb
+++ b/lib/chef/resource/execute.rb
@@ -630,11 +630,11 @@ class Chef
end
# if domain is provided in both username and domain
- if specified_user && ((specified_user.include? '\\') || (specified_user.include? "@")) && specified_domain
+ if specified_user.is_a?(String) && ((specified_user.include? '\\') || (specified_user.include? "@")) && specified_domain
raise ArgumentError, "The domain is provided twice. Username: `#{specified_user}`, Domain: `#{specified_domain}`. Please specify domain only once."
end
- if ! specified_user.nil? && specified_domain.nil?
+ if specified_user.is_a?(String) && specified_domain.nil?
# Splitting username of format: Domain\Username
domain_and_user = user.split('\\')
diff --git a/lib/chef/version.rb b/lib/chef/version.rb
index d9bffa48fc..c6f087915c 100644
--- a/lib/chef/version.rb
+++ b/lib/chef/version.rb
@@ -23,7 +23,7 @@ require_relative "version_string"
class Chef
CHEF_ROOT = File.expand_path("..", __dir__)
- VERSION = Chef::VersionString.new("16.3.4")
+ VERSION = Chef::VersionString.new("16.3.9")
end
#
diff --git a/omnibus/Gemfile.lock b/omnibus/Gemfile.lock
index 00c685a6f1..9d623a82e7 100644
--- a/omnibus/Gemfile.lock
+++ b/omnibus/Gemfile.lock
@@ -1,9 +1,9 @@
GIT
remote: https://github.com/chef/omnibus
- revision: 320d9350cdf39abdcc4c37d5bc2971b3c222a0a0
+ revision: 67f54efcae3ca08c7035b8835fd808f2d1c755de
branch: master
specs:
- omnibus (7.0.14)
+ omnibus (7.0.15)
aws-sdk-s3 (~> 1)
chef-cleanroom (~> 1.0)
chef-sugar (>= 3.3)
@@ -32,7 +32,7 @@ GEM
artifactory (3.0.15)
awesome_print (1.8.0)
aws-eventstream (1.1.0)
- aws-partitions (1.339.0)
+ aws-partitions (1.341.0)
aws-sdk-core (3.103.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
@@ -41,7 +41,7 @@ GEM
aws-sdk-kms (1.36.0)
aws-sdk-core (~> 3, >= 3.99.0)
aws-sigv4 (~> 1.1)
- aws-sdk-s3 (1.73.0)
+ aws-sdk-s3 (1.74.0)
aws-sdk-core (~> 3, >= 3.102.1)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.1)
@@ -230,7 +230,7 @@ GEM
wmi-lite (~> 1.0)
mixlib-versioning (1.2.12)
molinillo (0.6.6)
- multi_json (1.14.1)
+ multi_json (1.15.0)
multipart-post (2.1.1)
necromancer (0.5.1)
net-scp (3.0.0)
@@ -295,7 +295,7 @@ GEM
structured_warnings (0.4.0)
syslog-logger (1.6.8)
systemu (2.6.5)
- test-kitchen (2.5.2)
+ test-kitchen (2.5.3)
bcrypt_pbkdf (~> 1.0)
ed25519 (~> 1.2)
license-acceptance (~> 1.0, >= 1.0.11)
diff --git a/omnibus/package-scripts/angrychef/postinst b/omnibus/package-scripts/angrychef/postinst
index 5cf14075b9..2dccceff6c 100755
--- a/omnibus/package-scripts/angrychef/postinst
+++ b/omnibus/package-scripts/angrychef/postinst
@@ -26,14 +26,7 @@ is_darwin()
uname -v | grep "^Darwin" 2>&1 >/dev/null
}
-is_smartos()
-{
- uname -v | grep "^joyent" 2>&1 >/dev/null
-}
-
-if is_smartos; then
- PREFIX="/opt/local"
-elif is_darwin; then
+if is_darwin; then
PREFIX="/usr/local"
mkdir -p "$PREFIX/bin"
else
diff --git a/omnibus/package-scripts/angrychef/postrm b/omnibus/package-scripts/angrychef/postrm
index 0963b1d901..c8e057cb30 100755
--- a/omnibus/package-scripts/angrychef/postrm
+++ b/omnibus/package-scripts/angrychef/postrm
@@ -7,10 +7,6 @@
# this programming language. do not touch.
# - if you are under 40, get peer review from your elders.
-is_smartos() {
- uname -v | grep "^joyent" 2>&1 >/dev/null
-}
-
is_darwin() {
uname -v | grep "^Darwin" 2>&1 >/dev/null
}
@@ -24,9 +20,7 @@ is_suse() {
fi
}
-if is_smartos; then
- PREFIX="/opt/local"
-elif is_darwin; then
+if is_darwin; then
PREFIX="/usr/local"
else
PREFIX="/usr"
diff --git a/omnibus/package-scripts/chef/postinst b/omnibus/package-scripts/chef/postinst
index c1c5272902..d4e12a239e 100755
--- a/omnibus/package-scripts/chef/postinst
+++ b/omnibus/package-scripts/chef/postinst
@@ -26,14 +26,7 @@ is_darwin()
uname -v | grep "^Darwin" 2>&1 >/dev/null
}
-is_smartos()
-{
- uname -v | grep "^joyent" 2>&1 >/dev/null
-}
-
-if is_smartos; then
- PREFIX="/opt/local"
-elif is_darwin; then
+if is_darwin; then
PREFIX="/usr/local"
mkdir -p "$PREFIX/bin"
else
diff --git a/omnibus/package-scripts/chef/postrm b/omnibus/package-scripts/chef/postrm
index 0963b1d901..c8e057cb30 100755
--- a/omnibus/package-scripts/chef/postrm
+++ b/omnibus/package-scripts/chef/postrm
@@ -7,10 +7,6 @@
# this programming language. do not touch.
# - if you are under 40, get peer review from your elders.
-is_smartos() {
- uname -v | grep "^joyent" 2>&1 >/dev/null
-}
-
is_darwin() {
uname -v | grep "^Darwin" 2>&1 >/dev/null
}
@@ -24,9 +20,7 @@ is_suse() {
fi
}
-if is_smartos; then
- PREFIX="/opt/local"
-elif is_darwin; then
+if is_darwin; then
PREFIX="/usr/local"
else
PREFIX="/usr"
diff --git a/spec/functional/resource/aix_service_spec.rb b/spec/functional/resource/aix_service_spec.rb
index e7e6d0e822..ae29d54f2a 100755
--- a/spec/functional/resource/aix_service_spec.rb
+++ b/spec/functional/resource/aix_service_spec.rb
@@ -1,4 +1,3 @@
-# encoding: UTF-8
#
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
# Copyright:: Copyright (c) Chef Software Inc.
diff --git a/spec/functional/resource/aixinit_service_spec.rb b/spec/functional/resource/aixinit_service_spec.rb
index bb89277e40..6d1df895bf 100755
--- a/spec/functional/resource/aixinit_service_spec.rb
+++ b/spec/functional/resource/aixinit_service_spec.rb
@@ -1,4 +1,3 @@
-# encoding: UTF-8
#
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
# Copyright:: Copyright (c) Chef Software Inc.
diff --git a/spec/functional/resource/apt_package_spec.rb b/spec/functional/resource/apt_package_spec.rb
index 431c106cb0..228882a2e7 100644
--- a/spec/functional/resource/apt_package_spec.rb
+++ b/spec/functional/resource/apt_package_spec.rb
@@ -1,4 +1,3 @@
-# encoding: UTF-8
#
# Author:: Daniel DeLeo (<dan@chef.io>)
# Copyright:: Copyright (c) Chef Software Inc.
diff --git a/spec/functional/resource/cron_spec.rb b/spec/functional/resource/cron_spec.rb
index bd75a86558..009234f527 100644
--- a/spec/functional/resource/cron_spec.rb
+++ b/spec/functional/resource/cron_spec.rb
@@ -1,4 +1,3 @@
-# encoding: UTF-8
#
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
# Copyright:: Copyright (c) Chef Software Inc.
diff --git a/spec/functional/resource/insserv_spec.rb b/spec/functional/resource/insserv_spec.rb
index 788a46469b..bd3b98a1e2 100644
--- a/spec/functional/resource/insserv_spec.rb
+++ b/spec/functional/resource/insserv_spec.rb
@@ -1,4 +1,3 @@
-# encoding: UTF-8
#
# Author:: Dheeraj Dubey (<dheeraj.dubey@msystechnologies.com>)
# Copyright:: Copyright (c) Chef Software Inc.
diff --git a/spec/integration/knife/cookbook_upload_spec.rb b/spec/integration/knife/cookbook_upload_spec.rb
index 79a9efbfb7..7139f0accd 100644
--- a/spec/integration/knife/cookbook_upload_spec.rb
+++ b/spec/integration/knife/cookbook_upload_spec.rb
@@ -97,5 +97,32 @@ describe "knife cookbook upload", :workstation do
expect { knife("cookbook upload x -o #{cb_dir}") }.to raise_error(Chef::Exceptions::MetadataNotValid)
end
end
+
+ when_the_repository "has cookbooks at multiple paths" do
+
+ let(:cb_dir_first) do
+ File.join(@repository_dir, "cookbooks")
+ .gsub(File::SEPARATOR, File::ALT_SEPARATOR || File::SEPARATOR)
+ end
+
+ let(:cb_dir_second) do
+ File.join(@repository_dir, "test_cookbooks")
+ .gsub(File::SEPARATOR, File::ALT_SEPARATOR || File::SEPARATOR)
+ end
+
+ before(:each) do
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "test_cookbooks/y/metadata.rb", cb_metadata("y", "1.0.0")
+ end
+
+ it "knife cookbook upload with -o or --cookbook-path" do
+ knife("cookbook upload x y -o #{cb_dir_first}#{File::PATH_SEPARATOR}#{cb_dir_second}").should_succeed stderr: <<~EOM
+ Uploading x [1.0.0]
+ Uploading y [1.0.0]
+ Uploaded 2 cookbooks.
+ EOM
+ end
+
+ end
end
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 5dba5ea0be..fd74a191f1 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -125,6 +125,7 @@ RSpec.configure do |config|
end
config.mock_with :rspec do |c|
c.syntax = :expect
+ c.allow_message_expectations_on_nil = false
end
# Only run these tests on platforms that are also chef workstations
diff --git a/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb b/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb
index b34d102068..101a002003 100644
--- a/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb
+++ b/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb
@@ -25,11 +25,9 @@ describe Chef::ChefFS::FileSystem::OperationFailedError do
context "has a cause attribute and HTTP result code is 400" do
it "include error cause" do
- allow_message_expectations_on_nil
response_body = '{"error":["Invalid key test in request body"]}'
- allow(@response).to receive(:code).and_return("400")
- allow(@response).to receive(:body).and_return(response_body)
- exception = Net::HTTPClientException.new("(exception) unauthorized", @response)
+ response = double(:response, code: "400", body: response_body)
+ exception = Net::HTTPClientException.new("(exception) unauthorized", response)
expect do
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:write, self, exception), error_message
end.to raise_error(Chef::ChefFS::FileSystem::OperationFailedError, "#{error_message} cause: #{response_body}")
diff --git a/spec/unit/cookbook/gem_installer_spec.rb b/spec/unit/cookbook/gem_installer_spec.rb
index 2733dfc862..58843ac826 100644
--- a/spec/unit/cookbook/gem_installer_spec.rb
+++ b/spec/unit/cookbook/gem_installer_spec.rb
@@ -95,7 +95,8 @@ describe Chef::Cookbook::GemInstaller do
it "skip metadata installation when Chef::Config[:skip_gem_metadata_installation] is set to true" do
Chef::Config[:skip_gem_metadata_installation] = true
- expect(gem_installer.install).to_not receive(:shell_out!)
+ expect(gem_installer).to_not receive(:shell_out!)
+ expect(gem_installer.install).to be_nil
end
it "install metadata when Chef::Config[:skip_gem_metadata_installation] is not true" do
diff --git a/spec/unit/mixin/securable_spec.rb b/spec/unit/mixin/securable_spec.rb
index 538241551a..4863693dba 100644
--- a/spec/unit/mixin/securable_spec.rb
+++ b/spec/unit/mixin/securable_spec.rb
@@ -1,4 +1,3 @@
-# encoding: UTF-8
#
# Author:: Mark Mzyk (<mmzyk@chef.io>)
# Copyright:: Copyright (c) Chef Software Inc.
diff --git a/spec/unit/provider/package/rubygems_spec.rb b/spec/unit/provider/package/rubygems_spec.rb
index 0a55ffd784..d2b2a66027 100644
--- a/spec/unit/provider/package/rubygems_spec.rb
+++ b/spec/unit/provider/package/rubygems_spec.rb
@@ -106,30 +106,25 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
context "new default rubygems behavior" do
before do
Chef::Config[:rubygems_cache_enabled] = false
+
+ dep_installer = Gem::DependencyInstaller.new
+ expect(dep_installer).not_to receive(:find_gems_with_sources)
+ allow(@gem_env).to receive(:dependency_installer).and_return(dep_installer)
end
it "finds a matching gem candidate version on rubygems 2.0.0+" do
dep = Gem::Dependency.new("rspec", ">= 0")
- dep_installer = Gem::DependencyInstaller.new
- allow(@gem_env).to receive(:dependency_installer).and_return(dep_installer)
- expect(dep_installer).not_to receive(:find_gems_with_sources).with(dep).and_call_original
expect(@gem_env.candidate_version_from_remote(dep)).to be_kind_of(Gem::Version)
end
it "gives the candidate version as nil if none is found" do
dep = Gem::Dependency.new("lksdjflksdjflsdkfj", ">= 0")
- dep_installer = Gem::DependencyInstaller.new
- allow(@gem_env).to receive(:dependency_installer).and_return(dep_installer)
- expect(dep_installer).not_to receive(:find_gems_with_sources).with(dep).and_call_original
expect(@gem_env.candidate_version_from_remote(dep)).to be_nil
end
it "finds a matching gem from a specific gemserver when explicit sources are given (to a server that doesn't respond to api requests)" do
dep = Gem::Dependency.new("rspec", ">= 0")
- dep_installer = Gem::DependencyInstaller.new
- allow(@gem_env).to receive(:dependency_installer).and_return(dep_installer)
- expect(dep_installer).not_to receive(:find_gems_with_sources).with(dep).and_call_original
- expect(@gem_env.candidate_version_from_remote(dep, "http://production.cf.rubygems.org")).to be_kind_of(Gem::Version)
+ expect(@gem_env.candidate_version_from_remote(dep, "https://rubygems.org")).to be_kind_of(Gem::Version)
end
end
diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb
index 9b52d93a32..b3a85715a8 100644
--- a/spec/unit/provider/service/windows_spec.rb
+++ b/spec/unit/provider/service/windows_spec.rb
@@ -22,12 +22,8 @@ require "spec_helper"
describe Chef::Provider::Service::Windows, "load_current_resource" do
include_context "Win32"
- before(:all) do
- Chef::ReservedNames::Win32::Security = Class.new unless windows?
- end
-
- after(:all) do
- Chef::ReservedNames::Win32.send(:remove_const, :Security) unless windows?
+ before do
+ stub_const("Chef::ReservedNames::Win32::Security", Class.new) unless windows?
end
let(:logger) { double("Mixlib::Log::Child").as_null_object }
diff --git a/spec/unit/resource/execute_spec.rb b/spec/unit/resource/execute_spec.rb
index 6c61beff34..0ce29da965 100644
--- a/spec/unit/resource/execute_spec.rb
+++ b/spec/unit/resource/execute_spec.rb
@@ -63,6 +63,16 @@ describe Chef::Resource::Execute do
expect(identity[:user]).to eq("user")
end
end
+
+ context "when username is passed as an integer" do
+ let(:username) { 499 }
+
+ it "correctly parses the user and domain" do
+ identity = resource.qualify_user(username, password, domain)
+ expect(identity[:domain]).to eq(nil)
+ expect(identity[:user]).to eq(499)
+ end
+ end
end
shared_examples_for "it received valid credentials" do