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

PortManager#234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
32 commits
Select commitHold shift + click to select a range
09dab31
PostgresNode refactoring [PostgresNodePortManager and RO-properties]
dmitry-lipetskApr 3, 2025
ef095d3
[FIX] clone_with_new_name_and_base_dir did not respect port_manager
dmitry-lipetskApr 4, 2025
0f842fd
PostgresNodePortManager__ThisHost is defined (was: PostgresNodePortMa…
dmitry-lipetskApr 4, 2025
e1e609e
PostgresNodePortManager__Generic is added
dmitry-lipetskApr 4, 2025
285e5b7
PostgresNodePortManager is added in public API
dmitry-lipetskApr 4, 2025
a974866
Test structures were refactored (local, local2, remote)
dmitry-lipetskApr 4, 2025
110947d
CI files are updated
dmitry-lipetskApr 4, 2025
4f49dde
TestTestgresCommon.test_pgbench is added
dmitry-lipetskApr 4, 2025
4fbf51d
PostgresNodePortManager is updated [error messages]
dmitry-lipetskApr 4, 2025
17c73cb
PostgresNodePortManager(+company) was moved in own file - port_manage…
dmitry-lipetskApr 4, 2025
b1cee19
PortManager was deleted [amen]
dmitry-lipetskApr 4, 2025
c5ad907
PostgresNodePortManager was renamed with PortManager
dmitry-lipetskApr 4, 2025
0967057
TestTestgresCommon.test_unix_sockets is added
dmitry-lipetskApr 4, 2025
1d450b2
TestTestgresCommon.test_the_same_port is added
dmitry-lipetskApr 4, 2025
4a38b35
[TestTestgresCommon] New tests are added
dmitry-lipetskApr 4, 2025
322fb23
RemoteOperations::is_port_free is updated
dmitry-lipetskApr 4, 2025
94da63e
Tests for OsOps::is_port_free are added
dmitry-lipetskApr 4, 2025
88f9b73
TestTestgresCommon is corrected [python problems]
dmitry-lipetskApr 4, 2025
d9558ce
The call of RaiseError.CommandExecutionError is fixed [message, not m…
dmitry-lipetskApr 4, 2025
0da4c21
[CI] ubuntu 24.04 does not have nc
dmitry-lipetskApr 4, 2025
0058508
RemoteOperations is update [private method names]
dmitry-lipetskApr 5, 2025
8f3a566
test_is_port_free__true is updated
dmitry-lipetskApr 5, 2025
d8ebdb7
RemoteOperations::is_port_free is updated (comments)
dmitry-lipetskApr 5, 2025
30e472c
setup.py is updated [testgres.helpers was deleted]
dmitry-lipetskApr 5, 2025
c94bbb5
Comment in node.py is updated
dmitry-lipetskApr 5, 2025
04f88c7
PostgresNode::_node was deleted [use self._os_ops.host]
dmitry-lipetskApr 5, 2025
0a3442a
PostgresNode::start is corrected [error message]
dmitry-lipetskApr 5, 2025
30124f3
Merge branch 'master' into D20250403_001--port_manager
dmitry-lipetskApr 5, 2025
13e71d8
[FIX] PostgresNode.__init__ must not test "os_ops.host" attribute.
dmitry-lipetskApr 5, 2025
9e14f4a
PostgresNode.free_port always set a port to None
dmitry-lipetskApr 6, 2025
739ef61
[FIX] flake8 (noqa: E721)
dmitry-lipetskApr 6, 2025
696cc1e
PortManager__Generic is refactored
dmitry-lipetskApr 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
PostgresNode.free_port always set a port to None
Tests are added: - test_try_to_get_port_after_free_manual_port - test_try_to_start_node_after_free_manual_port
  • Loading branch information
@dmitry-lipetsk
dmitry-lipetsk committedApr 6, 2025
commit9e14f4a95f5914d7e3c1003cf57d69135b4d44b4
7 changes: 5 additions & 2 deletionstestgres/node.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1321,10 +1321,13 @@ def pg_ctl(self, params):
def free_port(self):
"""
Reclaim port owned by this node.
NOTE: does notfree auto selected ports.
NOTE:this methoddoes notrelease manually defined port but reset it.
"""
assert type(self._should_free_port) == bool

if self._should_free_port:
if not self._should_free_port:
self._port = None
else:
assert type(self._port) == int # noqa: E721

assert self._port_manager is not None
Expand Down
59 changes: 59 additions & 0 deletionstests/test_testgres_common.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1321,6 +1321,65 @@ def test_port_conflict(self, node_svc: PostgresNodeService):
r = node1.safe_psql("SELECT 3;")
assert __class__.helper__rm_carriage_returns(r) == b'3\n'

def test_try_to_get_port_after_free_manual_port(self, node_svc: PostgresNodeService):
assert type(node_svc) == PostgresNodeService # noqa: E721

assert node_svc.port_manager is not None
assert isinstance(node_svc.port_manager, PortManager)

with __class__.helper__get_node(node_svc) as node1:
assert node1 is not None
assert type(node1) == PostgresNode
assert node1.port is not None
assert type(node1.port) == int
with __class__.helper__get_node(node_svc, port=node1.port, port_manager=None) as node2:
assert node2 is not None
assert type(node1) == PostgresNode
assert node2 is not node1
assert node2.port is not None
assert type(node2.port) == int
assert node2.port == node1.port

logging.info("Release node2 port")
node2.free_port()

logging.info("try to get node2.port...")
with pytest.raises(
InvalidOperationException,
match="^" + re.escape("PostgresNode port is not defined.") + "$"
):
p = node2.port
assert p is None

def test_try_to_start_node_after_free_manual_port(self, node_svc: PostgresNodeService):
assert type(node_svc) == PostgresNodeService # noqa: E721

assert node_svc.port_manager is not None
assert isinstance(node_svc.port_manager, PortManager)

with __class__.helper__get_node(node_svc) as node1:
assert node1 is not None
assert type(node1) == PostgresNode
assert node1.port is not None
assert type(node1.port) == int
with __class__.helper__get_node(node_svc, port=node1.port, port_manager=None) as node2:
assert node2 is not None
assert type(node1) == PostgresNode
assert node2 is not node1
assert node2.port is not None
assert type(node2.port) == int
assert node2.port == node1.port

logging.info("Release node2 port")
node2.free_port()

logging.info("node2 is trying to start...")
with pytest.raises(
InvalidOperationException,
match="^" + re.escape("Can't start PostgresNode. Port is not defined.") + "$"
):
node2.start()

@staticmethod
def helper__get_node(
node_svc: PostgresNodeService,
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp