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
=== modified file 'lib/lp/blueprints/tests/test_workitem_migration.py'
--- lib/lp/blueprints/tests/test_workitem_migration.py 2012-02-29 15:22:38 +0000
+++ lib/lp/blueprints/tests/test_workitem_migration.py 2012-03-02 18:04:22 +0000
@@ -196,6 +196,20 @@
196 assignee=None, title="A single work item", milestone=milestone,196 assignee=None, title="A single work item", milestone=milestone,
197 status=SpecificationWorkItemStatus.TODO, specification=spec))197 status=SpecificationWorkItemStatus.TODO, specification=spec))
198198
199 def test_work_item_with_inactive_milestone(self):
200 milestone = self.factory.makeMilestone(active=False)
201 whiteboard = dedent("""
202 Work items for %s:
203 A single work item: TODO
204 """ % milestone.name)
205 spec = self.factory.makeSpecification(
206 whiteboard=whiteboard, product=milestone.product)
207 work_items = extractWorkItemsFromWhiteboard(spec)
208 self.assertEqual(1, len(work_items))
209 self.assertThat(work_items[0], MatchesStructure.byEquality(
210 assignee=None, title="A single work item", milestone=milestone,
211 status=SpecificationWorkItemStatus.TODO, specification=spec))
212
199 def test_work_item_with_unknown_milestone(self):213 def test_work_item_with_unknown_milestone(self):
200 whiteboard = dedent("""214 whiteboard = dedent("""
201 Work items for foo:215 Work items for foo:
202216
=== modified file 'lib/lp/blueprints/workitemmigration.py'
--- lib/lp/blueprints/workitemmigration.py 2012-02-29 15:04:36 +0000
+++ lib/lp/blueprints/workitemmigration.py 2012-03-02 18:04:22 +0000
@@ -81,7 +81,9 @@
81 for word in words:81 for word in words:
82 if word == milestone.name:82 if word == milestone.name:
83 return milestone83 return milestone
84 raise WorkItemParseError("No valid milestones found in %s" % words)84 raise WorkItemParseError(
85 "No valid milestones found in %s. Valid milestone names are %s"
86 % (words, [m.name for m in valid_milestones]))
8587
8688
87def extractWorkItemsFromWhiteboard(spec):89def extractWorkItemsFromWhiteboard(spec):
@@ -94,7 +96,7 @@
94 in_wi_block = False96 in_wi_block = False
95 new_whiteboard = []97 new_whiteboard = []
9698
97 target_milestones = list(spec.target.milestones)99 target_milestones = list(spec.target.all_milestones)
98 wi_lines = []100 wi_lines = []
99 # Iterate over all lines in the whiteboard and whenever we find a line101 # Iterate over all lines in the whiteboard and whenever we find a line
100 # matching work_items_re we 'continue' and store the following lines102 # matching work_items_re we 'continue' and store the following lines
101103
=== modified file 'lib/lp/scripts/garbo.py'
--- lib/lp/scripts/garbo.py 2012-03-01 15:59:27 +0000
+++ lib/lp/scripts/garbo.py 2012-03-02 18:04:22 +0000
@@ -1293,6 +1293,7 @@
1293 OpenIDConsumerNoncePruner,1293 OpenIDConsumerNoncePruner,
1294 OpenIDConsumerAssociationPruner,1294 OpenIDConsumerAssociationPruner,
1295 AntiqueSessionPruner,1295 AntiqueSessionPruner,
1296 SpecificationWorkitemMigrator,
1296 ]1297 ]
1297 experimental_tunable_loops = []1298 experimental_tunable_loops = []
12981299
@@ -1314,7 +1315,6 @@
1314 UnusedSessionPruner,1315 UnusedSessionPruner,
1315 DuplicateSessionPruner,1316 DuplicateSessionPruner,
1316 BugHeatUpdater,1317 BugHeatUpdater,
1317 SpecificationWorkitemMigrator,
1318 ]1318 ]
1319 experimental_tunable_loops = []1319 experimental_tunable_loops = []
13201320
13211321
=== modified file 'lib/lp/scripts/tests/test_garbo.py'
--- lib/lp/scripts/tests/test_garbo.py 2012-03-01 15:46:15 +0000
+++ lib/lp/scripts/tests/test_garbo.py 2012-03-02 18:04:22 +0000
@@ -1028,7 +1028,7 @@
1028 spec = self.factory.makeSpecification(whiteboard=whiteboard)1028 spec = self.factory.makeSpecification(whiteboard=whiteboard)
1029 transaction.commit()1029 transaction.commit()
10301030
1031 self.runHourly()1031 self.runFrequently()
10321032
1033 self.assertEqual(whiteboard, spec.whiteboard)1033 self.assertEqual(whiteboard, spec.whiteboard)
1034 self.assertEqual(0, spec.work_items.count())1034 self.assertEqual(0, spec.work_items.count())
@@ -1052,7 +1052,7 @@
1052 u'default', 0, u'garbo.workitem_migrator.enabled', u'True'))1052 u'default', 0, u'garbo.workitem_migrator.enabled', u'True'))
1053 transaction.commit()1053 transaction.commit()
10541054
1055 self.runHourly()1055 self.runFrequently()
10561056
1057 self.assertEqual('', spec.whiteboard.strip())1057 self.assertEqual('', spec.whiteboard.strip())
1058 self.assertEqual(2, spec.work_items.count())1058 self.assertEqual(2, spec.work_items.count())
@@ -1079,7 +1079,7 @@
1079 u'default', 0, u'garbo.workitem_migrator.enabled', u'True'))1079 u'default', 0, u'garbo.workitem_migrator.enabled', u'True'))
1080 transaction.commit()1080 transaction.commit()
10811081
1082 self.runHourly()1082 self.runFrequently()
10831083
1084 self.assertEqual(whiteboard, spec.whiteboard)1084 self.assertEqual(whiteboard, spec.whiteboard)
1085 self.assertEqual(0, spec.work_items.count())1085 self.assertEqual(0, spec.work_items.count())
10861086
=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py 2012-02-29 13:27:51 +0000
+++ lib/lp/testing/factory.py 2012-03-02 18:04:22 +0000
@@ -848,7 +848,7 @@
848 return getUtility(ITranslatorSet).new(group, language, person)848 return getUtility(ITranslatorSet).new(group, language, person)
849849
850 def makeMilestone(self, product=None, distribution=None,850 def makeMilestone(self, product=None, distribution=None,
851 productseries=None, name=None):851 productseries=None, name=None, active=True):
852 if product is None and distribution is None and productseries is None:852 if product is None and distribution is None and productseries is None:
853 product = self.makeProduct()853 product = self.makeProduct()
854 if distribution is None:854 if distribution is None:
@@ -864,7 +864,7 @@
864 return ProxyFactory(864 return ProxyFactory(
865 Milestone(product=product, distribution=distribution,865 Milestone(product=product, distribution=distribution,
866 productseries=productseries, distroseries=distroseries,866 productseries=productseries, distroseries=distroseries,
867 name=name))867 name=name, active=active))
868868
869 def makeProcessor(self, family=None, name=None, title=None,869 def makeProcessor(self, family=None, name=None, title=None,
870 description=None):870 description=None):