When running the test suite after urllib3 was upgraded to 2.0.1, we are getting the following test failure:
```
======================================================================
ERROR: test_keystoneauth_betamax_fixture (keystoneauth1.tests.unit.test_betamax_fixture.TestBetamaxFixture)
keystoneauth1.tests.unit.test_betamax_fixture.TestBetamaxFixture.test_keystoneauth_betamax_fixture
----------------------------------------------------------------------
testtools.testresult.real._StringException: Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/urllib3/response.py", line 705, in _error_catcher
yield
File "/usr/lib/python3.10/site-packages/urllib3/response.py", line 830, in _raw_read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
urllib3.exceptions.IncompleteRead: IncompleteRead(780 bytes read, 1904 more expected)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/urllib3/response.py", line 722, in _error_catcher
raise ProtocolError(f"Connection broken: {e!r}", e) from e
urllib3.exceptions.ProtocolError: ('Connection broken: IncompleteRead(780 bytes read, 1904 more expected)', IncompleteRead(780 bytes read, 1904 more expected))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/var/tmp/portage/dev-python/keystoneauth1-5.2.0/work/keystoneauth1-5.2.0/keystoneauth1/tests/unit/test_betamax_fixture.py", line 54, in test_keystoneauth_betamax_fixture
self._replay_cassette()
File "/var/tmp/portage/dev-python/keystoneauth1-5.2.0/work/keystoneauth1-5.2.0/keystoneauth1/tests/unit/test_betamax_fixture.py", line 51, in _replay_cassette
s.get_token(auth=plugin)
File "/var/tmp/portage/dev-python/keystoneauth1-5.2.0/work/keystoneauth1-5.2.0/keystoneauth1/session.py", line 1215, in get_token
return (self.get_auth_headers(auth) or {}).get('X-Auth-Token')
File "/var/tmp/portage/dev-python/keystoneauth1-5.2.0/work/keystoneauth1-5.2.0/keystoneauth1/session.py", line 1193, in get_auth_headers
return auth.get_headers(self, **kwargs)
File "/var/tmp/portage/dev-python/keystoneauth1-5.2.0/work/keystoneauth1-5.2.0/keystoneauth1/plugin.py", line 106, in get_headers
token = self.get_token(session)
File "/var/tmp/portage/dev-python/keystoneauth1-5.2.0/work/keystoneauth1-5.2.0/keystoneauth1/identity/base.py", line 85, in get_token
return self.get_access(session).auth_token
File "/var/tmp/portage/dev-python/keystoneauth1-5.2.0/work/keystoneauth1-5.2.0/keystoneauth1/identity/base.py", line 131, in get_access
self.auth_ref = self.get_auth_ref(session)
File "/var/tmp/portage/dev-python/keystoneauth1-5.2.0/work/keystoneauth1-5.2.0/keystoneauth1/identity/v2.py", line 59, in get_auth_ref
resp = session.post(url, json=params, headers=headers,
File "/var/tmp/portage/dev-python/keystoneauth1-5.2.0/work/keystoneauth1-5.2.0/keystoneauth1/session.py", line 1141, in post
return self.request(url, 'POST', **kwargs)
File "/var/tmp/portage/dev-python/keystoneauth1-5.2.0/work/keystoneauth1-5.2.0/keystoneauth1/session.py", line 923, in request
resp = send(**kwargs)
File "/var/tmp/portage/dev-python/keystoneauth1-5.2.0/work/keystoneauth1-5.2.0/keystoneauth1/session.py", line 1014, in _send_request
resp = self.session.request(method, url, **kwargs)
File "/usr/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3.10/site-packages/requests/sessions.py", line 745, in send
r.content
File "/usr/lib/python3.10/site-packages/requests/models.py", line 899, in content
self._content = b"".join(self.iter_content(CONTENT_CHUNK_SIZE)) or b""
File "/usr/lib/python3.10/site-packages/requests/models.py", line 816, in generate
yield from self.raw.stream(chunk_size, decode_content=True)
File "/usr/lib/python3.10/site-packages/urllib3/response.py", line 935, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/usr/lib/python3.10/site-packages/urllib3/response.py", line 906, in read
data = self._raw_read(amt)
File "/usr/lib/python3.10/site-packages/urllib3/response.py", line 808, in _raw_read
with self._error_catcher():
File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "/usr/lib/python3.10/site-packages/urllib3/response.py", line 735, in _error_catcher
self._original_response.close()
AttributeError: 'MockHTTPResponse' object has no attribute 'close'
```
I suspect this may be a problem inside betamax but FWICS its own test suite passes 100%, so I'm reporting it here instead, in case it was something keystoneauth does to it.
Original report: https://bugs.gentoo.org/906661