Merge lp:~gmb/launchpad/bug-984312 into lp:launchpad

Proposed by Graham Binns
Status: Merged
Approved by: Graham Binns
Approved revision: no longer in the source branch.
Merged at revision: 15133
Proposed branch: lp:~gmb/launchpad/bug-984312
Merge into: lp:launchpad
Diff against target: 47 lines (+20/-8)
1 file modified
lib/lp/translations/tests/test_rosetta_branches_script.py (+20/-8)
To merge this branch: bzr merge lp:~gmb/launchpad/bug-984312
Reviewer Review Type Date Requested Status
Graham Binns (community) code Approve
Review via email: mp+102812@code.launchpad.net

Commit message

test_rosetta_branches_script_oops has been updated so that it is resilient to bug 884036 when run in a parallelised environment.

Description of the change

This branch fixes bug 984312 using the method suggested on the bug page. It's a bit of a kludge, but it serves the purpose for making the test resilient in a parallel environment.

To post a comment you must log in.
Revision history for this message
Graham Binns (gmb) wrote :

Self reviewing, since this is a relatively simple change.

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/translations/tests/test_rosetta_branches_script.py'
2--- lib/lp/translations/tests/test_rosetta_branches_script.py 2012-01-01 02:58:52 +0000
3+++ lib/lp/translations/tests/test_rosetta_branches_script.py 2012-04-20 08:53:20 +0000
4@@ -31,6 +31,16 @@
5 )
6
7
8+def filter_out_disconnection_oopses(oopses):
9+ """Remove the bug 884036-related oopses from a set of oopses.
10+
11+ :return: All non-DisconnectionError or AssertionError oopses.
12+ """
13+ unwanted_types = ('AssertionError', 'DisconnectionError')
14+ return [
15+ oops for oops in oopses if oops['type'] not in unwanted_types]
16+
17+
18 class TestRosettaBranchesScript(TestCaseWithFactory):
19 """Testing the rosetta-bazaar cronscript."""
20
21@@ -95,16 +105,18 @@
22 queue = getUtility(ITranslationImportQueue)
23 self.assertEqual(0, queue.countEntries())
24
25- # XXX: Robert Collins - bug 884036 - test_rosetta_branches_script does
26- # a commit() which resets the test db out from under the running slave
27- # appserver, requests to it then (correctly) log oopses as a DB
28- # connection is *not normal*. So when both tests are run, we see 8 of
29- # these oopses (4 pairs of 2); when run alone we don't.
30 self.oops_capture.sync()
31+ # XXX 2012-04-20 bug=884036 gmb:
32+ # This filter_out_disconnection_oopses() call is here to
33+ # stop the above bug from biting us in parallel test runs.
34+ # We filter out all OOPSes related to the fact that the DB
35+ # connection gets reset from under the running slave during
36+ # these test runs.
37+ oopses = filter_out_disconnection_oopses(self.oopses)
38 self.assertThat(
39- len(self.oopses), MatchesAny(Equals(1), Equals(9)),
40- "Unexpected number of OOPSes %r" % self.oopses)
41- oops_report = self.oopses[-1]
42+ len(oopses), Equals(1),
43+ "Unexpected number of OOPSes %r" % oopses)
44+ oops_report = oopses[-1]
45 self.assertIn(
46 'INFO Job resulted in OOPS: %s\n' % oops_report['id'], stderr)
47 self.assertEqual('NoSuchRevision', oops_report['type'])