summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2021-01-28 17:43:01 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2021-01-28 17:43:01 -0800
commit4c80fed7a04a29036723691859b08d2751fd62bb (patch)
treee5185fe7af81f7bd820cfeaf9ee05dd12b55341b /spec
parent9defd339d60615fa5555f412581bd97e5bc3a070 (diff)
downloadchef-4c80fed7a04a29036723691859b08d2751fd62bb.tar.gz
Fix DNF version comparison buglcg/dnf-fix-tweak
Also suppresses a version comparison that normally fails when it is called on the dnf provider which was ignorable. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/provider/package/dnf/python_helper_spec.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/spec/unit/provider/package/dnf/python_helper_spec.rb b/spec/unit/provider/package/dnf/python_helper_spec.rb
index 1f94147273..197af4ead6 100644
--- a/spec/unit/provider/package/dnf/python_helper_spec.rb
+++ b/spec/unit/provider/package/dnf/python_helper_spec.rb
@@ -19,11 +19,17 @@ require "spec_helper"
# NOTE: most of the tests of this functionality are baked into the func tests for the dnf package provider
-describe Chef::Provider::Package::Dnf::PythonHelper do
+# run this test only for following platforms.
+exclude_test = !(%w{rhel fedora amazon}.include?(ohai[:platform_family]) && File.exist?("/usr/bin/dnf"))
+describe Chef::Provider::Package::Dnf::PythonHelper, :requires_root, external: exclude_test do
let(:helper) { Chef::Provider::Package::Dnf::PythonHelper.instance }
it "propagates stacktraces on stderr from the forked subprocess", :rhel do
allow(helper).to receive(:dnf_command).and_return("ruby -e 'raise \"your hands in the air\"'")
expect { helper.package_query(:whatprovides, "tcpdump") }.to raise_error(/your hands in the air/)
end
+
+ it "compares EVRAs with dots in the release correctly" do
+ expect(helper.compare_versions("0:1.8.29-6.el8.x86_64", "0:1.8.29-6.el8_3.1.x86_64")).to eql(-1)
+ end
end