summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Barnett <jason.w.barnett@gmail.com>2021-09-23 12:34:59 -0600
committerJason Barnett <jason.w.barnett@gmail.com>2021-09-23 12:43:55 -0600
commit21a0f21a3231139ca4ca18f7bf4f0fd6f6bcd172 (patch)
tree64335177dc6395f298aae9e95dfe432c2b11c3cc
parent9aa2e3afc21285d3f81a0f089a27c67641936abc (diff)
downloadchef-21a0f21a3231139ca4ca18f7bf4f0fd6f6bcd172.tar.gz
Exclude running libarchive tests on platforms where loading libarchive is broken
Signed-off-by: Jason Barnett <jason.w.barnett@gmail.com>
-rw-r--r--spec/functional/resource/archive_file_spec.rb3
-rw-r--r--spec/spec_helper.rb2
-rw-r--r--spec/support/platform_helpers.rb4
-rw-r--r--spec/unit/resource/archive_file_spec.rb17
4 files changed, 22 insertions, 4 deletions
diff --git a/spec/functional/resource/archive_file_spec.rb b/spec/functional/resource/archive_file_spec.rb
index 1289bc0fad..27815cb319 100644
--- a/spec/functional/resource/archive_file_spec.rb
+++ b/spec/functional/resource/archive_file_spec.rb
@@ -18,7 +18,8 @@
require "spec_helper"
require "tmpdir"
-describe Chef::Resource::ArchiveFile do
+# Exclude this test on platforms where ffi-libarchive loading is broken
+describe Chef::Resource::ArchiveFile, :libarchive_loading_broken do
include RecipeDSLHelper
let(:tmp_path) { Dir.mktmpdir }
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index afcaf955c5..60b608e4ff 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -187,6 +187,8 @@ RSpec.configure do |config|
config.filter_run_excluding not_rhel7: true if rhel7?
config.filter_run_excluding not_intel_64bit: true if intel_64bit?
+ config.filter_run_excluding libarchive_loading_broken: true if aix? || amazon_linux? || rhel7?
+
# these let us use chef: ">= 13" or ruby: "~> 2.0.0" or any other Gem::Dependency-style constraint
config.filter_run_excluding chef: DependencyProc.with(Chef::VERSION)
config.filter_run_excluding ruby: DependencyProc.with(RUBY_VERSION)
diff --git a/spec/support/platform_helpers.rb b/spec/support/platform_helpers.rb
index a3fb95e069..1538a4eb34 100644
--- a/spec/support/platform_helpers.rb
+++ b/spec/support/platform_helpers.rb
@@ -163,6 +163,10 @@ def aix?
RUBY_PLATFORM.include?("aix")
end
+def amazon_linux?
+ ohai[:platform_family] == "amazon"
+end
+
def wpar?
!((ohai[:virtualization] || {})[:wpar_no].nil?)
end
diff --git a/spec/unit/resource/archive_file_spec.rb b/spec/unit/resource/archive_file_spec.rb
index 67fb3dc635..88cbe94629 100644
--- a/spec/unit/resource/archive_file_spec.rb
+++ b/spec/unit/resource/archive_file_spec.rb
@@ -16,10 +16,21 @@
#
require "spec_helper"
-require "ffi-libarchive"
-# Excluding this test on Windows until CI issues can be addressed.
-describe Chef::Resource::ArchiveFile do
+begin
+ require "ffi-libarchive"
+rescue LoadError
+ module Archive
+ class Reader
+ def close; end
+ def each_entry; end
+ def extract(entry, flags = 0, destination: nil); end
+ end
+ end
+end
+
+# Exclude this test on platforms where ffi-libarchive loading is broken
+describe Chef::Resource::ArchiveFile, :libarchive_loading_broken do
let(:node) { Chef::Node.new }
let(:events) { Chef::EventDispatch::Dispatcher.new }
let(:run_context) { Chef::RunContext.new(node, {}, events) }