Unittest case pollutes httplib

Bug #1007307 reported by Huang Zhiteng
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Eric Harney

Bug Description

The unittest in 'tests/api/openstack/compute/test_limits.py' pollutes the httplib/httplib2 usage in later test cases.

To reproduce this bug:

1) put following code into test_httplib.py
----------------------
import httplib2

from nova import test

class HttplibTest(test.TestCase):
    def test_httplib(self):
        http = httplib2.Http()
        response, content = http.request("http://127.0.0.1", 'GET')
        self.assertEqual(response.status, 200, 'Httplib Test')
-----------------------

2) run this test after api/openstack/compute/test_limits.py like this:
./run_tests.sh api/openstack/compute/test_limits.py test_httplib

Following error should occur:
======================================================================
ERROR: test_httplib (nova.tests.test_1.HttplibTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/zhiteng/stack/nova/nova/tests/test_1.py", line 26, in test_httplib
    response, content = http.request("http://127.0.0.1", 'GET')
  File "/opt/stack/nova/.venv/lib/python2.7/site-packages/httplib2/__init__.py", line 1428, in request
    proxy_info=proxy_info)
  File "/opt/stack/nova/.venv/lib/python2.7/site-packages/httplib2/__init__.py", line 852, in __init__
    httplib.HTTPConnection.__init__(self, host, port, strict)
TypeError: __init__() takes exactly 2 arguments (5 given)

----------------------------------------------------------------------

The root cause should be the 'wire_HTTPConnection_to_WSGI' function, which wrap httplib.HTTPConnection to FakeHttpConnection but doesn't clean up when finished.

Changed in nova:
status: New → Confirmed
importance: Undecided → Medium
tags: added: low-hanging-fruit
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/8462

Changed in nova:
assignee: nobody → Eric Harney (eharney)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/8462
Committed: http://github.com/openstack/nova/commit/cbd334d0a8b12bb78ff40a4bdc696a80fa6a393a
Submitter: Jenkins
Branch: master

commit cbd334d0a8b12bb78ff40a4bdc696a80fa6a393a
Author: Eric Harney <email address hidden>
Date: Tue Jun 12 21:23:47 2012 -0400

    Unwrap httplib.HTTPConnection after WsgiLimiterProxyTest.

    Fixes bug 1007307.

    Change-Id: I0b84d29a86a727b611f60f6be15a6d0d21c17a4b

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → folsom-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: folsom-2 → 2012.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.