Fix stale process after unit tests complete
After running the unit tests (eg with tox -epy27) a stale 'nosetests' process was always left behind. It left TCP ports open and held references on inodes. The latter caused a problem with some automated build systems. Rework the relevant test 'test_no_client_tracebacks' to be functionally the same, but clean up fully. Fixes bug 1198685. Change-Id: If9d3afa370dc2bd3c470b509d38c94cfb5844518
This commit is contained in:
parent
9daf38706f
commit
baa4091b14
|
@ -19,6 +19,7 @@
|
|||
"""Functional test asserting strongly typed exceptions from glance client"""
|
||||
|
||||
import eventlet.patcher
|
||||
import httplib2
|
||||
import webob.dec
|
||||
import webob.exc
|
||||
|
||||
|
@ -62,6 +63,9 @@ class ExceptionTestApp(object):
|
|||
elif path == "/server-error":
|
||||
request.response = webob.exc.HTTPServerError()
|
||||
|
||||
elif path == "/server-traceback":
|
||||
raise exception.ServerError()
|
||||
|
||||
|
||||
class TestClientExceptions(functional.FunctionalTest):
|
||||
|
||||
|
@ -121,3 +125,15 @@ class TestClientExceptions(functional.FunctionalTest):
|
|||
"""
|
||||
self._do_test_exception('/server-error',
|
||||
exception.ServerError)
|
||||
|
||||
def test_server_traceback(self):
|
||||
"""
|
||||
Verify that the wsgi server does not return tracebacks to the client on
|
||||
500 errors (bug 1192132)
|
||||
"""
|
||||
http = httplib2.Http()
|
||||
path = ('http://%s:%d/server-traceback' %
|
||||
('127.0.0.1', self.port))
|
||||
response, content = http.request(path, 'GET')
|
||||
self.assertTrue('ServerError' not in content)
|
||||
self.assertEqual(response.status, 500)
|
||||
|
|
|
@ -256,23 +256,6 @@ class ServerTest(test_utils.BaseTestCase):
|
|||
actual = wsgi.Server(threads=1).create_pool()
|
||||
self.assertTrue(isinstance(actual, eventlet.greenpool.GreenPool))
|
||||
|
||||
def test_no_client_tracebacks(self):
|
||||
"""
|
||||
Verify that the wsgi server does not return tracebacks to the client on
|
||||
500 errors (bug 1192132)
|
||||
"""
|
||||
def internal_error(env, start_response):
|
||||
raise exception.ServerError()
|
||||
|
||||
api_port = test_utils.get_unused_port()
|
||||
server = wsgi.Server()
|
||||
server.start(internal_error, api_port)
|
||||
path = 'http://%s:%d' % ('127.0.0.1', api_port)
|
||||
http = httplib2.Http()
|
||||
response, content = http.request(path, 'GET')
|
||||
self.assertTrue('ServerError' not in content)
|
||||
self.assertEqual(response.status, 500)
|
||||
|
||||
|
||||
class TestHelpers(test_utils.BaseTestCase):
|
||||
|
||||
|
|
Loading…
Reference in New Issue