summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2021-01-28 17:43:01 -0800
committerTim Smith <tsmith84@gmail.com>2021-02-02 11:55:52 -0800
commit7a876de6abbd5fe7362f7544974392192845f32d (patch)
tree942006a9d8e81a535c5272653caaf77a712e12f5 /spec
parent96e1f6d3f52e0ce6e66087ede8b65bf342154a26 (diff)
downloadchef-7a876de6abbd5fe7362f7544974392192845f32d.tar.gz
Fix DNF version comparison bug
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