← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~spiv/launchpad/haproxy-for-twisted-services into lp:launchpad

 

Andrew Bennetts has proposed merging lp:~spiv/launchpad/haproxy-for-twisted-services into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #702024 Restarting codehosting SSH server drops existing connections
  https://bugs.launchpad.net/bugs/702024

For more details, see:
https://code.launchpad.net/~spiv/launchpad/haproxy-for-twisted-services/+merge/48427

This fixes a cosmetic glitch in the text in the new web status page for codehosting SSH: it was always saying "Unavailable".  The HTTP response code was still correct, though.
-- 
https://code.launchpad.net/~spiv/launchpad/haproxy-for-twisted-services/+merge/48427
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~spiv/launchpad/haproxy-for-twisted-services into lp:launchpad.
=== modified file 'lib/lp/services/twistedsupport/gracefulshutdown.py'
--- lib/lp/services/twistedsupport/gracefulshutdown.py	2011-01-31 06:50:49 +0000
+++ lib/lp/services/twistedsupport/gracefulshutdown.py	2011-02-03 05:13:56 +0000
@@ -108,6 +108,7 @@
         else:
             request.setResponseCode(503)
         request.setHeader('Content-Type', 'text/plain')
+        return service_available
 
     def render_GET(self, request):
         """Handler for GET requests.  See resource.Resource.render."""

=== modified file 'lib/lp/services/twistedsupport/tests/test_gracefulshutdown.py'
--- lib/lp/services/twistedsupport/tests/test_gracefulshutdown.py	2011-01-31 06:50:49 +0000
+++ lib/lp/services/twistedsupport/tests/test_gracefulshutdown.py	2011-02-03 05:13:56 +0000
@@ -105,8 +105,9 @@
         self.assertEqual(200, request.code)
         # GET works too
         request = self.make_dummy_http_request()
-        r.render_GET(request)
+        body = r.render_GET(request)
         self.assertEqual(200, request.code)
+        self.assertTrue(body.startswith('Available\n'))
 
     def test_503_after_shutdown_starts(self):
         """
@@ -121,8 +122,9 @@
         self.assertEqual(503, request.code)
         # GET works too
         request = self.make_dummy_http_request()
-        r.render_GET(request)
+        body = r.render_GET(request)
         self.assertEqual(503, request.code)
+        self.assertTrue(body.startswith('Unavailable\n'))
 
 
 class TestService(service.Service):