launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #07111
[Merge] lp:~bac/launchpad/bug-974617 into lp:launchpad
Brad Crittenden has proposed merging lp:~bac/launchpad/bug-974617 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #974617 in Launchpad itself: "test_operational_view_integration fails intermittently in parallel tests"
https://bugs.launchpad.net/launchpad/+bug/974617
For more details, see:
https://code.launchpad.net/~bac/launchpad/bug-974617/+merge/101797
Parallel testing exposed a problem where bouncer.start() was returning
but the bouncer service was not actually up.
This fix is gentler, giving the bouncer more time to tidy up and get started.
--
https://code.launchpad.net/~bac/launchpad/bug-974617/+merge/101797
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~bac/launchpad/bug-974617 into lp:launchpad.
=== modified file 'lib/lp/services/webapp/tests/test_error.py'
--- lib/lp/services/webapp/tests/test_error.py 2012-01-01 02:58:52 +0000
+++ lib/lp/services/webapp/tests/test_error.py 2012-04-12 19:03:23 +0000
@@ -3,13 +3,15 @@
"""Test error views."""
-import urllib2
+import httplib
from storm.exceptions import (
DisconnectionError,
OperationalError,
)
+import time
import transaction
+import urllib2
from lp.services.webapp.error import (
DisconnectionErrorView,
@@ -113,7 +115,22 @@
self.assertEqual(503, self.getHTTPError(url).code)
# When the database is available again, requests succeed.
bouncer.start()
- urllib2.urlopen(url)
+ # bouncer.start() can sometimes return before the service is actually
+ # available for use. To be defensive, let's retry a few times. See
+ # bug 974617.
+ for i in xrange(5):
+ try:
+ urllib2.urlopen(url)
+ except urllib2.HTTPError as e:
+ if e.code != httplib.SERVICE_UNAVAILABLE:
+ raise
+ else:
+ break
+ time.sleep(0.5)
+ else:
+ raise
+
+
def test_operationalerror_view(self):
request = LaunchpadTestRequest()
Follow ups