Update test from #58883 to work with new work

This commit is contained in:
Ken Crowell 2021-02-25 16:15:34 -04:00 committed by Daniel Wozniak
parent 3059796b48
commit d3788da120

View file

@ -632,7 +632,9 @@ class PkgTest(ModuleCase, SaltReturnAssertsMixin):
@pytest.mark.slow_test
def test_pkg_017_installed_held_equals_false(self, grains=None):
"""
Tests that a package installed with held set to False
Tests that a package is installed when hold is explicitly False.
See https://github.com/saltstack/salt/issues/58801.
"""
versionlock_pkg = None
if grains["os_family"] == "RedHat":
@ -680,7 +682,14 @@ class PkgTest(ModuleCase, SaltReturnAssertsMixin):
# On Centos 7 package is already installed, no change happened
if target_ret[tag].get("changes"):
self.assertIn(target, target_ret[tag]["changes"])
self.assertIn("held", target_ret[tag]["comment"])
if grains["os_family"] == "Suse":
self.assertIn("packages were installed", target_ret[tag]["comment"])
else:
# The "held" string is part of a longer comment that may look
# like:
#
# Package units is not being held.
self.assertIn("held", target_ret[tag]["comment"])
finally:
# Clean up, unhold package and remove
ret = self.run_state("pkg.removed", name=target)