Source: python-scrapli
Version: 2023.7.30-2
Severity: normal
X-Debbugs-Cc: d...@debian.org, wb-t...@buildd.debian.org
Control: affects -1 buildd.debian.org

Hi,

python-scrapli has a test that tries to connect to localhost port 22:

https://sources.debian.org/src/python-scrapli/2023.7.30-2/tests/unit/transport/base/test_base_socket.py/#L6

This fails in sbuild with the unshare backend:


=================================== FAILURES ===================================
________________________ test_socket_open_close_isalive ________________________

self = <scrapli.transport.base.base_socket.Socket object at 0x7fb26b57a410>
socket_address_families = {<AddressFamily.AF_INET: 2>}

    def _connect(self, socket_address_families: Set["socket.AddressFamily"]) -> 
None:
        """
        Try to open socket to host using all possible address families

        It seems that very occasionally when resolving a hostname (i.e. 
localhost during functional
        tests against vrouter devices), a v6 address family will be the first 
af the socket
        getaddrinfo returns, in this case, because the qemu hostfwd is not 
listening on ::1, instead
        only listening on 127.0.0.1 the connection will fail. Presumably this 
is something that can
        happen in real life too... something gets resolved with a v6 address 
but is denying
        connections or just not listening on that ipv6 address. This little 
connect wrapper is
        intended to deal with these weird scenarios.

        Args:
            socket_address_families: set of address families available for the 
provided host
                really only should ever be v4 AND v6 if providing a hostname 
that resolves with
                both addresses, otherwise if you just provide a v4/v6 address 
it will just be a
                single address family for that type of address

        Returns:
            None

        Raises:
            ScrapliConnectionNotOpened: if socket refuses connection on all 
address families
            ScrapliConnectionNotOpened: if socket connection times out on all 
address families

        """
        for address_family_index, address_family in 
enumerate(socket_address_families, start=1):
            self.sock = socket.socket(address_family, socket.SOCK_STREAM)
            self.sock.settimeout(self.timeout)

            try:
>               self.sock.connect((self.host, self.port))
E               ConnectionRefusedError: [Errno 111] Connection refused

scrapli/transport/base/base_socket.py:82: ConnectionRefusedError

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

socket_transport = <scrapli.transport.base.base_socket.Socket object at 
0x7fb26b57a410>

    def test_socket_open_close_isalive(socket_transport):
        """Test socket initialization/opening"""
        assert socket_transport.host == "localhost"
        assert socket_transport.port == 22
        assert socket_transport.timeout == 10.0

>       socket_transport.open()


Please disable those tests tests:

tests/unit/transport/base/test_base_socket.py::test_socket_open_close_isalive
tests/unit/transport/base/test_base_socket.py::test_socket_bool

Cheers Jochen

Reply via email to