Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 84a51c7

Browse files
PostgresNode::cleanup is fixed
The problems on Probackup's CFS test are detected. Parameter 'full' must be respected!
1 parent 61feb2c commit 84a51c7

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

testgres/node.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,30 @@ def pg_log_name(self):
184184
return self.pg_log_file
185185

186186
def cleanup(self, max_attempts=3, full=False):
187-
super().cleanup(max_attempts, full)
187+
assert type(max_attempts) == int
188+
assert type(full) == bool
189+
assert max_attempts > 0
190+
191+
super().cleanup(max_attempts=max_attempts, full=full)
192+
193+
if testgres_config.node_cleanup_full:
194+
# Remove all
195+
pass
196+
elif full:
197+
# Remove all
198+
pass
199+
else:
200+
assert not full
201+
assert not testgres_config.node_cleanup_full
188202

189-
base_dir_items = self.os_ops.listdir(self.base_dir)
190-
assert base_dir_items is not None
191-
assert type(base_dir_items) == list # noqa: E721
203+
base_dir_items = self.os_ops.listdir(self.base_dir)
204+
assert base_dir_items is not None
205+
assert type(base_dir_items) == list # noqa: E721
192206

193-
if len(base_dir_items) == 0:
194-
self.os_ops.rmdirs(self.base_dir, ignore_errors=False)
207+
if len(base_dir_items) != 0:
208+
return
195209

210+
self.os_ops.rmdirs(self.base_dir, ignore_errors=False)
196211
return self
197212

198213

0 commit comments

Comments
 (0)