subscriber: increase EnvFilter test coverage#3262
Merged
davidbarsky merged 1 commit intomasterfrom Apr 30, 2025
Merged
Conversation
With a view to replacing the env filter parsing in #3243, this change adds some additional tests to improve our confidence in not breaking existing behavior. Tests for empty and invalid directives is added, as well as tests for directives overriding less specific directives. One of the latter tests (`more_specific_dynamic_filter_less_verbose`) currently fails, which is a known issue reported in #1388. The test is in place with `#[should_panic]` and can be reverted to a normal test when that behavior is fixed. The documentation on `parse`, `parse_lossy`, `from_env_lossy` and `try_from_env` has also been made more explicit as to the result of an empty directive (the default directive is used). This was already documented on `with_default_directive`.
davidbarsky
approved these changes
Apr 30, 2025
25 tasks
hds
added a commit
that referenced
this pull request
May 28, 2025
hds
added a commit
that referenced
this pull request
Jun 3, 2025
pruthvikar
pushed a commit
to getcarv/tracing
that referenced
this pull request
Mar 7, 2026
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.
Motivation
Our test coverage of the EnvFilter parsing isn't as good as it could be.
Solution
With a view to replacing the env filter parsing in #3243, this change
adds some additional tests to improve our confidence in not breaking
existing behavior. Tests for empty and invalid directives is added, as
well as tests for directives overriding less specific directives.
One of the latter tests (
more_specific_dynamic_filter_less_verbose)currently fails, which is a known issue reported in #1388. The test is
in place with
#[should_panic]and can be reverted to a normal testwhen that behavior is fixed.
The documentation on
parse,parse_lossy,from_env_lossyandtry_from_envhas also been made more explicit as to the result of anempty directive (the default directive is used). This was already
documented on
with_default_directive.