From 6fe28a5cea332d2e8f8fbc9374a9f84e4c36e287 Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Mon, 17 Feb 2025 13:51:20 +0300 Subject: [PATCH 1/3] [BUG FIX] A problem with socket directory is fixed On non-Windows platform Postgres always looks for socket files in "/tmp" directory. --- testgres/node.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/testgres/node.py b/testgres/node.py index 6f466ec9..b85a62f2 100644 --- a/testgres/node.py +++ b/testgres/node.py @@ -6,6 +6,7 @@ import subprocess import threading import tempfile +import platform from queue import Queue import time @@ -1925,7 +1926,7 @@ def make_simple( # Define delayed propertyes if not ("unix_socket_directories" in options.keys()): - options["unix_socket_directories"] = __class__._gettempdir() + options["unix_socket_directories"] = __class__._gettempdir_for_socket() # Set config values node.set_auto_conf(options) @@ -1938,6 +1939,33 @@ def make_simple( return node + def _gettempdir_for_socket(): + platform_system_name = platform.system().lower() + + if platform_system_name == "windows": + return __class__._gettempdir() + + # + # [2025-02-17] Hot fix. + # + # Let's use hard coded path as Postgres likes. + # + # pg_config_manual.h: + # + # #ifndef WIN32 + # #define DEFAULT_PGSOCKET_DIR "/tmp" + # #else + # #define DEFAULT_PGSOCKET_DIR "" + # #endif + # + # On the altlinux-10 tempfile.gettempdir() may return + # the path to "private" temp directiry - "/temp/.private//" + # + # But Postgres want to find a socket file in "/tmp" (see above). + # + + return "/tmp" + def _gettempdir(): v = tempfile.gettempdir() From 89c8625252be857d8589141921aa185ac9db2d67 Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Mon, 17 Feb 2025 14:02:24 +0300 Subject: [PATCH 2/3] A problem with tests.test_simple.TestgresTests.test_simple_with_bin_dir is fixed testgres generates the exception testgres.exceptions.ExecUtilException, but test traps the exception FileNotFoundError. Error message is: Utility exited with non-zero code. Error: `bash: line 1: wrong/path/postgres: No such file or directory` Command: ('wrong/path/postgres --version',) --- tests/test_simple.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/test_simple.py b/tests/test_simple.py index 8148d05d..4e6fb573 100644 --- a/tests/test_simple.py +++ b/tests/test_simple.py @@ -1244,13 +1244,19 @@ def test_simple_with_bin_dir(self): correct_bin_dir = app.make_simple(base_dir=node.base_dir, bin_dir=bin_dir) correct_bin_dir.slow_start() correct_bin_dir.safe_psql("SELECT 1;") + correct_bin_dir.stop() + + while True: + try: + app.make_simple(base_dir=node.base_dir, bin_dir="wrong/path") + except FileNotFoundError: + break # Expected error + except ExecUtilException: + break # Expected error - try: - wrong_bin_dir = app.make_empty(base_dir=node.base_dir, bin_dir="wrong/path") - wrong_bin_dir.slow_start() raise RuntimeError("Error was expected.") # We should not reach this - except FileNotFoundError: - pass # Expected error + + return def test_set_auto_conf(self): # elements contain [property id, value, storage value] From 737e0b4fee2249247934b147fe60feb844b3da41 Mon Sep 17 00:00:00 2001 From: asavchkov Date: Tue, 18 Feb 2025 19:23:05 +0700 Subject: [PATCH 3/3] Up version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 16586b88..3f2474dd 100755 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ readme = f.read() setup( - version='1.10.4', + version='1.10.5', name='testgres', packages=['testgres', 'testgres.operations', 'testgres.helpers'], description='Testing utility for PostgreSQL and its extensions', pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy