Skip to content

Commit 14bc733

Browse files
PortManager (#234)
Main - Old PortManager was deleted - PostresNode uses new "abstract" interface PortManager to reserve/release port number. - PostgresNode.free_port always resets port number - OsOperations::is_free_port is added - PostgresNode.start raises exception (InvalidOperationException) if node is None Refactoring - PostgresNode::port is RO-property now. It throws if port is None - PostgresNode::host is RO-property now - PostgresNode::ssh_key is RO-property now - PostgresNode::name is RO-property now
1 parent 6e7d315 commit 14bc733

23 files changed

+993
-431
lines changed

Dockerfile--altlinux_10.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,4 @@ ssh-keygen -t rsa -f ~/.ssh/id_rsa -q -N ''; \
115115
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys; \
116116
chmod 600 ~/.ssh/authorized_keys; \
117117
ls -la ~/.ssh/; \
118-
TEST_FILTER=\"TestTestgresLocal or TestOsOpsLocal or local_ops\" bash ./run_tests.sh;"
118+
TEST_FILTER=\"TestTestgresLocal or TestOsOpsLocal or local\" bash ./run_tests.sh;"

Dockerfile--altlinux_11.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,4 @@ ssh-keygen -t rsa -f ~/.ssh/id_rsa -q -N ''; \
115115
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys; \
116116
chmod 600 ~/.ssh/authorized_keys; \
117117
ls -la ~/.ssh/; \
118-
TEST_FILTER=\"TestTestgresLocal or TestOsOpsLocal or local_ops\" bash ./run_tests.sh;"
118+
TEST_FILTER=\"TestTestgresLocal or TestOsOpsLocal or local\" bash ./run_tests.sh;"

Dockerfile--ubuntu_24_04.tmpl

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ RUN apt install -y sudo curl ca-certificates
1010
RUN apt update
1111
RUN apt install -y openssh-server
1212
RUN apt install -y time
13+
RUN apt install -y netcat-traditional
1314

1415
RUN apt update
1516
RUN apt install -y postgresql-common

run_tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
set -eux
66

77
if [ -z ${TEST_FILTER+x} ]; \
8-
then export TEST_FILTER="TestTestgresLocal or (TestTestgresCommon and (not remote_ops))"; \
8+
then export TEST_FILTER="TestTestgresLocal or (TestTestgresCommon and (not remote))"; \
99
fi
1010

1111
# fail early

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
setup(
3030
version='1.10.5',
3131
name='testgres',
32-
packages=['testgres', 'testgres.operations', 'testgres.helpers'],
32+
packages=['testgres', 'testgres.operations'],
3333
description='Testing utility for PostgreSQL and its extensions',
3434
url='https://github.com/postgrespro/testgres',
3535
long_description=readme,

testgres/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
DumpFormat
3535

3636
from .node import PostgresNode, NodeApp
37+
from .node import PortManager
3738

3839
from .utils import \
3940
reserve_port, \
@@ -53,8 +54,6 @@
5354
from .operations.local_ops import LocalOperations
5455
from .operations.remote_ops import RemoteOperations
5556

56-
from .helpers.port_manager import PortManager
57-
5857
__all__ = [
5958
"get_new_node",
6059
"get_remote_node",
@@ -64,7 +63,8 @@
6463
"TestgresException", "ExecUtilException", "QueryException", "TimeoutException", "CatchUpException", "StartNodeException", "InitNodeException", "BackupException", "InvalidOperationException",
6564
"XLogMethod", "IsolationLevel", "NodeStatus", "ProcessType", "DumpFormat",
6665
"PostgresNode", "NodeApp",
66+
"PortManager",
6767
"reserve_port", "release_port", "bound_ports", "get_bin_path", "get_pg_config", "get_pg_version",
68-
"First", "Any", "PortManager",
68+
"First", "Any",
6969
"OsOperations", "LocalOperations", "RemoteOperations", "ConnectionParams"
7070
]

testgres/exceptions.py

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ class TestgresException(Exception):
77
pass
88

99

10+
class PortForException(TestgresException):
11+
pass
12+
13+
1014
@six.python_2_unicode_compatible
1115
class ExecUtilException(TestgresException):
1216
def __init__(self, message=None, command=None, exit_code=0, out=None, error=None):

testgres/helpers/__init__.py

Whitespace-only changes.

testgres/helpers/port_manager.py

-41
This file was deleted.

0 commit comments

Comments
 (0)