launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #28349
[Merge] ~cjwatson/launchpad:fix-db-error-filtering-test into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:fix-db-error-filtering-test into launchpad:master.
Commit message:
Fix occasional test_disconnectionerror_view_integration failures
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/419680
`TestDatabaseErrorViews.test_disconnectionerror_view_integration` fails on buildbot quite often, with a very long piece of output that amounts to complaining that it saw more than one "database removed" OOPS. As far as I can tell, this can happen innocuously if more than one database connection happens to be open for whatever reason, and what this test actually cares about is that we don't log OOPSes for other errors that should be filtered out ("database does not allow connections" and "pgbouncer database is disabled"; see https://code.launchpad.net/~wgrant/launchpad/no-fdt-oopses/+merge/279741). Therefore, rather than asserting that we see exactly one "database removed" OOPS, assert that we see at least one OOPS and that they're all of this form.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-db-error-filtering-test into launchpad:master.
diff --git a/lib/lp/services/webapp/tests/test_error.py b/lib/lp/services/webapp/tests/test_error.py
index 87cac31..2081b14 100644
--- a/lib/lp/services/webapp/tests/test_error.py
+++ b/lib/lp/services/webapp/tests/test_error.py
@@ -17,6 +17,7 @@ from storm.exceptions import (
)
from testtools.content import text_content
from testtools.matchers import (
+ AllMatch,
Equals,
MatchesAny,
MatchesListwise,
@@ -202,10 +203,12 @@ class TestDatabaseErrorViews(TestCase):
self.assertEqual(503, int(browser.headers['Status'].split(' ', 1)[0]))
self.assertThat(
browser.contents, Contains(DisconnectionErrorView.reason))
+ disconnection_oopses = [
+ (oops['type'], oops['value'].split('\n')[0])
+ for oops in oopses.oopses]
+ self.assertNotEqual([], disconnection_oopses)
self.assertThat(
- [(oops['type'], oops['value'].split('\n')[0])
- for oops in oopses.oopses],
- MatchesListwise([Disconnects('database removed')]))
+ disconnection_oopses, AllMatch(Disconnects('database removed')))
# A second request doesn't log any OOPSes.
with CaptureOops() as oopses: