e2etest: redesign framework#6
Conversation
|
I don't understand this example: Why would we need a What's the diference between those groups if the fixture set is the same? I would expect that the group fixtures would differ to showcase the possibilities. Additionally, if we set the Since those are defined to be in a |
This is an example what e2etest framework can do, not a specific test case. You can base one fixture on the other one -
It shows that you can use different mix of fixtures - it could be the same set, it could be different set. It is hard to show all possibilities and keep it short.
You mean
First, tests are independent from groups - they don't know group fixtures (there is no introspection in Rust); you define fixture for tests independently from groups. Second, |
Then what does it imply that the
Do I understand correctly that the main difference is the "group" fixtures are shared and the additional "test" fixtures are independently added to each test which defines them? |
Each group have a set of subgroups and tests. You can make a hierarchy of groups. Running group means that:
Running test means:
Fixtures in groups or tests are independent, they belongs to the specific group or to the specific test. Each fixture could depend on other fixtures - during setup they have access to the cache (Fixtures type) of fixtures. I understand that we need a mdbook for this crate :-) |
|
Changelog for bad6a06
range diff |
90157f3 to
bad6a06
Compare
|
Changelog for 9bc3698
range diff |
bad6a06 to
9bc3698
Compare
|
Changelog for 5b06a1d
range diff |
9bc3698 to
5b06a1d
Compare
|
Changelog for e27c80e
range diff |
5b06a1d to
e27c80e
Compare
e27c80e to
2675812
Compare
|
Changelog for 2675812:
|
This commit copies Backtrace struct from testcase.rs into a separate module. This module will be used in the following commits. It is a part of redesigning e2etest framework to use group! and test! macros for defining tests with the hierarchy of fixtures.
|
Changelog for bd2c639
range diff |
2675812 to
bd2c639
Compare
|
Changelog for daef677
range diff |
f4840a0 to
daef677
Compare
QuerthDP
left a comment
There was a problem hiding this comment.
Leaving some comments now.
I'm still to review the last 3 commits.
Most of them are nitpicks, nothing major I suppose.
Some of them were taken from AI review. Consider if you think they're relevant. I've prefiltered them anyway, so left only those that sound reasonable. All are marked.
knowack1
left a comment
There was a problem hiding this comment.
To be honest, I haven't dived deeply into the macro code itself. However, even without looking at the implementation details, this PR provides a great interface for test case definitions, clean fixture capabilities, and solid cleanup of the existing code. It definitely deserves approval.
|
Changelog for d30d341
range diff |
daef677 to
d30d341
Compare
|
Changelog for 10d2c5d
range diff |
d30d341 to
10d2c5d
Compare
This commit copies Statistics struct from testcase.rs into a separate module. This module will be used in the following commits. It is a part of redesigning e2etest framework to use group! and test! macros for defining tests with the hierarchy of fixtures.
This commit introduces Fixture trait, that defines operation for any fixture struct. This commit implements Fixtures struct as a cache for types that implement Fixture trait. There is permanent cache - types with Any trait can be stored there. There is also a cache for fixtures - the user adds the type by running setup method. Calling teardown method removes all fixtures which are no longer in usage by anyone and call teardown on them. The additional Setup trait is helpful for separating cache from locking mechanics. The locking mechanics is provided by tokio::sync::Mutex. There is no possibility to use actor pattern as we need to provide the exact fixture type - when we want to setup a new fixture we have only type name, we don't have any value/object yet. It is a part of redesigning e2etest framework to use group! and test! macros for defining tests with the hierarchy of fixtures.
This commit introduces RunContext struct for storing context of all structs that support running tests.
This commit refactors functions for running async task in a separate tokio::spawn. It provides separate function for setup/teardown fixtures and test for tests. It is a part of redesigning e2etest framework to use group! and test! macros for defining tests with the hierarchy of fixtures.
The Test trait needs to be implemented to provide a test for e2etest framework. It depends on the single Fixture. The RunTest is a support trait to allow collecting tests with different fixture dependencies. It provides indirection to the Test trait. It is auto defined for every type which implements Test trait. It is a part of redesigning e2etest framework to use group! and test! macros for defining tests with the hierarchy of fixtures.
The Group trait needs to be implemented to provide a group of test for e2etest framework. It depends on the single Fixture. The RunGroup is a support trait to allow collecting groups with different fixture dependencies. It provides indirection to the Group trait. It is auto defined for every type which implements Group trait. This commit refactors filtering - it moves it into the separate module and updates to reflect that we can have a hierarchy of groups now. It is a part of redesigning e2etest framework to use group! and test! macros for defining tests with the hierarchy of fixtures.
This commit moves run function into a separate module. The commit refactors the code to support running tests from a single master group. It is a part of redesigning e2etest framework to use group! and test! macros for defining tests with the hierarchy of fixtures.
This commit introduces a new crate for procedural macros for e2etest. It adds two macros - group! for defining group (it creates a struct which implements Group trait) and test! for defining test (it creates a struct which implements Test trait). The new crate depends on linkme crate to support registering tests scattered around source code. You must use also this dependency in your Cargo.toml. It is a part of redesigning e2etest framework to use group! and test! macros for defining tests with the hierarchy of fixtures.
This commit integrates all changes done in previous commits. It removes refactored parts of lib.rs and removes completely testcase.rs. It updates doc sample showing new macros in action.
This commit adds integration tests for e2etest crate. Three modules with tests are added: timeout for testing timeout during tests, skip for testing skip test functionality and hierarchy to check if different layout of groups/tests works correctly.
|
Changelog for 07cf545
range diff |
10d2c5d to
07cf545
Compare
QuerthDP
left a comment
There was a problem hiding this comment.
Everything looks correct. Very good contribution.
Similar to what @knowack1 already said, this PR is a great interface and long waited feature so I approve without hesitation.
I'm feeling like I understood 80% of it after long reviews, but I think this level of understanding allows me to confidently approve.
This PR provides redesigning test framework by introducing macros for defining groups (
group!) and tests (test!). It implements new e2etest-macros crate for procedural macros and new integration tests to check framework itself.The new framework can be used like that:
Fixes: VECTOR-153