fix: Test manifest to respect parameterized tests - #15825
Open
PragTob wants to merge 1 commit into
Open
Conversation
Fixes elixir-lang#15820 In short, parameterized tests weren't accounted for in the test manifest, so if a variant first failed it could get overridden by a later run with different parameters as the key was just `{module, test}`. So, this PR introduces the `{module, test, parameters}` variant, to account for it. The old `{module, test}` is still supported instead of making it `{module, test, %{}}` as it is part of the official documentation (`:only_test_ids`) and so we don't want to break compatibility. ## Decisions Some may be worth revisiting: * bumped the manifest version as we changed it * decided to support both `{module, test}` and `{module, test, parameters}` (see above) but we could also transform it at the boundary (i.e. transform `{module, test}` input to `{module, test, %{}}`) and then have a more uniform manifest (and less branching code paths) ## Potential Problems * I believe right now if a parameter gets deleted from a test, a corresponding failure may not be pruned from the manifest as we don't get that data (it's not part of the loaded test module), so then `mix test --failed` would run but not find any test. Not sure how to best fix that.
1 task
Member
|
Thank you @PragTob! I think there is another solution here which is to, in case of parameterized tests, we only write it as passing if all parameters succeed. This way we don't need to change the test ids representation and we always run all parameters for the failing test (which is quite reasonable). WDYT? Perhaps worth trying in another PR? |
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
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.

Fixes #15820
In short, parameterized tests weren't accounted for in the test manifest, so if a variant first failed it could get overridden by a later run with different parameters as the key was just
{module, test}.So, this PR introduces the
{module, test, parameters}variant, to account for it.The old
{module, test}is still supported instead of making it{module, test, %{}}as it is part of the official documentation (:only_test_ids) and so we don't want to break compatibility.Decisions
Some may be worth revisiting:
{module, test}and{module, test, parameters}(see above) but we could also transform it at the boundary (i.e. transform{module, test}input to{module, test, %{}}) and then have a more uniform manifest (and less branching code paths)Potential Problems
mix test --failedwould run but not find any test. Not sure how to best fix that.