Skip to content

feat(document-search): Implement document search public interface #90

feat(document-search): Implement document search public interface

feat(document-search): Implement document search public interface #90

GitHub Actions / JUnit Test Report failed Oct 3, 2024 in 0s

82 tests run, 77 passed, 4 skipped, 1 failed.

Annotations

Check failure on line 22 in packages/ragbits-document-search/tests/unit/test_gcs_source.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_gcs_source.test_gcs_source_fetch

aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host metadata.google.internal:80 ssl:default [Name or service not known]
Raw output
self = <aiohttp.connector.TCPConnector object at 0x7f7638fd81c0>
req = <aiohttp.client_reqrep.ClientRequest object at 0x7f7638fd8d90>
traces = []
timeout = ClientTimeout(total=10, connect=None, sock_read=None, sock_connect=None, ceil_threshold=5)

    async def _create_direct_connection(
        self,
        req: ClientRequest,
        traces: List["Trace"],
        timeout: "ClientTimeout",
        *,
        client_error: Type[Exception] = ClientConnectorError,
    ) -> Tuple[asyncio.Transport, ResponseHandler]:
        sslcontext = self._get_ssl_context(req)
        fingerprint = self._get_fingerprint(req)
    
        host = req.url.raw_host
        assert host is not None
        # Replace multiple trailing dots with a single one.
        # A trailing dot is only present for fully-qualified domain names.
        # See https://github.com/aio-libs/aiohttp/pull/7364.
        if host.endswith(".."):
            host = host.rstrip(".") + "."
        port = req.port
        assert port is not None
        try:
            # Cancelling this lookup should not cancel the underlying lookup
            #  or else the cancel event will get broadcast to all the waiters
            #  across all connections.
>           hosts = await self._resolve_host(host, port, traces=traces)

.venv/lib/python3.10/site-packages/aiohttp/connector.py:1287: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.venv/lib/python3.10/site-packages/aiohttp/connector.py:938: in _resolve_host
    return await asyncio.shield(resolved_host_task)
.venv/lib/python3.10/site-packages/aiohttp/connector.py:975: in _resolve_host_with_throttle
    addrs = await self._resolver.resolve(host, port, family=self._family)
.venv/lib/python3.10/site-packages/aiohttp/resolver.py:38: in resolve
    infos = await self._loop.getaddrinfo(
/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/asyncio/base_events.py:863: in getaddrinfo
    return await self.run_in_executor(
/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/concurrent/futures/thread.py:58: in run
    result = self.fn(*self.args, **self.kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

host = 'metadata.google.internal', port = 80
family = <AddressFamily.AF_UNSPEC: 0>, type = <SocketKind.SOCK_STREAM: 1>
proto = 0, flags = <AddressInfo.AI_ADDRCONFIG: 32>

    def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0):
        """Resolve host and port into list of address info entries.
    
        Translate the host/port argument into a sequence of 5-tuples that contain
        all the necessary arguments for creating a socket connected to that service.
        host is a domain name, a string representation of an IPv4/v6 address or
        None. port is a string service name such as 'http', a numeric port number or
        None. By passing None as the value of host and port, you can pass NULL to
        the underlying C API.
    
        The family, type and proto arguments can be optionally specified in order to
        narrow the list of addresses returned. Passing zero as a value for each of
        these arguments selects the full range of results.
        """
        # We override this function since we want to translate the numeric family
        # and socket type values to enum constants.
        addrlist = []
>       for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
E       socket.gaierror: [Errno -2] Name or service not known

/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/socket.py:967: gaierror

The above exception was the direct cause of the following exception:

    async def test_gcs_source_fetch():
        source = GCSSource(bucket="", object_name="test_gcs_source.py")
    
        path = await source.fetch()
        assert path == TEST_FILE_PATH
    
        source = GCSSource(bucket="", object_name="not_found_file.py")
        with pytest.raises(aiohttp.ClientResponseError):
>           await source.fetch()

packages/ragbits-document-search/tests/unit/test_gcs_source.py:22: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
packages/ragbits-document-search/src/ragbits/document_search/documents/sources.py:119: in fetch
    content = await client.download(self.bucket, self.object_name)
.venv/lib/python3.10/site-packages/gcloud/aio/storage/storage.py:330: in download
    return await self._download(
.venv/lib/python3.10/site-packages/gcloud/aio/storage/storage.py:589: in _download
    headers.update(await self._headers())
.venv/lib/python3.10/site-packages/gcloud/aio/storage/storage.py:178: in _headers
    token = await self.token.get()
.venv/lib/python3.10/site-packages/gcloud/aio/auth/token.py:211: in get
    await self.ensure_token()
.venv/lib/python3.10/site-packages/gcloud/aio/auth/token.py:227: in ensure_token
    await self.acquiring
.venv/lib/python3.10/site-packages/backoff/_async.py:151: in retry
    ret = await target(*args, **kwargs)
.venv/lib/python3.10/site-packages/gcloud/aio/auth/token.py:235: in acquire_access_token
    resp = await self.refresh(timeout=timeout)
.venv/lib/python3.10/site-packages/gcloud/aio/auth/token.py:355: in refresh
    resp = await self._refresh_gce_metadata(timeout=timeout)
.venv/lib/python3.10/site-packages/gcloud/aio/auth/token.py:294: in _refresh_gce_metadata
    resp = await self.session.get(
.venv/lib/python3.10/site-packages/gcloud/aio/auth/session.py:214: in get
    resp = await self.session.get(
.venv/lib/python3.10/site-packages/aiohttp/client.py:659: in _request
    conn = await self._connector.connect(
.venv/lib/python3.10/site-packages/aiohttp/connector.py:557: in connect
    proto = await self._create_connection(req, traces, timeout)
.venv/lib/python3.10/site-packages/aiohttp/connector.py:1002: in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <aiohttp.connector.TCPConnector object at 0x7f7638fd81c0>
req = <aiohttp.client_reqrep.ClientRequest object at 0x7f7638fd8d90>
traces = []
timeout = ClientTimeout(total=10, connect=None, sock_read=None, sock_connect=None, ceil_threshold=5)

    async def _create_direct_connection(
        self,
        req: ClientRequest,
        traces: List["Trace"],
        timeout: "ClientTimeout",
        *,
        client_error: Type[Exception] = ClientConnectorError,
    ) -> Tuple[asyncio.Transport, ResponseHandler]:
        sslcontext = self._get_ssl_context(req)
        fingerprint = self._get_fingerprint(req)
    
        host = req.url.raw_host
        assert host is not None
        # Replace multiple trailing dots with a single one.
        # A trailing dot is only present for fully-qualified domain names.
        # See https://github.com/aio-libs/aiohttp/pull/7364.
        if host.endswith(".."):
            host = host.rstrip(".") + "."
        port = req.port
        assert port is not None
        try:
            # Cancelling this lookup should not cancel the underlying lookup
            #  or else the cancel event will get broadcast to all the waiters
            #  across all connections.
            hosts = await self._resolve_host(host, port, traces=traces)
        except OSError as exc:
            if exc.errno is None and isinstance(exc, asyncio.TimeoutError):
                raise
            # in case of proxy it is not ClientProxyConnectionError
            # it is problem of resolving proxy ip itself
>           raise ClientConnectorError(req.connection_key, exc) from exc
E           aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host metadata.google.internal:80 ssl:default [Name or service not known]

.venv/lib/python3.10/site-packages/aiohttp/connector.py:1293: ClientConnectorError