Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pkg.latest integration test for non-LTS ubuntu #34518

Merged
merged 1 commit into from
Jul 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions tests/integration/states/pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,16 +566,23 @@ def test_pkg_012_latest_only_upgrade(self, grains=None):

# Now look for updates and try to run the state on a package which is
# already up-to-date.
installed_pkgs = self.run_function('pkg.list_pkgs')
updates = self.run_function('pkg.list_upgrades', refresh=False)
try:
target = next(iter(updates))
except StopIteration:

for pkgname in updates:
if pkgname in installed_pkgs:
target = pkgname
break
else:
target = ''
log.warning(
'No available upgrades, skipping only_upgrade=True test with '
'already-installed package. For best results run this test '
'on a machine with upgrades available.'
'No available upgrades to installed packages, skipping '
'only_upgrade=True test with already-installed package. For '
'best results run this test on a machine with upgrades '
'available.'
)
else:

if target:
ret = self.run_state('pkg.latest', name=target, refresh=False,
only_upgrade=True)
self.assertSaltTrueReturn(ret)
Expand Down