summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2019-07-19 11:19:26 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2019-07-19 11:22:16 -0700
commita4f2ed66decfa4dd5e7c66d0288953ca457cea3a (patch)
tree98d3fb7d45c0dc4ab19f67dd192d1104333083d2
parent6fadc4f6a7a6ec0995c8b1eec79edb01ef2430b2 (diff)
downloadchef-lcg/fix-dnf-rhel8.tar.gz
only test these on rhel >= 8 where they worklcg/fix-dnf-rhel8
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--spec/functional/resource/dnf_package_spec.rb10
-rw-r--r--spec/spec_helper.rb2
-rw-r--r--spec/support/platform_helpers.rb8
3 files changed, 15 insertions, 5 deletions
diff --git a/spec/functional/resource/dnf_package_spec.rb b/spec/functional/resource/dnf_package_spec.rb
index 392c3d4012..0e7009f003 100644
--- a/spec/functional/resource/dnf_package_spec.rb
+++ b/spec/functional/resource/dnf_package_spec.rb
@@ -1,5 +1,5 @@
#
-# Copyright:: Copyright 2016, Chef Software Inc.
+# Copyright:: Copyright 2016-2019, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -190,8 +190,8 @@ describe Chef::Resource::RpmPackage, :requires_root, external: exclude_test do
expect(shell_out("rpm -q chef_rpm").stdout.chomp).to eql("chef_rpm-1.10-1.x86_64")
end
- it "matches with a vr glob" do
- pending "doesn't work on command line either"
+ # only works on rhel >= 8, was broken on old dnf
+ it "matches with a vr glob", :rhel_gte_8 do
flush_cache
dnf_package.package_name("chef_rpm")
dnf_package.version("1.10-1*")
@@ -200,8 +200,8 @@ describe Chef::Resource::RpmPackage, :requires_root, external: exclude_test do
expect(shell_out("rpm -q chef_rpm").stdout.chomp).to eql("chef_rpm-1.10-1.x86_64")
end
- it "matches with an evr glob" do
- pending "doesn't work on command line either"
+ # only works on rhel >= 8, was broken on old dnf
+ it "matches with an evr glob", :rhel_gte_8 do
flush_cache
dnf_package.package_name("chef_rpm")
dnf_package.version("0:1.10-1*")
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 9b54761df5..5ab97a8320 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -188,6 +188,8 @@ RSpec.configure do |config|
config.filter_run_excluding rhel: true unless rhel?
config.filter_run_excluding rhel6: true unless rhel6?
config.filter_run_excluding rhel7: true unless rhel7?
+ config.filter_run_excluding rhel8: true unless rhel8?
+ config.filter_run_excluding rhel_gte_8: true unless rhel_gte_8?
config.filter_run_excluding intel_64bit: true unless intel_64bit?
config.filter_run_excluding not_rhel: true if rhel?
config.filter_run_excluding not_rhel6: true if rhel6?
diff --git a/spec/support/platform_helpers.rb b/spec/support/platform_helpers.rb
index 509ca6e71e..0b13169ac1 100644
--- a/spec/support/platform_helpers.rb
+++ b/spec/support/platform_helpers.rb
@@ -175,6 +175,14 @@ def rhel7?
rhel? && !!(ohai[:platform_version].to_i == 7)
end
+def rhel8?
+ rhel? && !!(ohai[:platform_version].to_i == 8)
+end
+
+def rhel_gte_8?
+ rhel? && !!(ohai[:platform_version].to_i >= 8)
+end
+
def debian_family?
!!(ohai[:platform_family] == "debian")
end