diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-12-13 15:47:49 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-12-13 15:47:49 -0800 |
commit | 0b019e8df4a847c2bd33d297bae48281dc9d5373 (patch) | |
tree | 04802ea8e1756d3fa440af14f8a51618a9725f5a /spec | |
parent | 0b3ea900bbdc03abd2f0eafda64537968fd8f266 (diff) | |
download | chef-0b019e8df4a847c2bd33d297bae48281dc9d5373.tar.gz |
add some arch testing, fix a local install test
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/functional/resource/dnf_package_spec.rb | 82 |
1 files changed, 81 insertions, 1 deletions
diff --git a/spec/functional/resource/dnf_package_spec.rb b/spec/functional/resource/dnf_package_spec.rb index 1d32589fd4..487ddc5171 100644 --- a/spec/functional/resource/dnf_package_spec.rb +++ b/spec/functional/resource/dnf_package_spec.rb @@ -383,7 +383,7 @@ gpgcheck=0 end end - context "multipackage" do + context "multipackage with arches" do it "installs two rpms" do flush_cache dnf_package.package_name([ "chef_rpm.x86_64", "chef_rpm.i686" ] ) @@ -392,6 +392,75 @@ gpgcheck=0 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 + + it "does nothing if both are installed" do + preinstall("chef_rpm-1.10-1.fc24.x86_64.rpm", "chef_rpm-1.10-1.fc24.i686.rpm") + 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 false + end + + it "installs the second rpm if the first is installed" do + preinstall("chef_rpm-1.10-1.fc24.x86_64.rpm") + 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 + + it "installs the first rpm if the second is installed" do + preinstall("chef_rpm-1.10-1.fc24.i686.rpm") + 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 + + # unlikely to work consistently correct, okay to deprecate the arch-array in favor of the arch in the name + it "installs two rpms with multi-arch" do + skip "isn't going to work without major refactor" + flush_cache + dnf_package.package_name(%w{chef_rpm chef_rpm} ) + dnf_package.arch(%w{x86_64 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 + + # unlikely to work consistently correct, okay to deprecate the arch-array in favor of the arch in the name + it "installs the second rpm if the first is installed (muti-arch)" do + preinstall("chef_rpm-1.10-1.fc24.x86_64.rpm") + dnf_package.package_name(%w{chef_rpm chef_rpm} ) + dnf_package.arch(%w{x86_64 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 + + # unlikely to work consistently correct, okay to deprecate the arch-array in favor of the arch in the name + it "installs the first rpm if the second is installed (muti-arch)" do + preinstall("chef_rpm-1.10-1.fc24.x86_64.rpm") + dnf_package.package_name(%w{chef_rpm chef_rpm} ) + dnf_package.arch(%w{x86_64 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 + + # unlikely to work consistently correct, okay to deprecate the arch-array in favor of the arch in the name + it "does nothing if both are installed (muti-arch)" do + preinstall("chef_rpm-1.10-1.fc24.x86_64.rpm", "chef_rpm-1.10-1.fc24.i686.rpm") + dnf_package.package_name(%w{chef_rpm chef_rpm} ) + dnf_package.arch(%w{x86_64 i686}) + dnf_package.run_action(:install) + expect(dnf_package.updated_by_last_action?).to be false + end end end @@ -465,6 +534,7 @@ gpgcheck=0 it "works when a package is installed" do FileUtils.rm_f "/etc/yum.repos.d/chef-dnf-localtesting.repo" preinstall("chef_rpm-1.2-1.fc24.x86_64.rpm") + dnf_package.package_name("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.fc24.x86_64.rpm") dnf_package.run_action(:upgrade) expect(dnf_package.updated_by_last_action?).to be false expect(shell_out("rpm -q chef_rpm").stdout.chomp).to eql("chef_rpm-1.2-1.fc24.x86_64") @@ -561,6 +631,16 @@ gpgcheck=0 end end + context "with 32-bit arch" do + let(:package_name) { "chef_rpm.i686" } + it "removes only the 32-bit arch if both are installed" do + preinstall("chef_rpm-1.10-1.fc24.x86_64.rpm", "chef_rpm-1.10-1.fc24.i686.rpm") + dnf_package.run_action(:remove) + 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 + end + context "with no available version" do it "works when a package is installed" do FileUtils.rm_f "/etc/yum.repos.d/chef-dnf-localtesting.repo" |