summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan McLellan <btm@chef.io>2020-04-03 23:06:40 -0400
committerGitHub <noreply@github.com>2020-04-03 23:06:40 -0400
commita2ecce09a8417376d23139539bb121bebaca0249 (patch)
tree38d69d637fee2b02babfbe3bff82cc24503b2842
parent47ca299f03b9cc5f0ab3d12bb345546ddfb689b8 (diff)
parent5139c4b9666fed981db3ddd3500610a93e7b1467 (diff)
downloadchef-a2ecce09a8417376d23139539bb121bebaca0249.tar.gz
Merge pull request #9597 from chef/btm/14-skip-ifconfig
Skip the ifconfig functional tests if we don't have ifconfig
-rw-r--r--spec/functional/resource/ifconfig_spec.rb4
-rw-r--r--spec/spec_helper.rb4
-rw-r--r--spec/support/platform_helpers.rb4
3 files changed, 9 insertions, 3 deletions
diff --git a/spec/functional/resource/ifconfig_spec.rb b/spec/functional/resource/ifconfig_spec.rb
index 0a82e59137..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-2016, 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 c7672fe930..0903c96f84 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,6 +1,6 @@
#
# Author:: Adam Jacob (<adam@chef.io>)
-# Copyright:: Copyright 2008-2018, 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");
@@ -202,7 +202,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 ce9ec77502..815b90cac7 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