summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-03-27 14:36:15 -0700
committerTim Smith <tsmith84@gmail.com>2020-03-27 14:36:15 -0700
commitb03fd1d8fca7df4149ee25bd17e5fdaf9fc4fb9c (patch)
treeea25d9feb83cc2314604522b8ed283f890dc0f59
parent5fd95b07d03105b98fe860bc772f7a58fd0a9927 (diff)
downloadchef-b03fd1d8fca7df4149ee25bd17e5fdaf9fc4fb9c.tar.gz
Skip the ifconfig functional tests if we don't have ifconfignet-tools
I'm looking at you Ubuntu 20.04 Signed-off-by: Tim Smith <tsmith@chef.io>
-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 54e0ef41b1..49e8d2f8f5 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");
@@ -198,7 +198,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 f9d8955f1e..e92da37043 100644
--- a/spec/support/platform_helpers.rb
+++ b/spec/support/platform_helpers.rb
@@ -270,6 +270,10 @@ rescue SocketError
false
end
+def ifconfig?
+ which("ifconfig")
+end
+
def choco_installed?
result = ShellHelpers.powershell_out("choco --version")
result.stderr.empty? ? true : false