diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-03-27 14:36:15 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-03-31 13:17:02 -0700 |
commit | d56923bc3122bff96a4a96b068b4301e12f0f13b (patch) | |
tree | cf9baf21147c96db9c55f0b12a3972ab2c62b298 | |
parent | c1a8787e779f6afecd71b587fa3c320d3f3b4bb3 (diff) | |
download | chef-d56923bc3122bff96a4a96b068b4301e12f0f13b.tar.gz |
Skip the ifconfig functional tests if we don't have ifconfig
I'm looking at you Ubuntu 20.04
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | spec/functional/resource/ifconfig_spec.rb | 4 | ||||
-rw-r--r-- | spec/spec_helper.rb | 4 | ||||
-rw-r--r-- | spec/support/platform_helpers.rb | 4 |
3 files changed, 9 insertions, 3 deletions
diff --git a/spec/functional/resource/ifconfig_spec.rb b/spec/functional/resource/ifconfig_spec.rb index 23a5579311..6bb54d6276 100644 --- a/spec/functional/resource/ifconfig_spec.rb +++ b/spec/functional/resource/ifconfig_spec.rb @@ -1,6 +1,6 @@ # # Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>) -# Copyright:: Copyright 2013-2018, Chef Software Inc. +# Copyright:: Copyright 2013-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,7 @@ require "chef/mixin/shell_out" # run this test only for following platforms. include_flag = !(%w{amazon debian aix}.include?(ohai[:platform_family]) || (ohai[:platform_family] == "rhel" && ohai[:platform_version].to_i < 7)) -describe Chef::Resource::Ifconfig, :requires_root, external: include_flag do +describe Chef::Resource::Ifconfig, :requires_root, :requires_ifconfig, external: include_flag do include Chef::Mixin::ShellOut let(:new_resource) do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ade3ec9404..0b525fb630 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,6 @@ # # Author:: Adam Jacob (<adam@chef.io>) -# Copyright:: Copyright 2008-2019, Chef Software Inc. +# Copyright:: Copyright 2008-2020, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -200,7 +200,9 @@ RSpec.configure do |config| config.filter_run_excluding chef: DependencyProc.with(Chef::VERSION) config.filter_run_excluding ruby: DependencyProc.with(RUBY_VERSION) + # check for particular binaries we need config.filter_run_excluding choco_installed: true unless choco_installed? + config.filter_run_excluding requires_ifconfig: true unless ifconfig? running_platform_arch = `uname -m`.strip unless windows? diff --git a/spec/support/platform_helpers.rb b/spec/support/platform_helpers.rb index c92b3dca39..06df735fa3 100644 --- a/spec/support/platform_helpers.rb +++ b/spec/support/platform_helpers.rb @@ -275,6 +275,10 @@ rescue SocketError false end +def ifconfig? + which("ifconfig") +end + def choco_installed? result = ShellHelpers.powershell_out("choco --version") result.stderr.empty? ? true : false |