Skip to content
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

cluster: remove hooks #414

Open
oleg-jukovec opened this issue Feb 16, 2025 · 1 comment
Open

cluster: remove hooks #414

oleg-jukovec opened this issue Feb 16, 2025 · 1 comment

Comments

@oleg-jukovec
Copy link

oleg-jukovec commented Feb 16, 2025

Please remove the hooks and the logic around:

luatest/luatest/cluster.lua

Lines 351 to 353 in b446120

hooks.before_all_preloaded(init)
hooks.after_each_preloaded(drop)
hooks.after_all_preloaded(clean)

The testing framework should be universal, but these hooks limit it to some specific case. As example, I can't:

  1. I want to start 3 clusters and don't drop them between separate tests.
  2. I want to start a single cluster of config storage for all tests.

As an alternative way: add a cluster option to be able to create a cluster without the logic.

@Totktonada
Copy link
Member

I agree that a flexibility is wishful here. I would add a detach option that disables the autostop and allows to control the lifespan of the cluster object manually.

However, I would keep the default behavior intact, because I found it convenient after ~1 year of using this helper for writing various tests. It allows:

  • reduce boilerplate code we have in each test
  • let the testing framework bother about cleanup activities
  • reduce chance that a developer forget about cleanup at all

I agree that this default doesn't handle all the possible situations, but it is convenient for many of them.

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

No branches or pull requests

2 participants