summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-09-02 19:19:13 -0700
committerGitHub <noreply@github.com>2020-09-02 19:19:13 -0700
commitba643bf089c6dd9a5d6df8e79c3adb24ec2833a1 (patch)
tree8388902646f13d9fcf6c8ef39209fb54d591d5e7
parentd5a27de2c6e0340bbfa8cc7cfa585fd5a3cd2b6e (diff)
parentb0374e890f7d152ea600e154fdccdea9f50c2414 (diff)
downloadchef-ba643bf089c6dd9a5d6df8e79c3adb24ec2833a1.tar.gz
Merge pull request #10378 from chef/big_sur15
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--.expeditor/release.omnibus.yml1
-rw-r--r--spec/functional/resource/link_spec.rb8
-rw-r--r--spec/functional/resource/user/dscl_spec.rb2
-rw-r--r--spec/functional/resource/user/mac_user_spec.rb2
-rw-r--r--spec/spec_helper.rb7
-rw-r--r--spec/support/platform_helpers.rb50
6 files changed, 21 insertions, 49 deletions
diff --git a/.expeditor/release.omnibus.yml b/.expeditor/release.omnibus.yml
index 730f1f92fa..e82dd1169a 100644
--- a/.expeditor/release.omnibus.yml
+++ b/.expeditor/release.omnibus.yml
@@ -39,6 +39,7 @@ builder-to-testers-map:
- mac_os_x-10.13-x86_64
- mac_os_x-10.14-x86_64
- mac_os_x-10.15-x86_64
+ - mac_os_x-11.0-x86_64
sles-12-s390x:
- sles-12-s390x
sles-12-x86_64:
diff --git a/spec/functional/resource/link_spec.rb b/spec/functional/resource/link_spec.rb
index 3ea4d7d824..df8d61b758 100644
--- a/spec/functional/resource/link_spec.rb
+++ b/spec/functional/resource/link_spec.rb
@@ -406,7 +406,7 @@ describe Chef::Resource::Link do
it "create errors out" do
if windows?
expect { resource.run_action(:create) }.to raise_error(Errno::EACCES)
- elsif os_x? || solaris? || freebsd? || aix?
+ elsif macos? || solaris? || freebsd? || aix?
expect { resource.run_action(:create) }.to raise_error(Errno::EPERM)
else
expect { resource.run_action(:create) }.to raise_error(Errno::EISDIR)
@@ -609,7 +609,7 @@ describe Chef::Resource::Link do
it "errors out" do
if windows?
expect { resource.run_action(:create) }.to raise_error(Errno::EACCES)
- elsif os_x? || solaris? || freebsd? || aix?
+ elsif macos? || solaris? || freebsd? || aix?
expect { resource.run_action(:create) }.to raise_error(Errno::EPERM)
else
expect { resource.run_action(:create) }.to raise_error(Errno::EISDIR)
@@ -656,7 +656,7 @@ describe Chef::Resource::Link do
end
context "and the link does not yet exist" do
it "links to the target file" do
- skip("OS X/FreeBSD/AIX/Solaris symlink? and readlink working on hard links to symlinks") if os_x? || freebsd? || aix? || solaris?
+ skip("macOS/FreeBSD/AIX/Solaris symlink? and readlink working on hard links to symlinks") if macos? || freebsd? || aix? || solaris?
resource.run_action(:create)
expect(File.exist?(target_file)).to be_truthy
# macOS gets angry about this sort of link. Bug in macOS, IMO.
@@ -675,7 +675,7 @@ describe Chef::Resource::Link do
end
context "and the link does not yet exist" do
it "links to the target file" do
- skip("OS X/FreeBSD/AIX/Solaris fails to create hardlinks to broken symlinks") if os_x? || freebsd? || aix? || solaris?
+ skip("macOS/FreeBSD/AIX/Solaris fails to create hardlinks to broken symlinks") if macos? || freebsd? || aix? || solaris?
resource.run_action(:create)
expect(File.exist?(target_file) || File.symlink?(target_file)).to be_truthy
expect(symlink?(target_file)).to be_truthy
diff --git a/spec/functional/resource/user/dscl_spec.rb b/spec/functional/resource/user/dscl_spec.rb
index 462e4aaa0b..50da812b0f 100644
--- a/spec/functional/resource/user/dscl_spec.rb
+++ b/spec/functional/resource/user/dscl_spec.rb
@@ -19,7 +19,7 @@ require "spec_helper"
require "chef/mixin/shell_out"
metadata = {
- macos_only: true,
+ macos_1013: true,
requires_root: true,
}
diff --git a/spec/functional/resource/user/mac_user_spec.rb b/spec/functional/resource/user/mac_user_spec.rb
index f383140d0a..dabc303afb 100644
--- a/spec/functional/resource/user/mac_user_spec.rb
+++ b/spec/functional/resource/user/mac_user_spec.rb
@@ -19,7 +19,7 @@ require "spec_helper"
require "chef/mixin/shell_out"
metadata = {
- macos_1014: true,
+ macos_gte_1014: true,
requires_root: true,
}
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 030d1f9913..7b8bb3cbb6 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -139,9 +139,10 @@ RSpec.configure do |config|
config.filter_run_excluding windows_only: true unless windows?
config.filter_run_excluding not_supported_on_windows: true if windows?
- config.filter_run_excluding not_supported_on_macos: true if mac_osx?
- config.filter_run_excluding macos_only: true unless mac_osx?
- config.filter_run_excluding macos_1014: true unless mac_osx_1014?
+ config.filter_run_excluding not_supported_on_macos: true if macos?
+ config.filter_run_excluding macos_only: true unless macos?
+ config.filter_run_excluding macos_1013: true unless macos_1013?
+ config.filter_run_excluding macos_gte_1014: true unless macos_gte_1014?
config.filter_run_excluding not_supported_on_aix: true if aix?
config.filter_run_excluding not_supported_on_solaris: true if solaris?
config.filter_run_excluding not_supported_on_gce: true if gce?
diff --git a/spec/support/platform_helpers.rb b/spec/support/platform_helpers.rb
index 7f95544f4c..26832602bc 100644
--- a/spec/support/platform_helpers.rb
+++ b/spec/support/platform_helpers.rb
@@ -3,7 +3,6 @@ require "chef/mixin/shell_out"
require "ohai/mixin/http_helper"
require "ohai/mixin/gce_metadata"
require "chef/mixin/powershell_out"
-require "chef/version_class"
class ShellHelpers
extend Chef::Mixin::ShellOut
@@ -100,39 +99,12 @@ def windows_user_right?(right)
Chef::ReservedNames::Win32::Security.get_account_right(ENV["USERNAME"]).include?(right)
end
-def mac_osx_106?
- if File.exists? "/usr/bin/sw_vers"
- result = ShellHelpers.shell_out("/usr/bin/sw_vers")
- result.stdout.each_line do |line|
- if line =~ /^ProductVersion:\s10.6.*$/
- return true
- end
- end
- end
-
- false
-end
-
-def mac_osx_1014?
- if mac_osx?
- ver = Chef::Version.new(ohai[:platform_version])
- return ver.major == 10 && ver.minor == 14
- end
-
- false
+def macos_1013?
+ macos? && Gem::Requirement.new("~> 10.13.0").satisfied_by?(Gem::Version.new(ohai[:platform_version]))
end
-def mac_osx?
- if File.exist? "/usr/bin/sw_vers"
- result = ShellHelpers.shell_out("/usr/bin/sw_vers")
- result.stdout.each_line do |line|
- if line =~ /^ProductName:\sMac OS X.*$/
- return true
- end
- end
- end
-
- false
+def macos_gte_1014?
+ macos? && Gem::Requirement.new(">= 10.14").satisfied_by?(Gem::Version.new(ohai[:platform_version]))
end
# detects if the hardware is 64-bit (evaluates to true in "WOW64" mode in a 32-bit app on a 64-bit system)
@@ -145,26 +117,24 @@ def windows32?
windows? && !windows64?
end
-# def jruby?
-
def unix?
!windows?
end
def linux?
- !!(RUBY_PLATFORM =~ /linux/)
+ RUBY_PLATFORM.match?(/linux/)
end
-def os_x?
- !!(RUBY_PLATFORM =~ /darwin/)
+def macos?
+ RUBY_PLATFORM.match?(/darwin/)
end
def solaris?
- !!(RUBY_PLATFORM =~ /solaris/)
+ RUBY_PLATFORM.match?(/solaris/)
end
def freebsd?
- !!(RUBY_PLATFORM =~ /freebsd/)
+ RUBY_PLATFORM.match?(/freebsd/)
end
def intel_64bit?
@@ -200,7 +170,7 @@ def debian_family?
end
def aix?
- !!(RUBY_PLATFORM =~ /aix/)
+ RUBY_PLATFORM.match?(/aix/)
end
def wpar?