cdent / gabbi

Declarative HTTP Testing for Python and anything else
http://gabbi.readthedocs.org/
Other
148 stars 34 forks source link

gabbi 2.5.0 is broken when http, instead of https, is used for requests #309

Closed kajinamit closed 2 years ago

kajinamit commented 2 years ago

Since gabbi 2.5.0 was released, we observe the error caused by the unexpected 'server_hostname' keyword argument.

example traceback we found in CI log of heat-tempest-plugin: https://zuul.opendev.org/t/openstack/build/d426d452e491488790ec2fa1e2924978

heat_tempest_plugin.tests.api.test_heat_api.environments_delete_envstack.test_request[id-0efde180-cc0e-4f2c-bb18-fa345e8d21ad]
------------------------------------------------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):
      File "/opt/stack/tempest/.tox/tempest/lib/python3.8/site-packages/gabbi/suitemaker.py", line 104, in do_test
    return test_method(*args, **kwargs)
      File "/opt/stack/tempest/.tox/tempest/lib/python3.8/site-packages/gabbi/case.py", line 97, in wrapper
    func(self)
      File "/opt/stack/tempest/.tox/tempest/lib/python3.8/site-packages/gabbi/case.py", line 164, in test_request
    self._run_test()
      File "/opt/stack/tempest/.tox/tempest/lib/python3.8/site-packages/gabbi/case.py", line 599, in _run_test
    self._run_request(full_url, method, headers, body,
      File "/opt/stack/tempest/.tox/tempest/lib/python3.8/site-packages/gabbi/case.py", line 498, in _run_request
    response, content = self.http.request(
      File "/opt/stack/tempest/.tox/tempest/lib/python3.8/site-packages/gabbi/httpclient.py", line 43, in request
    response = super(Http, self).request(
      File "/opt/stack/tempest/.tox/tempest/lib/python3.8/site-packages/urllib3/request.py", line 74, in request
    return self.request_encode_url(
      File "/opt/stack/tempest/.tox/tempest/lib/python3.8/site-packages/urllib3/request.py", line 96, in request_encode_url
    return self.urlopen(method, url, **extra_kw)
      File "/opt/stack/tempest/.tox/tempest/lib/python3.8/site-packages/urllib3/poolmanager.py", line 375, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
      File "/opt/stack/tempest/.tox/tempest/lib/python3.8/site-packages/urllib3/connectionpool.py", line 692, in urlopen
    conn = self._get_conn(timeout=pool_timeout)
      File "/opt/stack/tempest/.tox/tempest/lib/python3.8/site-packages/urllib3/connectionpool.py", line 281, in _get_conn
    return conn or self._new_conn()
      File "/opt/stack/tempest/.tox/tempest/lib/python3.8/site-packages/urllib3/connectionpool.py", line 235, in _new_conn
    conn = self.ConnectionCls(
      File "/opt/stack/tempest/.tox/tempest/lib/python3.8/site-packages/urllib3/connection.py", line 130, in __init__
    _HTTPConnection.__init__(self, *args, **kw)
    TypeError: __init__() got an unexpected keyword argument 'server_hostname'

The problem seems to be that the server_hostname argument, which was added by https://github.com/cdent/gabbi/pull/306 , is only available for HTTPSConnection and not yet implemented in HTTPConnection[1].

[1] https://docs.python.org/3/library/http.client.html#http.client.HTTPConnection

kajinamit commented 2 years ago

Hmm... now this sounds line an issue with urllib3 instead of gabbi. The poolmanager is not aware of the protocol and each pool in that poolmanger should determine which arguments should be used.

cdent commented 2 years ago

Until we get this resolved, I have yanked 2.5.0