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

Commite5184a4

Browse files
author
vshepard
committed
Add cleanup parameter - clean full dir
1 parenta61f794 commite5184a4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

‎testgres/node.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -912,13 +912,14 @@ def free_port(self):
912912
self._should_free_port=False
913913
release_port(self.port)
914914

915-
defcleanup(self,max_attempts=3):
915+
defcleanup(self,max_attempts=3,full=False):
916916
"""
917917
Stop node if needed and remove its data/logs directory.
918918
NOTE: take a look at TestgresConfig.node_cleanup_full.
919919
920920
Args:
921921
max_attempts: how many times should we try to stop()?
922+
full: clean full base dir
922923
923924
Returns:
924925
This instance of :class:`.PostgresNode`.
@@ -927,7 +928,7 @@ def cleanup(self, max_attempts=3):
927928
self._try_shutdown(max_attempts)
928929

929930
# choose directory to be removed
930-
iftestgres_config.node_cleanup_full:
931+
iftestgres_config.node_cleanup_fullorfull:
931932
rm_dir=self.base_dir# everything
932933
else:
933934
rm_dir=self.data_dir# just data, save logs
@@ -1655,8 +1656,7 @@ def upgrade_from(self, old_node, options=None, expect_error=False):
16551656
"--old-datadir",old_node.data_dir,
16561657
"--new-datadir",self.data_dir,
16571658
"--old-port",str(old_node.port),
1658-
"--new-port",str(self.port),
1659-
"--copy"
1659+
"--new-port",str(self.port)
16601660
]
16611661
upgrade_command+=options
16621662

‎testgres/operations/local_ops.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ def rmdirs(self, path, ignore_errors=True, retries=3, delay=1):
162162
rmtree(path,ignore_errors=ignore_errors)
163163
ifnotos.path.exists(path):
164164
returnTrue
165+
exceptFileNotFoundError:
166+
returnTrue
165167
exceptExceptionase:
166168
print(f"Error: Failed to remove directory{path} on attempt{attempt+1}:{e}")
167169
time.sleep(delay)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp