testgres 1.17.0__tar.gz → 1.18.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {testgres-1.17.0/testgres.egg-info → testgres-1.18.0}/PKG-INFO +2 -1
- {testgres-1.17.0 → testgres-1.18.0}/pyproject.toml +1 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/__init__.py +1 -1
- testgres-1.18.0/src/impl/pg_cfg_os_ops.py +221 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/node.py +40 -44
- {testgres-1.17.0 → testgres-1.18.0}/src/pubsub.py +1 -1
- {testgres-1.17.0 → testgres-1.18.0/testgres.egg-info}/PKG-INFO +2 -1
- {testgres-1.17.0 → testgres-1.18.0}/testgres.egg-info/SOURCES.txt +1 -0
- {testgres-1.17.0 → testgres-1.18.0}/testgres.egg-info/requires.txt +1 -0
- {testgres-1.17.0 → testgres-1.18.0}/tests/test_os_ops_common.py +1 -1
- {testgres-1.17.0 → testgres-1.18.0}/tests/test_testgres_common.py +50 -3
- {testgres-1.17.0 → testgres-1.18.0}/LICENSE +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/README.md +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/setup.cfg +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/api.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/backup.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/cache.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/config.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/connection.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/consts.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/decorators.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/defaults.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/enums.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/exceptions.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/impl/connection_pg8000.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/impl/connection_psycopg2.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/impl/error_utils.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/impl/file_line_reader.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/impl/internal_node_utils.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/impl/internal_utils.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/impl/platforms/darwin/internal_platform_utils.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/impl/platforms/internal_platform_utils.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/impl/platforms/internal_platform_utils_factory.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/impl/platforms/internal_platform_utils_provider.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/impl/platforms/linux/internal_platform_utils.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/impl/platforms/win32/internal_platform_utils.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/impl/port_manager__generic.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/impl/port_manager__generic2.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/impl/port_manager__this_host.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/logger.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/node_app.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/node_state.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/port_manager.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/raise_error.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/standby.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/src/utils.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/testgres.egg-info/dependency_links.txt +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/testgres.egg-info/top_level.txt +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/tests/test_api.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/tests/test_config.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/tests/test_os_ops_local.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/tests/test_os_ops_remote.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/tests/test_raise_error.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/tests/test_testgres_local.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/tests/test_testgres_remote.py +0 -0
- {testgres-1.17.0 → testgres-1.18.0}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: testgres
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.18.0
|
|
4
4
|
Summary: Testing utility for PostgreSQL and its extensions
|
|
5
5
|
Author-email: Postgres Professional <testgres@postgrespro.ru>
|
|
6
6
|
License: PostgreSQL
|
|
@@ -27,6 +27,7 @@ Requires-Dist: port-for>=0.4
|
|
|
27
27
|
Requires-Dist: psutil
|
|
28
28
|
Requires-Dist: packaging
|
|
29
29
|
Requires-Dist: testgres.os_ops<4.0.0,>=3.3.3
|
|
30
|
+
Requires-Dist: testgres.postgres_configuration<0.7.0,>=0.6.0
|
|
30
31
|
Dynamic: license-file
|
|
31
32
|
|
|
32
33
|
[](https://github.com/postgrespro/testgres/actions/workflows/ci.yml)
|
|
@@ -61,7 +61,7 @@ from testgres.operations.os_ops import OsProcessController
|
|
|
61
61
|
from testgres.operations.local_ops import LocalOperations
|
|
62
62
|
from testgres.operations.remote_ops import RemoteOperations
|
|
63
63
|
|
|
64
|
-
__version__ = "1.
|
|
64
|
+
__version__ = "1.18.0"
|
|
65
65
|
|
|
66
66
|
__all__ = [
|
|
67
67
|
"get_new_node",
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from testgres.postgres_configuration.os.abstract import configuration_os_ops as abs_pg_cfg_os_ops
|
|
4
|
+
from testgres.operations.os_ops import OsOperations
|
|
5
|
+
|
|
6
|
+
import datetime
|
|
7
|
+
import typing
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class PgCfgOsFile(abs_pg_cfg_os_ops.ConfigurationOsFile):
|
|
11
|
+
class tagData:
|
|
12
|
+
os_ops: OsOperations
|
|
13
|
+
file_path: str
|
|
14
|
+
encoding: str
|
|
15
|
+
next_line: int
|
|
16
|
+
file_lines: typing.Optional[typing.List[str]]
|
|
17
|
+
|
|
18
|
+
def __init__(
|
|
19
|
+
self,
|
|
20
|
+
os_ops: OsOperations,
|
|
21
|
+
file_path: str,
|
|
22
|
+
encoding: str,
|
|
23
|
+
):
|
|
24
|
+
assert isinstance(os_ops, OsOperations)
|
|
25
|
+
assert type(file_path) is str
|
|
26
|
+
assert type(encoding) is str
|
|
27
|
+
|
|
28
|
+
self.os_ops = os_ops
|
|
29
|
+
self.file_path = file_path
|
|
30
|
+
self.encoding = encoding
|
|
31
|
+
self.file_lines = None
|
|
32
|
+
self.next_line = 0
|
|
33
|
+
self.file_lines = None
|
|
34
|
+
return
|
|
35
|
+
|
|
36
|
+
# --------------------------------------------------------------------
|
|
37
|
+
_data: typing.Optional[tagData]
|
|
38
|
+
|
|
39
|
+
# --------------------------------------------------------------------
|
|
40
|
+
def __init__(
|
|
41
|
+
self,
|
|
42
|
+
os_ops: OsOperations,
|
|
43
|
+
file_path: str,
|
|
44
|
+
encoding: str,
|
|
45
|
+
):
|
|
46
|
+
assert isinstance(os_ops, OsOperations)
|
|
47
|
+
assert type(file_path) is str
|
|
48
|
+
|
|
49
|
+
super().__init__()
|
|
50
|
+
|
|
51
|
+
self._data = __class__.tagData(
|
|
52
|
+
os_ops,
|
|
53
|
+
file_path,
|
|
54
|
+
encoding,
|
|
55
|
+
)
|
|
56
|
+
return
|
|
57
|
+
|
|
58
|
+
# --------------------------------------------------------------------
|
|
59
|
+
def __enter__(self) -> PgCfgOsFile:
|
|
60
|
+
assert isinstance(self._data, __class__.tagData)
|
|
61
|
+
return self
|
|
62
|
+
|
|
63
|
+
# --------------------------------------------------------------------
|
|
64
|
+
def __exit__(self, exc_type, exc_val, exc_tb) -> bool:
|
|
65
|
+
if self._data is not None:
|
|
66
|
+
self.Close()
|
|
67
|
+
|
|
68
|
+
assert self._data is None
|
|
69
|
+
return False
|
|
70
|
+
|
|
71
|
+
# --------------------------------------------------------------------
|
|
72
|
+
@property
|
|
73
|
+
def Name(self) -> str:
|
|
74
|
+
assert type(self._data) is __class__.tagData
|
|
75
|
+
assert type(self._data.file_path) is str
|
|
76
|
+
return self._data.file_path
|
|
77
|
+
|
|
78
|
+
# --------------------------------------------------------------------
|
|
79
|
+
@property
|
|
80
|
+
def IsClosed(self) -> bool:
|
|
81
|
+
return self._data is None
|
|
82
|
+
|
|
83
|
+
# --------------------------------------------------------------------
|
|
84
|
+
def ReadLine(self) -> typing.Optional[str]:
|
|
85
|
+
assert type(self._data) is __class__.tagData
|
|
86
|
+
assert isinstance(self._data.os_ops, OsOperations)
|
|
87
|
+
|
|
88
|
+
if self._data.file_lines is None:
|
|
89
|
+
assert self._data.next_line == 0
|
|
90
|
+
content = self._data.os_ops.read(
|
|
91
|
+
self._data.file_path,
|
|
92
|
+
encoding=self._data.encoding,
|
|
93
|
+
binary=False,
|
|
94
|
+
)
|
|
95
|
+
assert type(content) is str
|
|
96
|
+
self._data.file_lines = content.splitlines(keepends=True)
|
|
97
|
+
|
|
98
|
+
assert type(self._data.file_lines) is list
|
|
99
|
+
|
|
100
|
+
assert self._data.next_line <= len(self._data.file_lines)
|
|
101
|
+
|
|
102
|
+
if self._data.next_line == len(self._data.file_lines):
|
|
103
|
+
return None
|
|
104
|
+
|
|
105
|
+
r = self._data.file_lines[self._data.next_line]
|
|
106
|
+
assert type(r) is str
|
|
107
|
+
|
|
108
|
+
self._data.next_line = self._data.next_line + 1
|
|
109
|
+
return r
|
|
110
|
+
|
|
111
|
+
# --------------------------------------------------------------------
|
|
112
|
+
def Overwrite(self, text: str) -> None:
|
|
113
|
+
assert type(self._data) is __class__.tagData
|
|
114
|
+
assert isinstance(self._data.os_ops, OsOperations)
|
|
115
|
+
|
|
116
|
+
self._data.os_ops.write(
|
|
117
|
+
self._data.file_path,
|
|
118
|
+
text,
|
|
119
|
+
truncate=True,
|
|
120
|
+
encoding=self._data.encoding,
|
|
121
|
+
binary=False,
|
|
122
|
+
)
|
|
123
|
+
return
|
|
124
|
+
|
|
125
|
+
# --------------------------------------------------------------------
|
|
126
|
+
def Close(self) -> None:
|
|
127
|
+
assert type(self._data) is __class__.tagData
|
|
128
|
+
self._data = None
|
|
129
|
+
return
|
|
130
|
+
|
|
131
|
+
# --------------------------------------------------------------------
|
|
132
|
+
def GetModificationTS(self) -> datetime.datetime:
|
|
133
|
+
assert type(self._data) is __class__.tagData
|
|
134
|
+
assert isinstance(self._data.os_ops, OsOperations)
|
|
135
|
+
|
|
136
|
+
stat = self._data.os_ops.get_file_stat(self._data.file_path)
|
|
137
|
+
assert stat is not None
|
|
138
|
+
assert type(stat) is dict
|
|
139
|
+
assert OsOperations.C_FILE_STAT_PROP__MTIME in stat
|
|
140
|
+
|
|
141
|
+
mtime = stat[OsOperations.C_FILE_STAT_PROP__MTIME]
|
|
142
|
+
assert mtime is not None
|
|
143
|
+
assert type(mtime) is datetime.datetime
|
|
144
|
+
return mtime
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class PgCfgOsOps(abs_pg_cfg_os_ops.ConfigurationOsOps):
|
|
148
|
+
_os_ops: OsOperations
|
|
149
|
+
_file_encoding: str
|
|
150
|
+
|
|
151
|
+
def __init__(
|
|
152
|
+
self,
|
|
153
|
+
os_ops: OsOperations,
|
|
154
|
+
file_encoding: str,
|
|
155
|
+
):
|
|
156
|
+
assert isinstance(os_ops, OsOperations)
|
|
157
|
+
assert type(file_encoding) is str
|
|
158
|
+
self._os_ops = os_ops
|
|
159
|
+
self._file_encoding = file_encoding
|
|
160
|
+
return
|
|
161
|
+
|
|
162
|
+
def Path_IsAbs(self, a: str) -> bool:
|
|
163
|
+
assert type(a) is str
|
|
164
|
+
assert isinstance(self._os_ops, OsOperations)
|
|
165
|
+
return self._os_ops.is_abs_path(a)
|
|
166
|
+
|
|
167
|
+
def Path_Join(self, a: str, *p: str) -> str:
|
|
168
|
+
assert type(a) is str
|
|
169
|
+
assert type(p) is tuple
|
|
170
|
+
assert isinstance(self._os_ops, OsOperations)
|
|
171
|
+
return self._os_ops.build_path(a, *p)
|
|
172
|
+
|
|
173
|
+
def Path_NormPath(self, a: str) -> str:
|
|
174
|
+
assert type(a) is str
|
|
175
|
+
assert isinstance(self._os_ops, OsOperations)
|
|
176
|
+
return self._os_ops.get_path_normpath(a)
|
|
177
|
+
|
|
178
|
+
def Path_AbsPath(self, a: str) -> str:
|
|
179
|
+
assert type(a) is str
|
|
180
|
+
assert isinstance(self._os_ops, OsOperations)
|
|
181
|
+
return self._os_ops.get_abs_path(a)
|
|
182
|
+
|
|
183
|
+
def Path_NormCase(self, a: str) -> str:
|
|
184
|
+
assert type(a) is str
|
|
185
|
+
assert isinstance(self._os_ops, OsOperations)
|
|
186
|
+
return self._os_ops.get_path_normcase(a)
|
|
187
|
+
|
|
188
|
+
def Path_DirName(self, a: str) -> str:
|
|
189
|
+
assert type(a) is str
|
|
190
|
+
assert isinstance(self._os_ops, OsOperations)
|
|
191
|
+
return self._os_ops.get_dirname(a)
|
|
192
|
+
|
|
193
|
+
def Path_BaseName(self, a: str) -> str:
|
|
194
|
+
assert type(a) is str
|
|
195
|
+
assert isinstance(self._os_ops, OsOperations)
|
|
196
|
+
return self._os_ops.get_path_basename(a)
|
|
197
|
+
|
|
198
|
+
def Remove(self, a: str) -> None:
|
|
199
|
+
assert type(a) is str
|
|
200
|
+
assert isinstance(self._os_ops, OsOperations)
|
|
201
|
+
self._os_ops.remove_file(a)
|
|
202
|
+
return
|
|
203
|
+
|
|
204
|
+
def OpenFileToRead(self, filePath: str) -> abs_pg_cfg_os_ops.ConfigurationOsFile:
|
|
205
|
+
assert type(filePath) is str
|
|
206
|
+
assert isinstance(self._os_ops, OsOperations)
|
|
207
|
+
f = PgCfgOsFile(self._os_ops, filePath, self._file_encoding)
|
|
208
|
+
return f
|
|
209
|
+
|
|
210
|
+
def OpenFileToWrite(self, filePath: str) -> abs_pg_cfg_os_ops.ConfigurationOsFile:
|
|
211
|
+
assert type(filePath) is str
|
|
212
|
+
assert isinstance(self._os_ops, OsOperations)
|
|
213
|
+
f = PgCfgOsFile(self._os_ops, filePath, self._file_encoding)
|
|
214
|
+
return f
|
|
215
|
+
|
|
216
|
+
def CreateFile(self, filePath: str) -> abs_pg_cfg_os_ops.ConfigurationOsFile:
|
|
217
|
+
assert type(filePath) is str
|
|
218
|
+
assert isinstance(self._os_ops, OsOperations)
|
|
219
|
+
f = PgCfgOsFile(self._os_ops, filePath, self._file_encoding)
|
|
220
|
+
self._os_ops.create_file(filePath)
|
|
221
|
+
return f
|
|
@@ -58,6 +58,7 @@ from .impl.port_manager__this_host import PortManager__ThisHost
|
|
|
58
58
|
from .impl.port_manager__generic2 import PortManager__Generic2
|
|
59
59
|
from .impl.error_utils import ErrorUtils
|
|
60
60
|
from .impl import internal_utils
|
|
61
|
+
from .impl import pg_cfg_os_ops
|
|
61
62
|
|
|
62
63
|
from .logger import TestgresLogger
|
|
63
64
|
|
|
@@ -77,6 +78,10 @@ from testgres.operations.os_ops import OsCommandResult
|
|
|
77
78
|
from testgres.operations.os_ops import OsProcessController
|
|
78
79
|
from testgres.operations.local_ops import LocalOperations
|
|
79
80
|
|
|
81
|
+
from testgres.postgres_configuration import PostgresConfiguration
|
|
82
|
+
from testgres.postgres_configuration import PostgresConfigurationReader
|
|
83
|
+
from testgres.postgres_configuration import PostgresConfigurationWriter
|
|
84
|
+
|
|
80
85
|
import ipaddress
|
|
81
86
|
import logging
|
|
82
87
|
import signal
|
|
@@ -2438,9 +2443,9 @@ class PostgresNode:
|
|
|
2438
2443
|
|
|
2439
2444
|
def set_auto_conf(
|
|
2440
2445
|
self,
|
|
2441
|
-
options,
|
|
2446
|
+
options: typing.Dict[str, typing.Any],
|
|
2442
2447
|
config='postgresql.auto.conf',
|
|
2443
|
-
rm_options=
|
|
2448
|
+
rm_options: typing.Optional[typing.Iterable[str]] = None,
|
|
2444
2449
|
):
|
|
2445
2450
|
"""
|
|
2446
2451
|
Update or remove configuration options in the specified configuration file,
|
|
@@ -2460,56 +2465,47 @@ class PostgresNode:
|
|
|
2460
2465
|
assert isinstance(self._os_ops, OsOperations)
|
|
2461
2466
|
|
|
2462
2467
|
# parse postgresql.auto.conf
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
current_directives = []
|
|
2468
|
-
for line in lines:
|
|
2469
|
-
|
|
2470
|
-
# ignore comments
|
|
2471
|
-
if line.startswith('#'):
|
|
2472
|
-
continue
|
|
2473
|
-
|
|
2474
|
-
if line.strip() == '':
|
|
2475
|
-
continue
|
|
2468
|
+
pgCfgOsOps = pg_cfg_os_ops.PgCfgOsOps(
|
|
2469
|
+
self._os_ops,
|
|
2470
|
+
"utf-8",
|
|
2471
|
+
)
|
|
2476
2472
|
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2473
|
+
pgCfg = PostgresConfiguration(
|
|
2474
|
+
self.data_dir,
|
|
2475
|
+
cfgOsOps=pgCfgOsOps,
|
|
2476
|
+
strategy=PostgresConfiguration.Strategy.Standard,
|
|
2477
|
+
)
|
|
2480
2478
|
|
|
2481
|
-
|
|
2482
|
-
|
|
2479
|
+
pgCfgFile = PostgresConfigurationReader.LoadConfigurationFile(
|
|
2480
|
+
pgCfg,
|
|
2481
|
+
config,
|
|
2482
|
+
)
|
|
2483
|
+
assert pgCfgFile is not None
|
|
2483
2484
|
|
|
2484
|
-
|
|
2485
|
-
|
|
2485
|
+
if rm_options is None:
|
|
2486
|
+
pass
|
|
2487
|
+
else:
|
|
2488
|
+
assert rm_options is not None
|
|
2489
|
+
for optionName in rm_options:
|
|
2490
|
+
assert type(optionName) is str
|
|
2491
|
+
pgCfgFile.SetOptionValue(optionName, None)
|
|
2486
2492
|
continue
|
|
2487
2493
|
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
assert
|
|
2492
|
-
assert option != ""
|
|
2493
|
-
assert option.strip() == option
|
|
2494
|
-
|
|
2495
|
-
value = options[option]
|
|
2496
|
-
valueType = type(value)
|
|
2494
|
+
for optionName in options:
|
|
2495
|
+
assert type(optionName) is str
|
|
2496
|
+
assert optionName != ""
|
|
2497
|
+
assert optionName.strip() == optionName
|
|
2497
2498
|
|
|
2498
|
-
|
|
2499
|
-
value = __class__._escape_config_value(value)
|
|
2500
|
-
elif valueType is bool:
|
|
2501
|
-
value = "on" if value else "off"
|
|
2499
|
+
optionValue = options[optionName]
|
|
2502
2500
|
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
for directive in current_directives:
|
|
2510
|
-
auto_conf += directive + "\n"
|
|
2501
|
+
pgCfgFile.SetOptionValue(
|
|
2502
|
+
optionName,
|
|
2503
|
+
optionValue,
|
|
2504
|
+
)
|
|
2505
|
+
continue
|
|
2511
2506
|
|
|
2512
|
-
|
|
2507
|
+
PostgresConfigurationWriter.WriteConfiguration(pgCfg)
|
|
2508
|
+
return
|
|
2513
2509
|
|
|
2514
2510
|
def upgrade_from(
|
|
2515
2511
|
self,
|
|
@@ -183,7 +183,7 @@ class Subscription:
|
|
|
183
183
|
|
|
184
184
|
# additional parameters
|
|
185
185
|
if params:
|
|
186
|
-
query += " with ({})".format(options_string(**params))
|
|
186
|
+
query += " with ({})".format(options_string(separator=", ", **params))
|
|
187
187
|
|
|
188
188
|
# Note: cannot run 'create subscription' query in transaction mode
|
|
189
189
|
self.node.execute(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: testgres
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.18.0
|
|
4
4
|
Summary: Testing utility for PostgreSQL and its extensions
|
|
5
5
|
Author-email: Postgres Professional <testgres@postgrespro.ru>
|
|
6
6
|
License: PostgreSQL
|
|
@@ -27,6 +27,7 @@ Requires-Dist: port-for>=0.4
|
|
|
27
27
|
Requires-Dist: psutil
|
|
28
28
|
Requires-Dist: packaging
|
|
29
29
|
Requires-Dist: testgres.os_ops<4.0.0,>=3.3.3
|
|
30
|
+
Requires-Dist: testgres.postgres_configuration<0.7.0,>=0.6.0
|
|
30
31
|
Dynamic: license-file
|
|
31
32
|
|
|
32
33
|
[](https://github.com/postgrespro/testgres/actions/workflows/ci.yml)
|
|
@@ -27,6 +27,7 @@ src/impl/error_utils.py
|
|
|
27
27
|
src/impl/file_line_reader.py
|
|
28
28
|
src/impl/internal_node_utils.py
|
|
29
29
|
src/impl/internal_utils.py
|
|
30
|
+
src/impl/pg_cfg_os_ops.py
|
|
30
31
|
src/impl/port_manager__generic.py
|
|
31
32
|
src/impl/port_manager__generic2.py
|
|
32
33
|
src/impl/port_manager__this_host.py
|
|
@@ -545,7 +545,7 @@ class TestOsOpsCommon:
|
|
|
545
545
|
|
|
546
546
|
tmpdir = os_ops.mkdtemp(name_with_surprize.value)
|
|
547
547
|
|
|
548
|
-
cmd = ["sh", "-c", "cp
|
|
548
|
+
cmd = ["sh", "-c", "cp /bin/sh " + os_ops.quote_path(tmpdir)]
|
|
549
549
|
|
|
550
550
|
os_ops.exec_command(cmd)
|
|
551
551
|
|
|
@@ -6,7 +6,6 @@ from tests.helpers.global_data import PostgresNodeService
|
|
|
6
6
|
from tests.helpers.global_data import PostgresNodeServices
|
|
7
7
|
from tests.helpers.global_data import OsOperations
|
|
8
8
|
from tests.helpers.global_data import PortManager
|
|
9
|
-
from tests.helpers.pg_cfg_os_ops import PgCfgOsOps
|
|
10
9
|
from tests.helpers.pg_msg_builder import PgMsgBuilder
|
|
11
10
|
|
|
12
11
|
from tests.conftest_helpers import TestServices
|
|
@@ -26,6 +25,7 @@ from src.utils import execute_utility2
|
|
|
26
25
|
from src.defaults import default_username
|
|
27
26
|
from src.defaults import default_username2
|
|
28
27
|
from src.config import testgres_config as tconf
|
|
28
|
+
from src.impl.pg_cfg_os_ops import PgCfgOsOps
|
|
29
29
|
from src import ProcessType
|
|
30
30
|
from src import NodeStatus
|
|
31
31
|
from src import IsolationLevel
|
|
@@ -129,7 +129,7 @@ class TestTestgresCommon:
|
|
|
129
129
|
|
|
130
130
|
# Author: Mark G.
|
|
131
131
|
assert v.major == 1
|
|
132
|
-
assert v.minor ==
|
|
132
|
+
assert v.minor == 18
|
|
133
133
|
assert v.micro == 0
|
|
134
134
|
|
|
135
135
|
assert str(v) == testgres_version
|
|
@@ -2386,7 +2386,7 @@ class TestTestgresCommon:
|
|
|
2386
2386
|
# create new publication and subscription for specific table
|
|
2387
2387
|
# (omitting copying data as it's already done)
|
|
2388
2388
|
pub = node1.publish('newpub', tables=['test'])
|
|
2389
|
-
sub = node2.subscribe(pub, 'newsub', copy_data=False)
|
|
2389
|
+
sub = node2.subscribe(pub, 'newsub', copy_data=False, enabled=True)
|
|
2390
2390
|
|
|
2391
2391
|
node1.safe_psql('insert into test values (4, 4)')
|
|
2392
2392
|
sub.catchup()
|
|
@@ -3183,6 +3183,53 @@ where c.relname=%s;"""
|
|
|
3183
3183
|
))
|
|
3184
3184
|
return ok
|
|
3185
3185
|
|
|
3186
|
+
def test_set_auto_conf(
|
|
3187
|
+
self,
|
|
3188
|
+
node_svc: PostgresNodeService,
|
|
3189
|
+
):
|
|
3190
|
+
# elements contain [property id, value, storage value]
|
|
3191
|
+
options = {
|
|
3192
|
+
"autovacuum_max_workers": 3,
|
|
3193
|
+
"max_connections": 123,
|
|
3194
|
+
}
|
|
3195
|
+
|
|
3196
|
+
with __class__.helper__get_node(node_svc) as node:
|
|
3197
|
+
node.init()
|
|
3198
|
+
|
|
3199
|
+
auto_conf_path = node.os_ops.build_path(
|
|
3200
|
+
node.data_dir,
|
|
3201
|
+
"postgresql.auto.conf",
|
|
3202
|
+
)
|
|
3203
|
+
|
|
3204
|
+
node.set_auto_conf(
|
|
3205
|
+
options,
|
|
3206
|
+
config=auto_conf_path,
|
|
3207
|
+
)
|
|
3208
|
+
content = node.os_ops.read(
|
|
3209
|
+
auto_conf_path,
|
|
3210
|
+
encoding="utf-8",
|
|
3211
|
+
)
|
|
3212
|
+
assert type(content) is str
|
|
3213
|
+
assert "autovacuum_max_workers = 3" in content
|
|
3214
|
+
assert "max_connections = 123" in content
|
|
3215
|
+
|
|
3216
|
+
node.set_auto_conf(
|
|
3217
|
+
{
|
|
3218
|
+
"max_connections": None,
|
|
3219
|
+
},
|
|
3220
|
+
config=auto_conf_path,
|
|
3221
|
+
rm_options=["autovacuum_max_workers"],
|
|
3222
|
+
)
|
|
3223
|
+
content = node.os_ops.read(
|
|
3224
|
+
auto_conf_path,
|
|
3225
|
+
encoding="utf-8",
|
|
3226
|
+
)
|
|
3227
|
+
assert type(content) is str
|
|
3228
|
+
assert "autovacuum_max_workers" not in content
|
|
3229
|
+
assert "max_connections" not in content
|
|
3230
|
+
|
|
3231
|
+
return
|
|
3232
|
+
|
|
3186
3233
|
class tag_rmdirs_protector:
|
|
3187
3234
|
_os_ops: OsOperations
|
|
3188
3235
|
_cwd: str
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|