-
Notifications
You must be signed in to change notification settings - Fork 86
[PBCKP-304] cfs tests moved back to build, auto tests cleanup added t… #551
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
Conversation
|
||
def __init__(self, *args, **kwargs): | ||
super(ProbackupTest, self).__init__(*args, **kwargs) | ||
|
||
if isinstance(self, unittest.TestCase): | ||
self.module_name = self.id().split('.')[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А нужно такое общее?
Почему нельзя просто в каждом классе присвоить module_name ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Хмм... наверное всё-таки так хорошо.
Только тогда не нужно объявлять на уровне класса module_name и fname.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
И может в других модулях так же сделать? Не только в cfs
tests/__init__.py
Outdated
# suite.addTests(loader.loadTestsFromModule(cfs_backup)) | ||
# suite.addTests(loader.loadTestsFromModule(cfs_restore)) | ||
suite.addTests(loader.loadTestsFromModule(cfs_backup)) | ||
suite.addTests(loader.loadTestsFromModule(cfs_restore)) | ||
# suite.addTests(loader.loadTestsFromModule(cfs_validate_backup)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а cfs_validate_backup не проходит?
tests/helpers/ptrack_helpers.py
Outdated
@@ -342,6 +376,14 @@ def __init__(self, *args, **kwargs): | |||
|
|||
os.environ["PGAPPNAME"] = "pg_probackup" | |||
|
|||
def tearDown(self): | |||
# we extract module_name and fname again if setUp() call is hidden by inheritance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Так вроде ж теперь в __init__
ставишь
5410118
to
211159e
Compare
9db18c2
to
3d853cc
Compare
tests/helpers/ptrack_helpers.py
Outdated
@@ -202,6 +202,8 @@ class ProbackupTest(object): | |||
enterprise = is_enterprise() | |||
enable_nls = is_nls_enabled() | |||
|
|||
nodes_to_cleanup = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it shouldn't be class variable! It should be instance variable.
c01980a
to
7832c81
Compare
tests/helpers/ptrack_helpers.py
Outdated
self.del_test_dir(module_name, fname) | ||
else: | ||
for node in self.nodes_to_cleanup: | ||
# TODO VERIFY do we want to remain failed test's db data for further investigations? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Пока не зачищаем для упавших тестов. Только останавливаем.
tests/helpers/ptrack_helpers.py
Outdated
if o.__class__ is testgres.PostgresNode: | ||
# removing node from slow_start enclosure | ||
# after this the node is collectable by gc | ||
o.slow_start = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А не лучше ли не создавать это замыкание?
Есть два способа.
Простой:
class OurNode(testgres.PostgresNode):
def slow_start(self, replica = False):
# here is code of slow_start
...
node = testgres.get_new_node('test', base_dir=real_base_dir)
# reset __class__ to get `slow_start` method
node.__class__ = OurNode
Более "сложный" - смотри как сделан ProcessProxy в testgres
tests/helpers/ptrack_helpers.py
Outdated
o.slow_start = None | ||
gc.collect() | ||
|
||
# only when there are unhandled nodes left we do the cleanup for them | ||
for o in gc.get_referrers(testgres.PostgresNode): | ||
if o.__class__ is testgres.PostgresNode: | ||
o.cleanup() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ну и зачем мы это оставляем, не очень понимаю.
…obackupTest.tearDown()
7832c81
to
cda016c
Compare
… and its log entries calls
9f043ac
to
af4fb2e
Compare
verified on python 2.7, 3.7, 3.10, 3.11