]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
test(proxy): use 127.0.0.1 rather than localhost
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 12 Apr 2024 12:46:49 +0000 (14:46 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 17 Apr 2024 21:51:20 +0000 (23:51 +0200)
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.

tests/fix_proxy.py

index f1978351931d6e43cdb3b029e1babb4b58a9f565..dbc03a9f4231809ac3fe12be7a96a548862b697b 100644 (file)
@@ -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