From 5f0159aa106196fec08a5f971295051a699ab035 Mon Sep 17 00:00:00 2001
From: Kaitmazian Maksim <m.kaitmazian@picodata.io>
Date: Thu, 29 Aug 2024 20:30:58 +0300
Subject: [PATCH] chore(tests): change pgproto server host to 127.0.0.1

---
 test/conftest.py         | 2 +-
 test/pgproto/ssl_test.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/conftest.py b/test/conftest.py
index ff56c991bc..101c258b3e 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -2240,7 +2240,7 @@ class Postgres:
     def __init__(self, cluster: Cluster, ssl: bool = False, ssl_verify: bool = False):
         # use random port in order to avoid "cannot assign requested address" error
         self.port = random.randint(2000, 30000)
-        self.host = "localhost"
+        self.host = "127.0.0.1"
         self.cluster = cluster
         self.ssl = ssl
         self.ssl_verify = ssl_verify
diff --git a/test/pgproto/ssl_test.py b/test/pgproto/ssl_test.py
index 2e9752692c..dd1a550f2f 100644
--- a/test/pgproto/ssl_test.py
+++ b/test/pgproto/ssl_test.py
@@ -57,7 +57,7 @@ def test_mtls_with_known_cert(postgres_with_mtls: Postgres):
 def test_mtls_without_client_cert(postgres_with_mtls: Postgres):
     with pytest.raises(
         psycopg.OperationalError,
-        match="(certificate required)|(Connection refused)",
+        match="certificate required",
     ):
         conn = psycopg.connect(prepare_with_tls(postgres_with_mtls, ""))
         conn.close()
@@ -66,7 +66,7 @@ def test_mtls_without_client_cert(postgres_with_mtls: Postgres):
 def test_mtls_with_unknown_cert(postgres_with_mtls: Postgres):
     with pytest.raises(
         psycopg.OperationalError,
-        match="(unknown ca)|(Connection refused)",
+        match="unknown ca",
     ):
         conn = psycopg.connect(prepare_with_tls(postgres_with_mtls, "self-signed"))
         conn.close()
-- 
GitLab