launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #09095
[Merge] lp:~frankban/launchpad/bug-1015318 into lp:launchpad
Francesco Banconi has proposed merging lp:~frankban/launchpad/bug-1015318 into lp:launchpad.
Requested reviews:
Yellow Squad (yellow)
Related bugs:
Bug #1015318 in Launchpad itself: "lp.codehosting.scanner.tests.test_email.TestViaCelery.test_revisions_added fails intermittently/rarely in parallel tests"
https://bugs.launchpad.net/launchpad/+bug/1015318
For more details, see:
https://code.launchpad.net/~frankban/launchpad/bug-1015318/+merge/111577
= Summary =
lp.codehosting.scanner.tests.test_email.TestViaCelery.test_revisions_added fails when run right after
lp.registry.tests.test_sharingjob.RemoveBugSubscriptionsJobTestCase.test_getErrorRecipients and
lp.registry.tests.test_sharingjob.RemoveBugSubscriptionsJobTestCase.test_change_target.
The failure is a database disconnection error probably raised because transaction.commit() is called on an old connection.
commit is itself called by a celery job that retrieves notification emails: pop_remote_notifications().
== Proposed fix ==
Enable and start a job in order to recreate a connection before calling pop_remote_notifications().
== Implementation details ==
RevisionMailJob sends emails about revisions when a revision is added to a branch. We execute this job and then flush the notifications, so that we can then test that RevisionsAddedJob is actually called via celery.
== Tests ==
bin/test -cvv --load-list mylist
where mylist contains:
lp.registry.tests.test_sharingjob.RemoveBugSubscriptionsJobTestCase.test_getErrorRecipients
lp.registry.tests.test_sharingjob.RemoveBugSubscriptionsJobTestCase.test_change_target
lp.codehosting.scanner.tests.test_email.TestViaCelery.test_revisions_added
NO QA
--
https://code.launchpad.net/~frankban/launchpad/bug-1015318/+merge/111577
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/codehosting/scanner/tests/test_email.py'
--- lib/lp/codehosting/scanner/tests/test_email.py 2012-06-14 05:18:22 +0000
+++ lib/lp/codehosting/scanner/tests/test_email.py 2012-06-22 11:07:21 +0000
@@ -200,11 +200,12 @@
self.assertEqual(1, len(pop_remote_notifications()))
def test_revisions_added(self):
- """RevisionMailJob for removed revisions runs via Celery."""
- db_branch, tree = self.prepare('RevisionsAddedJob')
+ """RevisionsAddedJob for added revisions runs via Celery."""
+ db_branch, tree = self.prepare('RevisionMailJob RevisionsAddedJob')
tree.commit('message')
bzr_sync = BzrSync(db_branch)
- bzr_sync.syncBranchAndClose(tree.branch)
+ with block_on_job():
+ bzr_sync.syncBranchAndClose(tree.branch)
pop_remote_notifications()
tree.commit('message2')
with block_on_job():
Follow ups