api_client = <rest_framework.test.APIClient object at 0x7f67be756fd0>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f67be756ef0>
bundle_type = 'git_bare', swhid_type = 'rel', hint = False
@pytest.mark.parametrize(
"bundle_type,swhid_type,hint",
[
("flat", "rev", True),
("flat", "rel", False),
("flat", "snp", False),
("gitfast", "dir", True),
("gitfast", "rel", False),
("gitfast", "snp", False),
("git_bare", "dir", True),
("git_bare", "rel", False),
("git_bare", "snp", False),
],
)
def test_api_vault_cook_error(api_client, mocker, bundle_type, swhid_type, hint):
swhid = f"swh:1:{swhid_type}:" + "0" * 40
email = "test@test.mail"
url = reverse(
f"api-1-vault-cook-{bundle_type.replace('_', '-')}",
url_args={"swhid": swhid},
query_params={"email": email},
)
> rv = check_api_post_responses(api_client, url, data=None, status_code=400)
.tox/py3/lib/python3.7/site-packages/swh/web/tests/api/views/test_vault.py:171:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/web/tests/utils.py:181: in check_api_post_responses
api_client, url, status_code, content_type="application/json", data=data
.tox/py3/lib/python3.7/site-packages/swh/web/tests/utils.py:158: in check_api_post_response
content_type=content_type,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
response = <Response status_code=500, "application/json">, status_code = 400
content_type = 'application/json'
def _assert_http_response(
response: HttpResponse, status_code: int, content_type: str
) -> HttpResponse:
if isinstance(response, Response):
drf_response = cast(Response, response)
error_context = (
drf_response.data.pop("traceback")
if isinstance(drf_response.data, dict) and "traceback" in drf_response.data
else drf_response.data
)
elif isinstance(response, StreamingHttpResponse):
error_context = getattr(response, "traceback", response.streaming_content)
else:
error_context = getattr(response, "traceback", response.content)
> assert response.status_code == status_code, error_context
E AssertionError: Traceback (most recent call last):
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/urllib3/connection.py", line 175, in _new_conn
E (self._dns_host, self.port), self.timeout, **extra_kw
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/urllib3/util/connection.py", line 95, in create_connection
E raise err
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/urllib3/util/connection.py", line 85, in create_connection
E sock.connect(sa)
E ConnectionRefusedError: [Errno 111] Connection refused
E
E During handling of the above exception, another exception occurred:
E
E Traceback (most recent call last):
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 710, in urlopen
E chunked=chunked,
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 398, in _make_request
E conn.request(method, url, **httplib_request_kw)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/urllib3/connection.py", line 239, in request
E super(HTTPConnection, self).request(method, url, body=body, headers=headers)
E File "/usr/lib/python3.7/http/client.py", line 1260, in request
E self._send_request(method, url, body, headers, encode_chunked)
E File "/usr/lib/python3.7/http/client.py", line 1306, in _send_request
E self.endheaders(body, encode_chunked=encode_chunked)
E File "/usr/lib/python3.7/http/client.py", line 1255, in endheaders
E self._send_output(message_body, encode_chunked=encode_chunked)
E File "/usr/lib/python3.7/http/client.py", line 1030, in _send_output
E self.send(msg)
E File "/usr/lib/python3.7/http/client.py", line 970, in send
E self.connect()
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/urllib3/connection.py", line 205, in connect
E conn = self._new_conn()
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/urllib3/connection.py", line 187, in _new_conn
E self, "Failed to establish a new connection: %s" % e
E urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f67be9addd8>: Failed to establish a new connection: [Errno 111] Connection refused
E
E During handling of the above exception, another exception occurred:
E
E Traceback (most recent call last):
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/requests/adapters.py", line 450, in send
E timeout=timeout
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 826, in urlopen
E **response_kw
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 826, in urlopen
E **response_kw
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 826, in urlopen
E **response_kw
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 786, in urlopen
E method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/urllib3/util/retry.py", line 592, in increment
E raise MaxRetryError(_pool, url, error or ResponseError(cause))
E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=5005): Max retries exceeded with url: /cook (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f67be9addd8>: Failed to establish a new connection: [Errno 111] Connection refused'))
E
E During handling of the above exception, another exception occurred:
E
E Traceback (most recent call last):
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/core/api/__init__.py", line 254, in raw_verb
E return getattr(self.session, verb)(self._url(endpoint), **opts)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/requests/sessions.py", line 577, in post
E return self.request('POST', url, data=data, json=json, **kwargs)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/requests/sessions.py", line 529, in request
E resp = self.send(prep, **send_kwargs)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/requests/sessions.py", line 645, in send
E r = adapter.send(request, **kwargs)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/requests/adapters.py", line 519, in send
E raise ConnectionError(e, request=request)
E requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=5005): Max retries exceeded with url: /cook (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f67be9addd8>: Failed to establish a new connection: [Errno 111] Connection refused'))
E
E During handling of the above exception, another exception occurred:
E
E Traceback (most recent call last):
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/rest_framework/views.py", line 506, in dispatch
E response = handler(request, *args, **kwargs)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/rest_framework/decorators.py", line 50, in handler
E return func(*args, **kwargs)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/web/api/apiurls.py", line 96, in api_view_f
E response = f(request, **kwargs)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/web/api/apidoc.py", line 376, in documented_view
E raise exc
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/web/api/apidoc.py", line 373, in documented_view
E return {"data": f(request, **kwargs), "doc_data": doc_data}
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/web/api/views/vault.py", line 451, in api_vault_cook_git_bare
E res = _dispatch_cook_progress(request, "git_bare", swhid)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/web/api/views/vault.py", line 44, in _dispatch_cook_progress
E request=request,
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/web/api/views/utils.py", line 68, in api_lookup
E res = lookup_fn(*args, **kwargs)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/web/common/archive.py", line 1268, in vault_cook
E return _vault_request(vault.cook, bundle_type, swhid, email=email)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/web/common/archive.py", line 1260, in _vault_request
E return vault_fn(bundle_type, swhid, **kwargs)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/core/api/__init__.py", line 181, in meth_
E return self.post(meth._endpoint_path, post_data)
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/core/api/__init__.py", line 272, in post
E **opts,
E File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/core/api/__init__.py", line 256, in raw_verb
E raise self.api_exception(e)
E swh.core.api.APIError: An unexpected error occurred in the backend: (ConnectionError(MaxRetryError("HTTPConnectionPool(host='127.0.0.1', port=5005): Max retries exceeded with url: /cook (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f67be9addd8>: Failed to establish a new connection: [Errno 111] Connection refused'))")),)
E
E assert 500 == 400
E +500
E -400
.tox/py3/lib/python3.7/site-packages/swh/web/tests/utils.py:34: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Feb 8 2022, 4:02 PM