diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-12-02 15:09:30 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-12-13 13:31:51 -0800 |
commit | b4d24ddda8332a274fa9c3ea5eb72dc6807db298 (patch) | |
tree | 006c68b7653c75d9b9ca72615664378b3bd3dc9d | |
parent | 8e2824fcf3dc822b8ca4dc4b06df4979392ee050 (diff) | |
download | chef-b4d24ddda8332a274fa9c3ea5eb72dc6807db298.tar.gz |
arches were legit busted, fixing add a couple tests
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r-- | lib/chef/provider/package/dnf_helper.py | 6 | ||||
-rw-r--r-- | spec/functional/resource/dnf_package_spec.rb | 28 |
2 files changed, 31 insertions, 3 deletions
diff --git a/lib/chef/provider/package/dnf_helper.py b/lib/chef/provider/package/dnf_helper.py index 6295df5892..4f85dda898 100644 --- a/lib/chef/provider/package/dnf_helper.py +++ b/lib/chef/provider/package/dnf_helper.py @@ -46,8 +46,10 @@ def query(command): if 'arch' in command: q = q.filterm(arch__glob=command['arch']) - # FIXME: if the filter already selected the other arch this will be busted? - q = q.filter(arch=[ 'noarch', hawkey.detect_arch() ]) + # only apply the default arch query filter if it returns something + archq = q.filter(arch=[ 'noarch', hawkey.detect_arch() ]) + if len(archq.run()) > 0: + q = archq pkgs = dnf.query.latest_limit_pkgs(q, 1) diff --git a/spec/functional/resource/dnf_package_spec.rb b/spec/functional/resource/dnf_package_spec.rb index 1a94e28bf6..e17aec57ef 100644 --- a/spec/functional/resource/dnf_package_spec.rb +++ b/spec/functional/resource/dnf_package_spec.rb @@ -184,7 +184,22 @@ gpgcheck=0 end end - context "with arch property" do + context "with arches" do + it "installs with 64-bit arch in the name" do + flush_cache + dnf_package.package_name("chef_rpm.x86_64") + dnf_package.run_action(:install) + expect(dnf_package.updated_by_last_action?).to be true + expect(shell_out("rpm -q chef_rpm").stdout.chomp).to eql("chef_rpm-1.10-1.fc24.x86_64") + end + + it "installs with 32-bit arch in the name" do + flush_cache + dnf_package.package_name("chef_rpm.i686") + dnf_package.run_action(:install) + expect(dnf_package.updated_by_last_action?).to be true + expect(shell_out("rpm -q chef_rpm").stdout.chomp).to eql("chef_rpm-1.10-1.fc24.i686") + end end context "with constraints" do @@ -311,6 +326,17 @@ gpgcheck=0 expect(shell_out("rpm -q chef_rpm").stdout.chomp).to eql("chef_rpm-1.2-1.fc24.x86_64") end end + + context "multipackage" do + it "installs two rpms" do + flush_cache + dnf_package.package_name([ "chef_rpm.x86_64", "chef_rpm.i686" ] ) + dnf_package.run_action(:install) + expect(dnf_package.updated_by_last_action?).to be true + expect(shell_out("rpm -q chef_rpm").stdout.chomp).to match(/chef_rpm-1.10-1.fc24.x86_64/) + expect(shell_out("rpm -q chef_rpm").stdout.chomp).to match(/chef_rpm-1.10-1.fc24.i686/) + end + end end describe ":upgrade" do |