diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-08-24 15:56:31 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-09-02 14:14:31 -0700 |
commit | 339d5e24ca33b5ed4b67a82e7bea4fde889693b2 (patch) | |
tree | b7df1b738eea118f573f2e01a27e63ab69513940 /spec | |
parent | ae4277185844f86f276ad9211d14d223b361a8e0 (diff) | |
download | chef-339d5e24ca33b5ed4b67a82e7bea4fde889693b2.tar.gz |
Run the User::MacUser and User::Dscl tests on the correct systems
Right now we attempt to run the dscl function specs on all macos systems, when only 10.13 still supports that. We're also only running the macuser functional specs on 10.14 even though that should be running on 10.15 as well. With the introduction of 11.0 the DSCL specs no longer run so we need this fix in order to move forward, but it also ensures we're correctly testing macos releases.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/functional/resource/user/dscl_spec.rb | 2 | ||||
-rw-r--r-- | spec/functional/resource/user/mac_user_spec.rb | 2 | ||||
-rw-r--r-- | spec/spec_helper.rb | 3 | ||||
-rw-r--r-- | spec/support/platform_helpers.rb | 15 |
4 files changed, 9 insertions, 13 deletions
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 035adc40ba..7b8bb3cbb6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -141,7 +141,8 @@ RSpec.configure do |config| config.filter_run_excluding not_supported_on_windows: true if windows? 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_1014: true unless macos_1014? + 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 5b3e586b44..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,14 +99,12 @@ def windows_user_right?(right) Chef::ReservedNames::Win32::Security.get_account_right(ENV["USERNAME"]).include?(right) end +def macos_1013? + macos? && Gem::Requirement.new("~> 10.13.0").satisfied_by?(Gem::Version.new(ohai[:platform_version])) +end -def macos_1014? - if macos? - ver = Chef::Version.new(ohai[:platform_version]) - return ver.major == 10 && ver.minor == 14 - 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) @@ -120,8 +117,6 @@ def windows32? windows? && !windows64? end -# def jruby? - def unix? !windows? end |