-
Notifications
You must be signed in to change notification settings - Fork 398
test: fix the use of before_all/after_all hooks
#8187
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
ylobankov
merged 1 commit into
tarantool:master
from
ochaplashkin:fix-usage-before-after-all-hooks
Jan 26, 2023
Merged
test: fix the use of before_all/after_all hooks
#8187
ylobankov
merged 1 commit into
tarantool:master
from
ochaplashkin:fix-usage-before-after-all-hooks
Jan 26, 2023
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46d4125 to
fdd5bba
Compare
21bcab6 to
063c6a0
Compare
ylobankov
approved these changes
Jan 25, 2023
063c6a0 to
e7ec5de
Compare
Changed the work with hooks in the part of tests. Legacy approach: ``` g.before_all = function() ... end g.after_all = function() ... end ``` The logic of executing hooks will be expected and more controlled if use following approach: ``` g.before_all(function() ... end) g.after_all(function() ... end) ``` Resolve tarantool#8066 NO_DOC=test fix NO_TEST=test fix NO_CHANGELOG=test fix
e7ec5de to
8b95ce0
Compare
Contributor
|
Cherry picked to 2.10 and 1.10. |
mandesero
added a commit
to mandesero/luatest
that referenced
this pull request
Nov 26, 2025
Before this patch luatest accepted two ways to register hooks: * call-style API: `group.before_all(function() ... end)` * direct assignment: `group.before_all = function() ... end` The second form does not work correctly with parametrized tests. We already encountered this on the tarantool side and had to rewrite such assignments in tarantool/tarantool#8187. With this change luatest enforces a single, consistent way to register hooks: * hooks must be registered via calls like `before_each(function() ... end)`, `after_each(function() ... end)`, `before_all(function() ... end)`, `after_all(function() ... end)`, `before_suite(function() ... end)`, `after_suite(function() ... end)`, `before_test('name', function() ... end)` and `after_test('name', function() ... end)`; * assigning to these names (e.g. `group.before_each = fn`) now raises an error with a clear message. Legacy `group.setup` / `group.teardown` remain supported and are not affected by this change. Closes tarantool#390
mandesero
added a commit
to mandesero/luatest
that referenced
this pull request
Nov 26, 2025
Before this patch luatest accepted two ways to register hooks: * call-style API: `group.before_all(function() ... end)` * direct assignment: `group.before_all = function() ... end` The second form does not work correctly with parametrized tests. We already encountered this on the tarantool side and had to rewrite such assignments in tarantool/tarantool#8187. With this change luatest enforces a single, consistent way to register hooks: * hooks must be registered via calls like `before_each(function() ... end)`, `after_each(function() ... end)`, `before_all(function() ... end)`, `after_all(function() ... end)`, `before_suite(function() ... end)`, `after_suite(function() ... end)`, `before_test('name', function() ... end)` and `after_test('name', function() ... end)`; * assigning to these names (e.g. `group.before_each = fn`) now raises an error with a clear message. Legacy `group.setup` / `group.teardown` remain supported and are not affected by this change. Closes tarantool#390
mandesero
added a commit
to mandesero/luatest
that referenced
this pull request
Dec 1, 2025
Before this patch luatest accepted two ways to register hooks: * call-style API: `group.before_all(function() ... end)` * direct assignment: `group.before_all = function() ... end` The second form does not work correctly with parametrized tests. We already encountered this on the tarantool side and had to rewrite such assignments in tarantool/tarantool#8187. With this change luatest enforces a single, consistent way to register hooks: * hooks must be registered via calls like `before_each(function() ... end)`, `after_each(function() ... end)`, `before_all(function() ... end)`, `after_all(function() ... end)`, `before_suite(function() ... end)`, `after_suite(function() ... end)`, `before_test('name', function() ... end)` and `after_test('name', function() ... end)`; * assigning to these names (e.g. `group.before_each = fn`) now raises an error with a clear message. Legacy `group.setup` / `group.teardown` remain supported and are not affected by this change. Legacy `group.setup` / `group.teardown` are no longer supported; use `before_each`/`after_each` instead. Closes tarantool#390
mandesero
added a commit
to mandesero/luatest
that referenced
this pull request
Dec 1, 2025
Before this patch luatest accepted two ways to register hooks: * call-style API: `group.before_all(function() ... end)` * direct assignment: `group.before_all = function() ... end` The second form does not work correctly with parametrized tests. We already encountered this on the tarantool side and had to rewrite such assignments in tarantool/tarantool#8187. With this change luatest enforces a single, consistent way to register hooks: * hooks must be registered via calls like `before_each(function() ... end)`, `after_each(function() ... end)`, `before_all(function() ... end)`, `after_all(function() ... end)`, `before_suite(function() ... end)`, `after_suite(function() ... end)`, `before_test('name', function() ... end)` and `after_test('name', function() ... end)`; * assigning to these names (e.g. `group.before_each = fn`) now raises an error with a clear message. Legacy `group.setup` / `group.teardown` remain supported and are not affected by this change. Legacy `group.setup` / `group.teardown` are no longer supported; use `before_each`/`after_each` instead. Closes tarantool#390
locker
pushed a commit
to tarantool/luatest
that referenced
this pull request
Dec 1, 2025
Before this patch luatest accepted two ways to register hooks: * call-style API: `group.before_all(function() ... end)` * direct assignment: `group.before_all = function() ... end` The second form does not work correctly with parametrized tests. We already encountered this on the tarantool side and had to rewrite such assignments in tarantool/tarantool#8187. With this change luatest enforces a single, consistent way to register hooks: * hooks must be registered via calls like `before_each(function() ... end)`, `after_each(function() ... end)`, `before_all(function() ... end)`, `after_all(function() ... end)`, `before_suite(function() ... end)`, `after_suite(function() ... end)`, `before_test('name', function() ... end)` and `after_test('name', function() ... end)`; * assigning to these names (e.g. `group.before_each = fn`) now raises an error with a clear message. Legacy `group.setup` / `group.teardown` remain supported and are not affected by this change. Legacy `group.setup` / `group.teardown` are no longer supported; use `before_each`/`after_each` instead. Closes #390
mandesero
added a commit
to mandesero/tarantool
that referenced
this pull request
Dec 1, 2025
Luatest now forbids direct hook assignment, so tests using `g.before_all = fn`, `g.after_all = fn`, etc. must be rewritten to the call-style API. This patch updates affected tests accordingly. Follow-up tarantool#8187 NO_CHANGELOG=refactoring NO_DOC=refactoring NO_TEST=refactoring
mandesero
added a commit
to tarantool/test-run
that referenced
this pull request
Dec 1, 2025
Luatest now forbids direct hook assignment, so tests using `g.before_all = fn`, `g.after_all = fn`, etc. must be rewritten to the call-style API. This patch updates them accordingly. Follow-up tarantool/tarantool#8187 Follow-up luatest/luatest#390
mandesero
added a commit
to tarantool/test-run
that referenced
this pull request
Dec 1, 2025
Luatest now forbids direct hook assignment, so tests using `g.before_all = fn`, `g.after_all = fn`, etc. must be rewritten to the call-style API. This patch updates them accordingly. Follow-up tarantool/tarantool#8187 Follow-up tarantool/luatest#390
locker
pushed a commit
to tarantool/test-run
that referenced
this pull request
Dec 2, 2025
Luatest now forbids direct hook assignment, so tests using `g.before_all = fn`, `g.after_all = fn`, etc. must be rewritten to the call-style API. This patch updates them accordingly. Follow-up tarantool/tarantool#8187 Follow-up tarantool/luatest#390
mandesero
added a commit
to mandesero/tarantool
that referenced
this pull request
Dec 2, 2025
Luatest now forbids direct hook assignment, so tests using `g.before_all = fn`, `g.after_all = fn`, etc. must be rewritten to the call-style API. This patch updates affected tests accordingly. Follow-up tarantool#8187 NO_CHANGELOG=refactoring NO_DOC=refactoring NO_TEST=refactoring
locker
pushed a commit
that referenced
this pull request
Dec 2, 2025
Luatest now forbids direct hook assignment, so tests using `g.before_all = fn`, `g.after_all = fn`, etc. must be rewritten to the call-style API. This patch updates affected tests accordingly. Follow-up #8187 NO_CHANGELOG=refactoring NO_DOC=refactoring NO_TEST=refactoring
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changed the work with hooks in the part of tests. The all changes were made in manual mode with automatic control of the grep utility and manual review.
What has changed
Some tests contain a legacy approach:
The logic of executing hooks will be expected and more controlled if use following approach:
Proof that all matches were changed
Before fixing
After fixing
Manual search using grep on different regex was done too.
Resolve #8066