Merge lp:~silverdrake11/landscape-charm/log_upgrade_version into lp:landscape-charm

Proposed by Kevin Nasto
Status: Merged
Merged at revision: 436
Proposed branch: lp:~silverdrake11/landscape-charm/log_upgrade_version
Merge into: lp:landscape-charm
Diff against target: 25 lines (+3/-1)
2 files modified
src/charm.py (+2/-0)
tests/test_charm.py (+1/-1)
To merge this branch: bzr merge lp:~silverdrake11/landscape-charm/log_upgrade_version
Reviewer Review Type Date Requested Status
Mitch Burton Approve
Review via email: mp+438904@code.launchpad.net

Commit message

Added landscape packages version in event upgrade action log

To post a comment you must log in.
Revision history for this message
Mitch Burton (mitchburton) wrote :

test failure:

======================================================================
FAIL: test_action_upgrade (tests.test_charm.TestCharm)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/perfect5th/Canonical/src/landscape-charm/log_upgrade_version/tests/test_charm.py", line 894, in test_action_upgrade
    self.assertEqual(event.log.call_count, 5)
AssertionError: 9 != 5

Otherwise LGTM

review: Needs Fixing
437. By Kevin Nasto

Fixed failing test

Revision history for this message
Kevin Nasto (silverdrake11) wrote :

> test failure:
>
> ======================================================================
> FAIL: test_action_upgrade (tests.test_charm.TestCharm)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "/home/perfect5th/Canonical/src/landscape-
> charm/log_upgrade_version/tests/test_charm.py", line 894, in
> test_action_upgrade
> self.assertEqual(event.log.call_count, 5)
> AssertionError: 9 != 5
>
> Otherwise LGTM

Fixed

Revision history for this message
Mitch Burton (mitchburton) wrote :

LGTM then

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/charm.py'
2--- src/charm.py 2023-03-13 21:37:24 +0000
3+++ src/charm.py 2023-03-14 18:35:35 +0000
4@@ -908,6 +908,8 @@
5 event.log(f"Upgrading {package}...")
6 pkg = apt.DebianPackage.from_apt_cache(package)
7 pkg.ensure(state=apt.PackageState.Latest)
8+ installed = apt.DebianPackage.from_installed_package(package)
9+ event.log(f"Upgraded to {installed.version}...")
10 except PackageNotFoundError as e:
11 logger.error(f"Could not upgrade package {package}. Reason: {e.message}")
12 event.fail(f"Could not upgrade package {package}. Reason: {e.message}")
13
14=== modified file 'tests/test_charm.py'
15--- tests/test_charm.py 2023-03-13 21:37:24 +0000
16+++ tests/test_charm.py 2023-03-14 18:35:35 +0000
17@@ -891,7 +891,7 @@
18 apt_mock.DebianPackage.from_apt_cache.return_value = pkg_mock
19 self.harness.charm._upgrade(event)
20
21- self.assertEqual(event.log.call_count, 5)
22+ self.assertEqual(event.log.call_count, 9)
23 self.assertEqual(
24 apt_mock.DebianPackage.from_apt_cache.call_count,
25 len(LANDSCAPE_PACKAGES)

Subscribers

People subscribed via source and target branches

to all changes: