diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-03-15 00:46:33 +0000 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2018-03-15 18:03:30 -0700 |
commit | ec723254f641b838c9dcd99e22505984aa29ef52 (patch) | |
tree | 109790749b48b7ffea76c293f24e7e62a4594699 | |
parent | e48bda8af9be0d52333aa3d4a16339051bff937b (diff) | |
download | chef-ec723254f641b838c9dcd99e22505984aa29ef52.tar.gz |
add more tests, fix more subtle bugs
we support locking based on provides lines, and now test that and
ensure that locking checks go through name resolution properly.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r-- | lib/chef/provider/package/yum.rb | 4 | ||||
-rw-r--r-- | spec/functional/resource/yum_package_spec.rb | 17 |
2 files changed, 19 insertions, 2 deletions
diff --git a/lib/chef/provider/package/yum.rb b/lib/chef/provider/package/yum.rb index 9e67c165db..0130c149a9 100644 --- a/lib/chef/provider/package/yum.rb +++ b/lib/chef/provider/package/yum.rb @@ -178,11 +178,11 @@ class Chef end def packages_all_locked?(names, versions) - names.all? { |n| locked_packages.include? n } + resolved_package_lock_names(names).all? { |n| locked_packages.include? n } end def packages_all_unlocked?(names, versions) - !names.any? { |n| locked_packages.include? n } + !resolved_package_lock_names(names).any? { |n| locked_packages.include? n } end def version_gt?(v1, v2) diff --git a/spec/functional/resource/yum_package_spec.rb b/spec/functional/resource/yum_package_spec.rb index f7cf54e020..aef4fcf562 100644 --- a/spec/functional/resource/yum_package_spec.rb +++ b/spec/functional/resource/yum_package_spec.rb @@ -928,5 +928,22 @@ gpgcheck=0 expect(yum_package.updated_by_last_action?).to be false expect(shell_out("yum versionlock list").stdout.chomp).not_to match("^0:chef_rpm-") end + + it "check that we can lock based on provides" do + flush_cache + yum_package.package_name("chef_rpm_provides") + yum_package.run_action(:lock) + expect(yum_package.updated_by_last_action?).to be true + expect(shell_out("yum versionlock list").stdout.chomp).to match("^0:chef_rpm-") + end + + it "check that we can unlock based on provides" do + flush_cache + shell_out!("yum versionlock add chef_rpm") + yum_package.package_name("chef_rpm_provides") + yum_package.run_action(:unlock) + expect(yum_package.updated_by_last_action?).to be true + expect(shell_out("yum versionlock list").stdout.chomp).not_to match("^0:chef_rpm-") + end end end |