Merge lp:~cjwatson/launchpad/pcj-better-oops into lp:launchpad

Proposed by Colin Watson
Status: Merged
Merged at revision: 18247
Proposed branch: lp:~cjwatson/launchpad/pcj-better-oops
Merge into: lp:launchpad
Diff against target: 62 lines (+18/-3)
2 files modified
lib/lp/soyuz/model/packagecopyjob.py (+3/-2)
lib/lp/soyuz/tests/test_packagecopyjob.py (+15/-1)
To merge this branch: bzr merge lp:~cjwatson/launchpad/pcj-better-oops
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+308612@code.launchpad.net

Commit message

Include the package name in package copy job OOPS reports and emails.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/model/packagecopyjob.py'
2--- lib/lp/soyuz/model/packagecopyjob.py 2015-07-09 20:06:17 +0000
3+++ lib/lp/soyuz/model/packagecopyjob.py 2016-10-17 09:16:59 +0000
4@@ -1,4 +1,4 @@
5-# Copyright 2010-2014 Canonical Ltd. This software is licensed under the
6+# Copyright 2010-2016 Canonical Ltd. This software is licensed under the
7 # GNU Affero General Public License version 3 (see the file LICENSE).
8
9 __metaclass__ = type
10@@ -229,6 +229,7 @@
11 ('source_archive_id', self.context.source_archive_id),
12 ('target_archive_id', self.context.target_archive_id),
13 ('target_distroseries_id', self.context.target_distroseries_id),
14+ ('package_name', self.context.package_name),
15 ('package_copy_job_id', self.context.id),
16 ('package_copy_job_type', self.context.job_type.title),
17 ])
18@@ -236,7 +237,7 @@
19
20 def getOperationDescription(self):
21 """See `IPlainPackageCopyJob`."""
22- return "copying a package"
23+ return "copying package %s" % self.context.package_name
24
25 def getErrorRecipients(self):
26 """See `IPlainPackageCopyJob`."""
27
28=== modified file 'lib/lp/soyuz/tests/test_packagecopyjob.py'
29--- lib/lp/soyuz/tests/test_packagecopyjob.py 2015-09-03 15:14:07 +0000
30+++ lib/lp/soyuz/tests/test_packagecopyjob.py 2016-10-17 09:16:59 +0000
31@@ -1,4 +1,4 @@
32-# Copyright 2010-2015 Canonical Ltd. This software is licensed under the
33+# Copyright 2010-2016 Canonical Ltd. This software is licensed under the
34 # GNU Affero General Public License version 3 (see the file LICENSE).
35
36 """Tests for sync package jobs."""
37@@ -560,11 +560,25 @@
38 self.assertIn(('source_archive_id', archive1.id), oops_vars)
39 self.assertIn(('target_archive_id', archive2.id), oops_vars)
40 self.assertIn(('target_distroseries_id', distroseries.id), oops_vars)
41+ self.assertIn(('package_name', 'foo'), oops_vars)
42 self.assertIn(('package_copy_job_id', naked_job.context.id), oops_vars)
43 self.assertIn(
44 ('package_copy_job_type', naked_job.context.job_type.title),
45 oops_vars)
46
47+ def test_getOperationDescription(self):
48+ distroseries = self.factory.makeDistroSeries()
49+ archive1 = self.factory.makeArchive(distroseries.distribution)
50+ archive2 = self.factory.makeArchive(distroseries.distribution)
51+ requester = self.factory.makePerson()
52+ job = getUtility(IPlainPackageCopyJobSource).create(
53+ package_name="foo", source_archive=archive1,
54+ target_archive=archive2, target_distroseries=distroseries,
55+ target_pocket=PackagePublishingPocket.RELEASE,
56+ package_version="1.0-1", include_binaries=False,
57+ requester=requester)
58+ self.assertEqual("copying package foo", job.getOperationDescription())
59+
60 def test_smoke(self):
61 archive1 = self.factory.makeArchive(self.distroseries.distribution)
62 archive2 = self.factory.makeArchive(self.distroseries.distribution)