From: Daniele Varrazzo Date: Fri, 12 Apr 2024 12:46:49 +0000 (+0200) Subject: test(proxy): use 127.0.0.1 rather than localhost X-Git-Tag: 3.2.0~41^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6604621894fcaa8d4d9637f4935eefabbd81d007;p=thirdparty%2Fpsycopg.git test(proxy): use 127.0.0.1 rather than localhost Try to fix the flakiness shown by deaf_listen() in CI. Maybe there is a race condition in listen()/connect() but I have also seen problems related with localhost in the /etc/hosts file and ipv6, so let's first try this. --- diff --git a/tests/fix_proxy.py b/tests/fix_proxy.py index f19783519..dbc03a9f4 100644 --- a/tests/fix_proxy.py +++ b/tests/fix_proxy.py @@ -51,11 +51,11 @@ class Proxy: # Get server params host = cdict.get("host") or os.environ.get("PGHOST", "") assert isinstance(host, str) - self.server_host = host if host and not host.startswith("/") else "localhost" + self.server_host = host if host and not host.startswith("/") else "127.0.0.1" self.server_port = cdict.get("port") or os.environ.get("PGPORT", "5432") # Get client params - self.client_host = "localhost" + self.client_host = "127.0.0.1" self.client_port = self._get_random_port() # Make a connection string to the proxy