-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: 🤝 hoist test subscriber into a standalone library (#4200)
in #4193, @zbuc is working on some changes to the dex component. in the `penumbra-app` crate, we have a helpful utility to define a tracing subscriber that correctly interacts with `libtest`'s output capturing, and can be configured via `RUST_LOG` when running tests. this is a tremendously helpful aid in debugging issues during feature development, and is not specific to the `penumbra-app` crate. this commit hoists that test utility into a standalone library in `crates/test/`, so that other components like the dex can also create a guard to capture traces in tests. now we can share this, by doing this: ```rust #[tokio::test] async fn example_test_case() -> anyhow::Result<()> { // Install a test logger... let guard = set_tracing_subscriber(); // Test logic here... drop(guard); Ok(()) } ``` #### checklist before requesting a review - [x] If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason: > only changes test code
- Loading branch information
Showing
6 changed files
with
44 additions
and
17 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[package] | ||
name = "penumbra-test-subscriber" | ||
authors.workspace = true | ||
edition.workspace = true | ||
version.workspace = true | ||
repository.workspace = true | ||
homepage.workspace = true | ||
license.workspace = true | ||
publish = false | ||
|
||
[dependencies] | ||
tracing = { workspace = true } | ||
tracing-subscriber = { workspace = true } |
5 changes: 5 additions & 0 deletions
5
...re/app/tests/common/tracing_subscriber.rs → crates/test/tracing-subscriber/src/lib.rs
This file contains 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