diff options
author | Davanum Srinivas <dims@linux.vnet.ibm.com> | 2012-11-27 22:11:40 -0500 |
---|---|---|
committer | Davanum Srinivas <dims@linux.vnet.ibm.com> | 2012-11-29 09:57:31 -0500 |
commit | 83186053c16d7536f90b4e6b3f95bd16d26bfb8c (patch) | |
tree | 474c2219024ef89630bdf6ed05f09e040a520338 /tests | |
parent | 582cb960066a02ae247097c8a96484655429fbe1 (diff) | |
download | oslo-83186053c16d7536f90b4e6b3f95bd16d26bfb8c.tar.gz oslo-83186053c16d7536f90b4e6b3f95bd16d26bfb8c.tar.xz oslo-83186053c16d7536f90b4e6b3f95bd16d26bfb8c.zip |
Use Service thread group for WSGI request handling
- Reuse the pool from thread group in service.Service
instead of creating a new green pool
- Add ability to control the size of the pool in service.Service
- Add a couple of tests for wsgi.Service() to test the size
of pool a start/stop as well
- Get rid of the wait method by using tg.add_thread
- Get rid of pool in wsgi.Service
- Added explicit property for host and port
Fixes LP #1050379
Change-Id: I40507dc7887fb036ec594bb167cdaa42c278607e
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/test_wsgi.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/unit/test_wsgi.py b/tests/unit/test_wsgi.py index 94f12b7..25c0dcf 100644 --- a/tests/unit/test_wsgi.py +++ b/tests/unit/test_wsgi.py @@ -444,3 +444,19 @@ class ServerTest(unittest.TestCase): finally: listen_patcher.stop() server_patcher.stop() + + +class WSGIServerTest(unittest.TestCase): + + def test_pool(self): + server = wsgi.Service() + self.assertTrue(server.tg) + self.assertTrue(server.tg.pool) + self.assertEqual(server.tg.pool.free(), 1000) + + def test_start_random_port(self): + server = wsgi.Service() + server.start("test_random_port", 0) + self.assertEqual("0.0.0.0", server.host) + self.assertNotEqual(0, server.port) + server.stop() |