diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-11-07 12:08:32 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-07 12:08:32 -0800 |
commit | b6a9660be7ba5444e7fdeaba4b161b64afc5d64c (patch) | |
tree | 137d7b2451ddc928925c312e31ad87744a4be542 | |
parent | 7083174b145f9aa03929903ad3064e34d6a03781 (diff) | |
parent | 7a95a72420f92fdcb79e547eeaa7c4ecad061098 (diff) | |
download | chef-b6a9660be7ba5444e7fdeaba4b161b64afc5d64c.tar.gz |
Merge pull request #7886 from chef/lcg/yum-version-with-package-source
add tests for yum version with package_source bug
-rw-r--r-- | spec/functional/resource/yum_package_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/functional/resource/yum_package_spec.rb b/spec/functional/resource/yum_package_spec.rb index 3735e67cf2..cde193db70 100644 --- a/spec/functional/resource/yum_package_spec.rb +++ b/spec/functional/resource/yum_package_spec.rb @@ -485,6 +485,24 @@ describe Chef::Resource::YumPackage, :requires_root, external: exclude_test do expect(yum_package.updated_by_last_action?).to be false expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$") end + + it "is idempotent when the package is already installed and there is a version string" do + preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm") + yum_package.version "1.2-1" + yum_package.package_name("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm") + yum_package.run_action(:install) + expect(yum_package.updated_by_last_action?).to be false + expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$") + end + + it "is idempotent when the package is already installed and there is a version string with arch" do + preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm") + yum_package.version "1.2-1.#{pkg_arch}" + yum_package.package_name("#{CHEF_SPEC_ASSETS}/yumrepo/chef_rpm-1.2-1.#{pkg_arch}.rpm") + yum_package.run_action(:install) + expect(yum_package.updated_by_last_action?).to be false + expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$") + end end context "with no available version" do |