Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: 🤝 hoist test subscriber into a standalone library #4200

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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" }
Expand Down
17 changes: 9 additions & 8 deletions crates/core/app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
15 changes: 6 additions & 9 deletions crates/core/app/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
13 changes: 13 additions & 0 deletions crates/test/tracing-subscriber/Cargo.toml
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 }
Original file line number Diff line number Diff line change
@@ -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},
Expand Down
Loading