summaryrefslogtreecommitdiff
path: root/spec/functional
diff options
context:
space:
mode:
authorPhil Dibowitz <phil@ipom.com>2021-02-08 10:51:20 -0800
committerGitHub <noreply@github.com>2021-02-08 10:51:20 -0800
commit7a4fd1824fa0c6f03962d85ec5a87ded12f9794f (patch)
tree706093efbbe88e2aa9afbf986ed6e63ef5c916ae /spec/functional
parent63f877629afe6c3060a6af411531fe962ce1fdb3 (diff)
downloadchef-7a4fd1824fa0c6f03962d85ec5a87ded12f9794f.tar.gz
Fix downgrades in apt_package (#10993)
`apt_package` never even looks at `new_resource.version` when deciding what version to install. That's silly. This fixes that. It requires the version be exact (as the `yum_package` did for most of Chef's history), and if you specify a non-existent version, it'll raise an exception. The unit tests for this provider are a bit of a mess, so I kinda stuck in the tests where I could. ``` [2021-02-07T15:59:35-08:00] TRACE: apt_package[hub] installed version for hub is 2.14.2-1vcrs.1 [2021-02-07T15:59:35-08:00] TRACE: apt_package[hub] candidate version for hub is 2.14.2-1vcrs.1 [2021-02-07T15:59:35-08:00] TRACE: apt_package[hub] hub 2.14.2-1vcrs.1 needs updating to 2.7.0~ds1-1vcrs.1 [2021-02-07T15:59:38-08:00] INFO: apt_package[hub] installed hub at 2.7.0~ds1-1vcrs.1 ``` Signed-off-by: Phil Dibowitz <phil@ipom.com>
Diffstat (limited to 'spec/functional')
-rw-r--r--spec/functional/resource/apt_package_spec.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/functional/resource/apt_package_spec.rb b/spec/functional/resource/apt_package_spec.rb
index 9f10e27731..8e888ce54a 100644
--- a/spec/functional/resource/apt_package_spec.rb
+++ b/spec/functional/resource/apt_package_spec.rb
@@ -186,7 +186,7 @@ describe Chef::Resource::AptPackage, metadata do
it "raises a reasonable error for action :install" do
expect do
package_resource.run_action(:install)
- end.to raise_error(Mixlib::ShellOut::ShellCommandFailed)
+ end.to raise_error(Chef::Exceptions::Package)
end
end