8000 NodeApp is refactored by dmitry-lipetsk · Pull Request #278 · postgrespro/testgres · GitHub
[go: up one dir, main page]

Skip to content

NodeApp is refactored #278

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
17fb8c3
NodeApp was moved to own py-file (refactoring)
dmitry-lipetsk Jun 26, 2025
8eaa289
NodeApp is refactored totally
dmitry-lipetsk Jun 26, 2025
2246447
NodeApp::test_path is corrected
dmitry-lipetsk Jun 26, 2025
3fe3e94
Default value of 'pg_options' (NodeApp::make_simple) is None
dmitry-lipetsk Jun 27, 2025
c1afd7e
Merge branch 'master' into D20250626_001--node_app
dmitry-lipetsk Jun 27, 2025
1062a97
OsOperations::create_clone is added
dmitry-lipetsk Jun 27, 2025
1512fe7
[#277] NodeApp::make_empty does not allow None/empty base_dir
dmitry-lipetsk Jun 27, 2025
b5b0d2b
[#267] NodeApp.make_simple does not change 'initdb_params'
dmitry-lipetsk Jun 27, 2025
dffde2c
test_node_app__make_empty__base_dir_is_None is corrected
dmitry-lipetsk Jun 27, 2025
d5c3672
NodeApp::make_simple is corrected (bad assert)
dmitry-lipetsk Jun 27, 2025
aae53eb
test_node_app__make_empty__base_dir_is_xxx is updated
dmitry-lipetsk Jun 27, 2025
488d556
[#265] NodeApp.make_simple links a new node with own os_ops and port_…
dmitry-lipetsk Jun 27, 2025
688b89f
test_node_app__make_empty is corrected
dmitry-lipetsk Jun 27, 2025
4f85ce5
NodeApp::nodes_to_cleanup is RO-property
dmitry-lipetsk Jun 27, 2025
f79e9a7
flake8
dmitry-lipetsk Jun 27, 2025
5817f63
test_node_app__make_empty is fixed
dmitry-lipetsk Jun 28, 2025
0547b0b
PostgresNode::release_resources(self) is added
dmitry-lipetsk Jun 28, 2025
1b12ca3
[FIX] NodeApp::make_empty processes a failure of self._nodes_to_clean…
dmitry-lipetsk Jun 28, 2025
1af3dfa
New test test_node_app__make_empty_with_explicit_port is added
dmitry-lipetsk Jun 28, 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
Prev Previous commit
Next Next commit
PostgresNode::release_resources(self) is added
  • Loading branch information
dmitry-lipetsk committed Jun 28, 2025
commit 0547b0b92db8efb7e5dba97479a21a99d187ed19
43 changes: 26 additions & 17 deletions testgres/node.py
< 8000 td class="blob-num blob-num-deletion empty-cell">
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,6 @@ def _try_shutdown(self, max_attempts, with_force=False):
ps_output,
ps_command)

def _release_resources(self):
self.free_port()

@staticmethod
def _throw_bugcheck__unexpected_result_of_ps(result, cmd):
assert type(result) == str # noqa: E721
Expand Down Expand Up @@ -1324,25 +1321,18 @@ def pg_ctl(self, params):

return execute_utility2(self.os_ops, _params, self.utils_log_file)

def release_resources(self):
"""
Release resorces owned by this node.
"""
return self._release_resources()

def free_port(self):
"""
Reclaim port owned by this node.
NOTE: this method does not release manually defined port but reset it.
"""
assert type(self._should_free_port) == bool # noqa: E721

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

assert self._port_manager is not None
assert isinstance(self._port_manager, PortManager)

port = self._port
self._should_free_port = False
self._port = None
self._port_manager.release_port(port)
return self._free_port()

def cleanup(self, max_attempts=3, full=False, release_resources=False):
"""
Expand Down Expand Up @@ -2156,6 +2146,25 @@ def upgrade_from(self, old_node, options=None, expect_error=False):

return self.os_ops.exec_command(upgrade_command, expect_error=expect_error)

def _release_resources(self):
self._free_port()

def _free_port(self):
assert type(self._should_free_port) == bool # noqa: E721

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

assert self._port_manager is not None
assert isinstance(self._port_manager, PortManager)

port = self._port
self._should_free_port = False
self._port = None
self._port_manager.release_port(port)

def _get_bin_path(self, filename):
assert self._os_ops is not None
assert isinstance(self._os_ops, OsOperations)
Expand Down
0