summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Duffield <tom@chef.io>2017-02-07 09:15:05 -0600
committerTom Duffield <tom@chef.io>2017-02-07 09:15:05 -0600
commitc0350147ecf2a8dd2c7fd2e3c1279ee4a920ec18 (patch)
tree28fe172e95e65892563963ead69279360bdfad5f
parentb1d3d41697b99ea8d4615c6cca5776c9276bc0be (diff)
downloadchef-c0350147ecf2a8dd2c7fd2e3c1279ee4a920ec18.tar.gz
Add specs to cover yum_package failure scenarios
Signed-off-by: Tom Duffield <tom@chef.io>
-rw-r--r--spec/unit/provider/package/yum_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/unit/provider/package/yum_spec.rb b/spec/unit/provider/package/yum_spec.rb
index 23a28c6d37..2bb0d3dffe 100644
--- a/spec/unit/provider/package/yum_spec.rb
+++ b/spec/unit/provider/package/yum_spec.rb
@@ -559,6 +559,15 @@ describe Chef::Provider::Package::Yum do
@provider.install_package("cups", "1.2.4-11.19.el5")
end
+ it "should run yum install with package name+arch" do
+ @provider.load_current_resource
+ allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
+ expect(@provider).to receive(:yum_command).with(
+ "-d0 -e0 -y install cups-1.2.4-11.19.el5.i386"
+ )
+ @provider.install_package("cups.i386", "1.2.4-11.19.el5")
+ end
+
it "installs the package with the options given in the resource" do
@provider.load_current_resource
allow(@provider).to receive(:candidate_version).and_return("11")
@@ -774,6 +783,15 @@ describe Chef::Provider::Package::Yum do
)
@provider.remove_package("emacs", "1.0")
end
+
+ describe "when package name has arch in it" do
+ it "should run yum remove with the package name and arc" do
+ expect(@provider).to receive(:yum_command).with(
+ "-d0 -e0 -y remove emacs-1.0.x86_64"
+ )
+ @provider.remove_package("emacs.x86_64", "1.0")
+ end
+ end
end
describe "when purging a package" do