Merge lp:~salgado/launchpad/workitem-migration-allow-inactive-milestones into lp:launchpad

Proposed by Guilherme Salgado
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: 14898
Proposed branch: lp:~salgado/launchpad/workitem-migration-allow-inactive-milestones
Merge into: lp:launchpad
Diff against target: 121 lines (+24/-8)
5 files modified
lib/lp/blueprints/tests/test_workitem_migration.py (+14/-0)
lib/lp/blueprints/workitemmigration.py (+4/-2)
lib/lp/scripts/garbo.py (+1/-1)
lib/lp/scripts/tests/test_garbo.py (+3/-3)
lib/lp/testing/factory.py (+2/-2)
To merge this branch: bzr merge lp:~salgado/launchpad/workitem-migration-allow-inactive-milestones
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+95624@code.launchpad.net

Commit message

[r=sinzui][bug=944987] Make sure work items targeted to inactive milestones are migrated. Also move the work item migration job from the hourly garbo to the frequent one.

Description of the change

Make sure work items targeted to inactive milestones are migrated.

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

This is good to land.

review: Approve (code)
Revision history for this message
Curtis Hovey (sinzui) wrote :

We agreed to change the garbo frequency because only the first two runs were long, taking a couple of minutes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/blueprints/tests/test_workitem_migration.py'
2--- lib/lp/blueprints/tests/test_workitem_migration.py 2012-02-29 15:22:38 +0000
3+++ lib/lp/blueprints/tests/test_workitem_migration.py 2012-03-02 18:04:22 +0000
4@@ -196,6 +196,20 @@
5 assignee=None, title="A single work item", milestone=milestone,
6 status=SpecificationWorkItemStatus.TODO, specification=spec))
7
8+ def test_work_item_with_inactive_milestone(self):
9+ milestone = self.factory.makeMilestone(active=False)
10+ whiteboard = dedent("""
11+ Work items for %s:
12+ A single work item: TODO
13+ """ % milestone.name)
14+ spec = self.factory.makeSpecification(
15+ whiteboard=whiteboard, product=milestone.product)
16+ work_items = extractWorkItemsFromWhiteboard(spec)
17+ self.assertEqual(1, len(work_items))
18+ self.assertThat(work_items[0], MatchesStructure.byEquality(
19+ assignee=None, title="A single work item", milestone=milestone,
20+ status=SpecificationWorkItemStatus.TODO, specification=spec))
21+
22 def test_work_item_with_unknown_milestone(self):
23 whiteboard = dedent("""
24 Work items for foo:
25
26=== modified file 'lib/lp/blueprints/workitemmigration.py'
27--- lib/lp/blueprints/workitemmigration.py 2012-02-29 15:04:36 +0000
28+++ lib/lp/blueprints/workitemmigration.py 2012-03-02 18:04:22 +0000
29@@ -81,7 +81,9 @@
30 for word in words:
31 if word == milestone.name:
32 return milestone
33- raise WorkItemParseError("No valid milestones found in %s" % words)
34+ raise WorkItemParseError(
35+ "No valid milestones found in %s. Valid milestone names are %s"
36+ % (words, [m.name for m in valid_milestones]))
37
38
39 def extractWorkItemsFromWhiteboard(spec):
40@@ -94,7 +96,7 @@
41 in_wi_block = False
42 new_whiteboard = []
43
44- target_milestones = list(spec.target.milestones)
45+ target_milestones = list(spec.target.all_milestones)
46 wi_lines = []
47 # Iterate over all lines in the whiteboard and whenever we find a line
48 # matching work_items_re we 'continue' and store the following lines
49
50=== modified file 'lib/lp/scripts/garbo.py'
51--- lib/lp/scripts/garbo.py 2012-03-01 15:59:27 +0000
52+++ lib/lp/scripts/garbo.py 2012-03-02 18:04:22 +0000
53@@ -1293,6 +1293,7 @@
54 OpenIDConsumerNoncePruner,
55 OpenIDConsumerAssociationPruner,
56 AntiqueSessionPruner,
57+ SpecificationWorkitemMigrator,
58 ]
59 experimental_tunable_loops = []
60
61@@ -1314,7 +1315,6 @@
62 UnusedSessionPruner,
63 DuplicateSessionPruner,
64 BugHeatUpdater,
65- SpecificationWorkitemMigrator,
66 ]
67 experimental_tunable_loops = []
68
69
70=== modified file 'lib/lp/scripts/tests/test_garbo.py'
71--- lib/lp/scripts/tests/test_garbo.py 2012-03-01 15:46:15 +0000
72+++ lib/lp/scripts/tests/test_garbo.py 2012-03-02 18:04:22 +0000
73@@ -1028,7 +1028,7 @@
74 spec = self.factory.makeSpecification(whiteboard=whiteboard)
75 transaction.commit()
76
77- self.runHourly()
78+ self.runFrequently()
79
80 self.assertEqual(whiteboard, spec.whiteboard)
81 self.assertEqual(0, spec.work_items.count())
82@@ -1052,7 +1052,7 @@
83 u'default', 0, u'garbo.workitem_migrator.enabled', u'True'))
84 transaction.commit()
85
86- self.runHourly()
87+ self.runFrequently()
88
89 self.assertEqual('', spec.whiteboard.strip())
90 self.assertEqual(2, spec.work_items.count())
91@@ -1079,7 +1079,7 @@
92 u'default', 0, u'garbo.workitem_migrator.enabled', u'True'))
93 transaction.commit()
94
95- self.runHourly()
96+ self.runFrequently()
97
98 self.assertEqual(whiteboard, spec.whiteboard)
99 self.assertEqual(0, spec.work_items.count())
100
101=== modified file 'lib/lp/testing/factory.py'
102--- lib/lp/testing/factory.py 2012-02-29 13:27:51 +0000
103+++ lib/lp/testing/factory.py 2012-03-02 18:04:22 +0000
104@@ -848,7 +848,7 @@
105 return getUtility(ITranslatorSet).new(group, language, person)
106
107 def makeMilestone(self, product=None, distribution=None,
108- productseries=None, name=None):
109+ productseries=None, name=None, active=True):
110 if product is None and distribution is None and productseries is None:
111 product = self.makeProduct()
112 if distribution is None:
113@@ -864,7 +864,7 @@
114 return ProxyFactory(
115 Milestone(product=product, distribution=distribution,
116 productseries=productseries, distroseries=distroseries,
117- name=name))
118+ name=name, active=active))
119
120 def makeProcessor(self, family=None, name=None, title=None,
121 description=None):