mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add integration test for #42774
This commit is contained in:
parent
78d826dd14
commit
c69f17dd18
1 changed files with 38 additions and 0 deletions
|
@ -673,6 +673,44 @@ class PkgTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
ret = self.run_state('pkg.removed', name=target)
|
||||
self.assertSaltTrueReturn(ret)
|
||||
|
||||
@requires_system_grains
|
||||
def test_pkg_014_installed_missing_release(self, grains=None): # pylint: disable=unused-argument
|
||||
'''
|
||||
Tests that a version number missing the release portion still resolves
|
||||
as correctly installed. For example, version 2.0.2 instead of 2.0.2-1.el7
|
||||
'''
|
||||
os_family = grains.get('os_family', '')
|
||||
|
||||
if os_family.lower() != 'redhat':
|
||||
self.skipTest('Test only runs on RedHat OS family')
|
||||
|
||||
pkg_targets = _PKG_TARGETS.get(os_family, [])
|
||||
|
||||
# Make sure that we have targets that match the os_family. If this
|
||||
# fails then the _PKG_TARGETS dict above needs to have an entry added,
|
||||
# with two packages that are not installed before these tests are run
|
||||
self.assertTrue(pkg_targets)
|
||||
|
||||
target = pkg_targets[0]
|
||||
version = self.run_function('pkg.version', [target])
|
||||
|
||||
# If this assert fails, we need to find new targets, this test needs to
|
||||
# be able to test successful installation of packages, so this package
|
||||
# needs to not be installed before we run the states below
|
||||
self.assertFalse(version)
|
||||
|
||||
ret = self.run_state(
|
||||
'pkg.installed',
|
||||
name=target,
|
||||
version=salt.utils.str_version_to_evr(version)[1],
|
||||
refresh=False,
|
||||
)
|
||||
self.assertSaltTrueReturn(ret)
|
||||
|
||||
# Clean up
|
||||
ret = self.run_state('pkg.removed', name=target)
|
||||
self.assertSaltTrueReturn(ret)
|
||||
|
||||
@requires_salt_modules('pkg.group_install')
|
||||
@requires_system_grains
|
||||
def test_group_installed_handle_missing_package_group(self, grains=None): # pylint: disable=unused-argument
|
||||
|
|
Loading…
Add table
Reference in a new issue