Skip to content

[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

Merged
merged 15 commits into from
Nov 16, 2022

Conversation

avaness
Copy link
Contributor

@avaness avaness commented Oct 18, 2022

verified on python 2.7, 3.7, 3.10, 3.11

@avaness avaness requested a review from funny-falcon October 18, 2022 09:53

def __init__(self, *args, **kwargs):
super(ProbackupTest, self).__init__(*args, **kwargs)

if isinstance(self, unittest.TestCase):
self.module_name = self.id().split('.')[1]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А нужно такое общее?
Почему нельзя просто в каждом классе присвоить module_name ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хмм... наверное всё-таки так хорошо.
Только тогда не нужно объявлять на уровне класса module_name и fname.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

И может в других модулях так же сделать? Не только в cfs

# 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))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а cfs_validate_backup не проходит?

@@ -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
Copy link
Collaborator

@funny-falcon funny-falcon Oct 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так вроде ж теперь в __init__ ставишь

@avaness avaness force-pushed the REL_2_5-PBCKP-304 branch 4 times, most recently from 5410118 to 211159e Compare October 22, 2022 23:20
@@ -202,6 +202,8 @@ class ProbackupTest(object):
enterprise = is_enterprise()
enable_nls = is_nls_enabled()

nodes_to_cleanup = []
Copy link
Collaborator

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.

@avaness avaness force-pushed the REL_2_5-PBCKP-304 branch 3 times, most recently from c01980a to 7832c81 Compare November 8, 2022 04:04
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?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пока не зачищаем для упавших тестов. Только останавливаем.

if o.__class__ is testgres.PostgresNode:
# removing node from slow_start enclosure
# after this the node is collectable by gc
o.slow_start = None
Copy link
Collaborator

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

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()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ну и зачем мы это оставляем, не очень понимаю.

@funny-falcon funny-falcon merged commit 4c823b3 into REL_2_5 Nov 16, 2022
@funny-falcon funny-falcon deleted the REL_2_5-PBCKP-304 branch December 10, 2022 14:03
@Burus Burus added this to the 2.5.9 milestone Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants