summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-03-31 13:39:30 -0700
committerGitHub <noreply@github.com>2020-03-31 13:39:30 -0700
commit006f18781ad5ec7cb1b36df020e37564fac5812c (patch)
tree60ff079b598b2522fe80569455c54d6c1c9a2d56
parenta2339cc97f458b0a27001713bec23960dd6b9b01 (diff)
parentd56923bc3122bff96a4a96b068b4301e12f0f13b (diff)
downloadchef-006f18781ad5ec7cb1b36df020e37564fac5812c.tar.gz
Merge pull request #9555 from chef/net-tools-15
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 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