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

Migrate treegen module and adapt it #371

Merged
merged 2 commits into from
Jun 20, 2024

Conversation

ochaplashkin
Copy link

@ochaplashkin ochaplashkin commented Apr 17, 2024

Introduce preloaded hooks

Preloaded hooks extend base hooks. They behave like the pytest fixture with the autouse parameter. This is useful when writing a module and using it with "auto" before/after hooks.

The following functions have been "preloaded" into hooks.lua module:

  • before_suite_preloaded(func)
  • after_suite_preloaded(func)
  • before_all_preloaded(func)
  • after_all_preloaded(func)
  • before_each_preloaded(func)
  • after_each_preloaded(func)

Closes #380

Migrate treegen module and adapt it

The original treegen module (path: tarantool/test/treegen.lua) has been moved to the current project with the following changes:

  • refactoring;
  • updated documentation.

Closes #364

@ochaplashkin ochaplashkin force-pushed the add-treegen-module branch 2 times, most recently from 445683f to 32a42ab Compare May 23, 2024 10:02
@ochaplashkin ochaplashkin force-pushed the add-treegen-module branch 2 times, most recently from 200caaf to 4b520d0 Compare June 5, 2024 20:09
@ochaplashkin
Copy link
Author

Hmm

1) treegen.test_init_without_explicit_hooks
/home/runner/work/luatest/luatest/test/treegen_test.lua:10: expected: {}
actual: nil

It's very strange, because everything is ok on my host:

$ ./bin/luatest -c -v ./test/treegen_test.lua 
Tarantool version is 2.11.0-0-g247a9a418
Started on Thu Jun  6 00:18:01 2024
    treegen.test_init_without_explicit_hooks ... 
    treegen.test_init_without_explicit_hooks ... (0.000s) Ok
    treegen.test_add_template ... 
    treegen.test_add_template ... (0.000s) Ok
    treegen.test_prepare_directory ... 
    treegen.test_prepare_directory ... (0.001s) Ok
    treegen.test_clean_keep_data ... 
    treegen.test_clean_keep_data ... (0.001s) Ok
=========================================================
Ran 4 tests in 0.003 seconds, 4 succeeded, 0 failed

luatest/hooks.lua Outdated Show resolved Hide resolved
@Totktonada
Copy link
Member

@ochaplashkin I see two facts that may be useful for debugging.

  1. The test cases order is randomized in CI. It is likely the root of the difference with your local run.

  2. There is another error in CI before the quoted one:

    <...>/luatest/treegen.lua:132: bad argument #1 to 'insert' (table expected, got nil)

@ochaplashkin ochaplashkin force-pushed the add-treegen-module branch 6 times, most recently from 3ef1cc1 to ec2c8e5 Compare June 6, 2024 15:22
@ochaplashkin ochaplashkin marked this pull request as ready for review June 6, 2024 15:24
README.rst Outdated Show resolved Hide resolved
README.rst Outdated Show resolved Hide resolved
luatest/hooks.lua Outdated Show resolved Hide resolved
luatest/hooks.lua Outdated Show resolved Hide resolved
test/hooks_test.lua Outdated Show resolved Hide resolved
test/hooks_test.lua Outdated Show resolved Hide resolved
luatest/treegen.lua Outdated Show resolved Hide resolved
luatest/treegen.lua Outdated Show resolved Hide resolved
luatest/treegen.lua Outdated Show resolved Hide resolved
luatest/treegen.lua Outdated Show resolved Hide resolved
luatest/treegen.lua Outdated Show resolved Hide resolved
luatest/treegen.lua Outdated Show resolved Hide resolved
luatest/treegen.lua Outdated Show resolved Hide resolved
test/treegen_test.lua Outdated Show resolved Hide resolved
test/treegen_test.lua Outdated Show resolved Hide resolved
luatest/treegen.lua Outdated Show resolved Hide resolved
@ochaplashkin ochaplashkin force-pushed the add-treegen-module branch 2 times, most recently from 8086a58 to 7c4f8b4 Compare June 13, 2024 17:07
@ochaplashkin
Copy link
Author

ochaplashkin commented Jun 13, 2024

Ldoc render (screenshots)

изображение

treegen module:
изображение

and

изображение

test/capturing_test.lua Outdated Show resolved Hide resolved
@ochaplashkin ochaplashkin force-pushed the add-treegen-module branch 2 times, most recently from a3ceefa to d3db269 Compare June 18, 2024 14:31
luatest/hooks.lua Outdated Show resolved Hide resolved
Copy link
Member

@Totktonada Totktonada left a comment

Choose a reason for hiding this comment

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

No objections from my side.

Preloaded hooks extend base hooks. They behave like the pytest fixture
with the `autouse` parameter. This is useful when writing a module and
using it with "auto" before/after hooks.

The following functions have been "preloaded" into `hooks.lua` module:
  - before_suite_preloaded(func)
  - after_suite_preloaded(func)
  - before_all_preloaded(func)
  - after_all_preloaded(func)
  - before_each_preloaded(func)
  - after_each_preloaded(func)

Close tarantool#380
@ochaplashkin ochaplashkin force-pushed the add-treegen-module branch 2 times, most recently from fed1cc6 to 37a0827 Compare June 20, 2024 08:08
README.rst Outdated Show resolved Hide resolved
The original `treegen` module (path: tarantool/test/treegen.lua) has
been moved to the current project with the following changes:
    - refactoring;
    - updated documentation.

Closes tarantool#364
@ylobankov ylobankov merged commit 82e8777 into tarantool:master Jun 20, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants