Skip to content

subscriber: increase EnvFilter test coverage#3262

Merged
davidbarsky merged 1 commit intomasterfrom
hds/env-filter-tests
Apr 30, 2025
Merged

subscriber: increase EnvFilter test coverage#3262
davidbarsky merged 1 commit intomasterfrom
hds/env-filter-tests

Conversation

@hds
Copy link
Contributor

@hds hds commented Apr 30, 2025

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 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.

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 davidbarsky merged commit c54aa4e into master Apr 30, 2025
57 checks passed
@davidbarsky davidbarsky deleted the hds/env-filter-tests branch April 30, 2025 15:24
@hds hds mentioned this pull request May 21, 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants