Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbb3d09b

Browse files
Merge pull request#180 from dmitry-lipetsk/D20250217_001--tmp
[BUG FIX] A problem with socket directory is fixed
2 parents67beb95 +89c8625 commitbb3d09b

File tree

2 files changed

+40
-6
lines changed

2 files changed

+40
-6
lines changed

‎testgres/node.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
importsubprocess
77
importthreading
88
importtempfile
9+
importplatform
910
fromqueueimportQueue
1011

1112
importtime
@@ -1925,7 +1926,7 @@ def make_simple(
19251926

19261927
# Define delayed propertyes
19271928
ifnot ("unix_socket_directories"inoptions.keys()):
1928-
options["unix_socket_directories"]=__class__._gettempdir()
1929+
options["unix_socket_directories"]=__class__._gettempdir_for_socket()
19291930

19301931
# Set config values
19311932
node.set_auto_conf(options)
@@ -1938,6 +1939,33 @@ def make_simple(
19381939

19391940
returnnode
19401941

1942+
def_gettempdir_for_socket():
1943+
platform_system_name=platform.system().lower()
1944+
1945+
ifplatform_system_name=="windows":
1946+
return__class__._gettempdir()
1947+
1948+
#
1949+
# [2025-02-17] Hot fix.
1950+
#
1951+
# Let's use hard coded path as Postgres likes.
1952+
#
1953+
# pg_config_manual.h:
1954+
#
1955+
# #ifndef WIN32
1956+
# #define DEFAULT_PGSOCKET_DIR "/tmp"
1957+
# #else
1958+
# #define DEFAULT_PGSOCKET_DIR ""
1959+
# #endif
1960+
#
1961+
# On the altlinux-10 tempfile.gettempdir() may return
1962+
# the path to "private" temp directiry - "/temp/.private/<username>/"
1963+
#
1964+
# But Postgres want to find a socket file in "/tmp" (see above).
1965+
#
1966+
1967+
return"/tmp"
1968+
19411969
def_gettempdir():
19421970
v=tempfile.gettempdir()
19431971

‎tests/test_simple.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,13 +1244,19 @@ def test_simple_with_bin_dir(self):
12441244
correct_bin_dir=app.make_simple(base_dir=node.base_dir,bin_dir=bin_dir)
12451245
correct_bin_dir.slow_start()
12461246
correct_bin_dir.safe_psql("SELECT 1;")
1247+
correct_bin_dir.stop()
1248+
1249+
whileTrue:
1250+
try:
1251+
app.make_simple(base_dir=node.base_dir,bin_dir="wrong/path")
1252+
exceptFileNotFoundError:
1253+
break# Expected error
1254+
exceptExecUtilException:
1255+
break# Expected error
12471256

1248-
try:
1249-
wrong_bin_dir=app.make_empty(base_dir=node.base_dir,bin_dir="wrong/path")
1250-
wrong_bin_dir.slow_start()
12511257
raiseRuntimeError("Error was expected.")# We should not reach this
1252-
exceptFileNotFoundError:
1253-
pass# Expected error
1258+
1259+
return
12541260

12551261
deftest_set_auto_conf(self):
12561262
# elements contain [property id, value, storage value]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp