diff --git a/Cargo.lock b/Cargo.lock index 748816d82e..7f1e79d1ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4652,6 +4652,7 @@ dependencies = [ "penumbra-stake", "penumbra-tct", "penumbra-tendermint-proxy", + "penumbra-test-subscriber", "penumbra-tower-trace", "penumbra-transaction", "penumbra-txhash", @@ -5577,6 +5578,14 @@ dependencies = [ "url", ] +[[package]] +name = "penumbra-test-subscriber" +version = "0.71.0" +dependencies = [ + "tracing", + "tracing-subscriber 0.3.18", +] + [[package]] name = "penumbra-tower-trace" version = "0.71.0" diff --git a/Cargo.toml b/Cargo.toml index a7dc78e149..2c84b5b206 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,6 +45,7 @@ members = [ "crates/test/mock-client", "crates/test/mock-consensus", "crates/test/tct-property-test", + "crates/test/tracing-subscriber", "crates/util/auto-https", "crates/util/tendermint-proxy", "crates/util/tower-trace", @@ -179,6 +180,7 @@ penumbra-sct = { default-features = false, path = "crates/co penumbra-shielded-pool = { default-features = false, path = "crates/core/component/shielded-pool" } penumbra-stake = { default-features = false, path = "crates/core/component/stake" } penumbra-tct = { default-features = false, path = "crates/crypto/tct" } +penumbra-test-subscriber = { path = "crates/test/tracing-subscriber" } penumbra-transaction = { default-features = false, path = "crates/core/transaction" } penumbra-txhash = { default-features = false, path = "crates/core/txhash" } penumbra-view = { path = "crates/view" } diff --git a/crates/core/app/Cargo.toml b/crates/core/app/Cargo.toml index 8c04f1d87f..3210cde095 100644 --- a/crates/core/app/Cargo.toml +++ b/crates/core/app/Cargo.toml @@ -81,14 +81,15 @@ tracing = { workspace = true } url = { workspace = true } [dev-dependencies] -ed25519-consensus = { workspace = true } -penumbra-mock-consensus = { workspace = true } -penumbra-mock-client = { workspace = true } -rand = { workspace = true } -rand_core = { workspace = true } -rand_chacha = { workspace = true } -tap = { workspace = true } -tracing-subscriber = { workspace = true } +ed25519-consensus = { workspace = true } +penumbra-mock-consensus = { workspace = true } +penumbra-mock-client = { workspace = true } +penumbra-test-subscriber = { workspace = true } +rand = { workspace = true } +rand_core = { workspace = true } +rand_chacha = { workspace = true } +tap = { workspace = true } +tracing-subscriber = { workspace = true } # Enable the feature flags to get proving keys when running tests. [dev-dependencies.penumbra-proof-params] diff --git a/crates/core/app/tests/common/mod.rs b/crates/core/app/tests/common/mod.rs index b1b00df1a8..1a6e788508 100644 --- a/crates/core/app/tests/common/mod.rs +++ b/crates/core/app/tests/common/mod.rs @@ -2,9 +2,12 @@ // NB: these reƫxports are shared and consumed by files in `tests/`. #[allow(unused_imports)] -pub use self::{ - temp_storage_ext::TempStorageExt, test_node_builder_ext::BuilderExt, - test_node_ext::TestNodeExt, tracing_subscriber::set_tracing_subscriber, +pub use { + self::{ + temp_storage_ext::TempStorageExt, test_node_builder_ext::BuilderExt, + test_node_ext::TestNodeExt, + }, + penumbra_test_subscriber::set_tracing_subscriber, }; /// Penumbra-specific extensions to the mock consensus builder. @@ -19,9 +22,3 @@ mod temp_storage_ext; /// /// See [`TestNodeExt`]. mod test_node_ext; - -/// A pretty [`tracing`] subscriber for use in test cases. -/// -/// NB: this subscriber makes use of a test writer, that is compatible with `cargo test`'s output -/// capturing. -mod tracing_subscriber; diff --git a/crates/test/tracing-subscriber/Cargo.toml b/crates/test/tracing-subscriber/Cargo.toml new file mode 100644 index 0000000000..f4be0e6d37 --- /dev/null +++ b/crates/test/tracing-subscriber/Cargo.toml @@ -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 } diff --git a/crates/core/app/tests/common/tracing_subscriber.rs b/crates/test/tracing-subscriber/src/lib.rs similarity index 85% rename from crates/core/app/tests/common/tracing_subscriber.rs rename to crates/test/tracing-subscriber/src/lib.rs index 52597956d7..3e48b80c0a 100644 --- a/crates/core/app/tests/common/tracing_subscriber.rs +++ b/crates/test/tracing-subscriber/src/lib.rs @@ -1,3 +1,8 @@ +//! A pretty [`tracing`] subscriber for use in test cases. +//! +//! NB: this subscriber makes use of a test writer, that is compatible with `cargo test`'s output +//! capturing. + use { tracing::subscriber::{set_default, DefaultGuard}, tracing_subscriber::{filter::EnvFilter, fmt},