Start testing out new version of `eyre` and `color-eyre` in zebra (#526)
* port to new version of eyre without generics * correctly setup color_eyre hooks Co-authored-by: Jane Lusby <jane@zfnd.org>
This commit is contained in:
parent
f301de41fa
commit
246e7cd2a9
|
@ -289,13 +289,11 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "color-eyre"
|
name = "color-eyre"
|
||||||
version = "0.3.4"
|
version = "0.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/yaahc/color-eyre.git?branch=hooked#f882a88a7037aa621a42c3719d06a2286aa0f8de"
|
||||||
checksum = "2aaa5f071a62a9c06ebab653ec2e2ba76cb936548a83e7af7f0c5dac525067ff"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term",
|
"ansi_term",
|
||||||
"backtrace",
|
"backtrace",
|
||||||
"color-backtrace",
|
|
||||||
"color-spantrace",
|
"color-spantrace",
|
||||||
"eyre",
|
"eyre",
|
||||||
"indenter",
|
"indenter",
|
||||||
|
@ -445,11 +443,11 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "eyre"
|
name = "eyre"
|
||||||
version = "0.4.3"
|
version = "0.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/yaahc/eyre.git?branch=hooked#48e8006298651b3640ba7214f1b3b129b3babe67"
|
||||||
checksum = "e9e412cbea04ea7af520b2f4d4ac1677ce546027a7237d8a40b494e34e1e0e31"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indenter",
|
"indenter",
|
||||||
|
"once_cell",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2343,7 +2341,6 @@ name = "zebra-consensus"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"color-eyre",
|
"color-eyre",
|
||||||
"eyre",
|
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"spandoc",
|
"spandoc",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
@ -2397,7 +2394,6 @@ name = "zebra-state"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"color-eyre",
|
"color-eyre",
|
||||||
"eyre",
|
|
||||||
"futures",
|
"futures",
|
||||||
"hex",
|
"hex",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
@ -2430,7 +2426,6 @@ dependencies = [
|
||||||
"abscissa_core",
|
"abscissa_core",
|
||||||
"chrono",
|
"chrono",
|
||||||
"color-eyre",
|
"color-eyre",
|
||||||
"eyre",
|
|
||||||
"futures",
|
"futures",
|
||||||
"gumdrop",
|
"gumdrop",
|
||||||
"hyper",
|
"hyper",
|
||||||
|
|
|
@ -21,4 +21,4 @@ tokio = { version = "0.2", features = ["full"]}
|
||||||
tracing-error = "0.1.2"
|
tracing-error = "0.1.2"
|
||||||
tracing-subscriber = "0.2.6"
|
tracing-subscriber = "0.2.6"
|
||||||
tracing = "0.1.15"
|
tracing = "0.1.15"
|
||||||
color-eyre = "0.3.4"
|
color-eyre = { git = "https://github.com/yaahc/color-eyre.git", branch = "hooked", features = ["capture-spantrace"] }
|
||||||
|
|
|
@ -7,6 +7,7 @@ use std::{
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use color_eyre::eyre::Result;
|
||||||
use ed25519_zebra::*;
|
use ed25519_zebra::*;
|
||||||
use futures::stream::{FuturesUnordered, StreamExt};
|
use futures::stream::{FuturesUnordered, StreamExt};
|
||||||
use rand::thread_rng;
|
use rand::thread_rng;
|
||||||
|
@ -130,7 +131,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn batch_flushes_on_max_items() -> color_eyre::Result<()> {
|
async fn batch_flushes_on_max_items() -> Result<()> {
|
||||||
use tokio::time::timeout;
|
use tokio::time::timeout;
|
||||||
install_tracing();
|
install_tracing();
|
||||||
|
|
||||||
|
@ -141,7 +142,7 @@ async fn batch_flushes_on_max_items() -> color_eyre::Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn batch_flushes_on_max_latency() -> color_eyre::Result<()> {
|
async fn batch_flushes_on_max_latency() -> Result<()> {
|
||||||
use tokio::time::timeout;
|
use tokio::time::timeout;
|
||||||
install_tracing();
|
install_tracing();
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,9 @@ tower = "0.3.1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
zebra-test-vectors = { path = "../zebra-test-vectors/" }
|
zebra-test-vectors = { path = "../zebra-test-vectors/" }
|
||||||
color-eyre = "0.3.4"
|
|
||||||
eyre = "0.4.2"
|
|
||||||
spandoc = { git = "https://github.com/yaahc/spandoc.git" }
|
spandoc = { git = "https://github.com/yaahc/spandoc.git" }
|
||||||
tokio = { version = "0.2.21", features = ["full"] }
|
tokio = { version = "0.2.21", features = ["full"] }
|
||||||
tracing = "0.1.15"
|
tracing = "0.1.15"
|
||||||
tracing-error = "0.1.2"
|
tracing-error = "0.1.2"
|
||||||
tracing-subscriber = "0.2.6"
|
tracing-subscriber = "0.2.6"
|
||||||
|
color-eyre = { git = "https://github.com/yaahc/color-eyre.git", branch = "hooked", features = ["capture-spantrace"] }
|
||||||
|
|
|
@ -105,8 +105,8 @@ where
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use color_eyre::Report;
|
use color_eyre::eyre::Report;
|
||||||
use eyre::{bail, ensure, eyre};
|
use color_eyre::eyre::{bail, ensure, eyre};
|
||||||
use tower::{util::ServiceExt, Service};
|
use tower::{util::ServiceExt, Service};
|
||||||
use zebra_chain::serialization::ZcashDeserialize;
|
use zebra_chain::serialization::ZcashDeserialize;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ edition = "2018"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
zebra-chain = { path = "../zebra-chain" }
|
zebra-chain = { path = "../zebra-chain" }
|
||||||
tower = "0.3.1"
|
tower = "0.3.1"
|
||||||
eyre = "0.4.2"
|
|
||||||
futures = "0.3.5"
|
futures = "0.3.5"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
hex = "0.4.2"
|
hex = "0.4.2"
|
||||||
|
@ -18,8 +17,6 @@ sled = "0.32.0"
|
||||||
serde = { version = "1", features = ["serde_derive"] }
|
serde = { version = "1", features = ["serde_derive"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
color-eyre = "0.3.4"
|
|
||||||
eyre = "0.4.2"
|
|
||||||
tokio = { version = "0.2.21", features = ["full"] }
|
tokio = { version = "0.2.21", features = ["full"] }
|
||||||
zebra-test-vectors = { path = "../zebra-test-vectors/" }
|
zebra-test-vectors = { path = "../zebra-test-vectors/" }
|
||||||
spandoc = { git = "https://github.com/yaahc/spandoc.git" }
|
spandoc = { git = "https://github.com/yaahc/spandoc.git" }
|
||||||
|
@ -28,3 +25,4 @@ tracing-futures = "0.2.4"
|
||||||
tracing-error = "0.1.2"
|
tracing-error = "0.1.2"
|
||||||
tracing-subscriber = "0.2.6"
|
tracing-subscriber = "0.2.6"
|
||||||
tempdir = "0.3.7"
|
tempdir = "0.3.7"
|
||||||
|
color-eyre = { git = "https://github.com/yaahc/color-eyre.git", branch = "hooked", features = ["capture-spantrace"] }
|
||||||
|
|
|
@ -84,8 +84,8 @@ pub enum Response {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use color_eyre::Report;
|
use color_eyre::eyre::Report;
|
||||||
use eyre::{bail, ensure, eyre};
|
use color_eyre::eyre::{bail, ensure, eyre};
|
||||||
use std::sync::Once;
|
use std::sync::Once;
|
||||||
use tower::Service;
|
use tower::Service;
|
||||||
use tracing_error::ErrorLayer;
|
use tracing_error::ErrorLayer;
|
||||||
|
|
|
@ -30,11 +30,10 @@ metrics = "0.12"
|
||||||
|
|
||||||
zebra-chain = { path = "../zebra-chain" }
|
zebra-chain = { path = "../zebra-chain" }
|
||||||
zebra-network = { path = "../zebra-network" }
|
zebra-network = { path = "../zebra-network" }
|
||||||
eyre = "0.4.3"
|
|
||||||
color-eyre = "0.3.4"
|
|
||||||
zebra-state = { path = "../zebra-state" }
|
zebra-state = { path = "../zebra-state" }
|
||||||
tracing-subscriber = { version = "0.2.6", features = ["tracing-log"] }
|
tracing-subscriber = { version = "0.2.6", features = ["tracing-log"] }
|
||||||
tracing-error = "0.1.2"
|
tracing-error = "0.1.2"
|
||||||
|
color-eyre = { git = "https://github.com/yaahc/color-eyre.git", branch = "hooked", features = ["capture-spantrace"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
abscissa_core = { version = "0.5", features = ["testing"] }
|
abscissa_core = { version = "0.5", features = ["testing"] }
|
||||||
|
|
|
@ -85,6 +85,7 @@ impl Application for ZebradApp {
|
||||||
) -> Result<Vec<Box<dyn Component<Self>>>, FrameworkError> {
|
) -> Result<Vec<Box<dyn Component<Self>>>, FrameworkError> {
|
||||||
let terminal = Terminal::new(self.term_colors(command));
|
let terminal = Terminal::new(self.term_colors(command));
|
||||||
let tracing = self.tracing_component(command);
|
let tracing = self.tracing_component(command);
|
||||||
|
color_eyre::install().unwrap();
|
||||||
|
|
||||||
Ok(vec![Box::new(terminal), Box::new(tracing)])
|
Ok(vec![Box::new(terminal), Box::new(tracing)])
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
use crate::{components::tokio::TokioComponent, prelude::*};
|
use crate::{components::tokio::TokioComponent, prelude::*};
|
||||||
use abscissa_core::{Command, Options, Runnable};
|
use abscissa_core::{Command, Options, Runnable};
|
||||||
use color_eyre::Report;
|
use color_eyre::eyre::{eyre, Report, WrapErr};
|
||||||
use eyre::{eyre, WrapErr};
|
|
||||||
use futures::{
|
use futures::{
|
||||||
prelude::*,
|
prelude::*,
|
||||||
stream::{FuturesUnordered, StreamExt},
|
stream::{FuturesUnordered, StreamExt},
|
||||||
|
|
|
@ -14,8 +14,7 @@ use tower::{buffer::Buffer, Service, ServiceExt};
|
||||||
use zebra_network::{AddressBook, BoxedStdError, Request, Response};
|
use zebra_network::{AddressBook, BoxedStdError, Request, Response};
|
||||||
|
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use color_eyre::Report;
|
use color_eyre::eyre::{eyre, Report};
|
||||||
use eyre::eyre;
|
|
||||||
|
|
||||||
/// Whether our `SeedService` is poll_ready or not.
|
/// Whether our `SeedService` is poll_ready or not.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
use crate::config::ZebradConfig;
|
use crate::config::ZebradConfig;
|
||||||
use crate::{components::tokio::TokioComponent, prelude::*};
|
use crate::{components::tokio::TokioComponent, prelude::*};
|
||||||
use abscissa_core::{config, Command, FrameworkError, Options, Runnable};
|
use abscissa_core::{config, Command, FrameworkError, Options, Runnable};
|
||||||
use color_eyre::Report;
|
use color_eyre::eyre::Report;
|
||||||
use eyre::{eyre, WrapErr};
|
use color_eyre::eyre::{eyre, WrapErr};
|
||||||
use futures::{
|
use futures::{
|
||||||
prelude::*,
|
prelude::*,
|
||||||
stream::{FuturesUnordered, StreamExt},
|
stream::{FuturesUnordered, StreamExt},
|
||||||
|
|
|
@ -59,8 +59,10 @@ impl Default for MetricsSection {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
|
use color_eyre::eyre::Result;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_toml_ser() -> color_eyre::Result<()> {
|
fn test_toml_ser() -> Result<()> {
|
||||||
let default_config = super::ZebradConfig::default();
|
let default_config = super::ZebradConfig::default();
|
||||||
println!("Default config: {:?}", default_config);
|
println!("Default config: {:?}", default_config);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue