From fa040722989ed3aff66966281160f467272c3acd Mon Sep 17 00:00:00 2001 From: teor Date: Tue, 25 Aug 2020 04:34:10 +1000 Subject: [PATCH] Make the checkpoint limit test more readable (#941) * fix: Pass zebra_consensus::Config in a test * fix: Remove a redundant import --- zebra-consensus/src/chain/tests.rs | 14 +++++++++----- zebrad/tests/acceptance.rs | 1 - 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/zebra-consensus/src/chain/tests.rs b/zebra-consensus/src/chain/tests.rs index 94c16436..f234dd5d 100644 --- a/zebra-consensus/src/chain/tests.rs +++ b/zebra-consensus/src/chain/tests.rs @@ -226,8 +226,14 @@ async fn verify_block() -> Result<(), Report> { #[tokio::test] async fn verify_checkpoint_test() -> Result<(), Report> { - verify_checkpoint(true).await?; - verify_checkpoint(false).await?; + verify_checkpoint(Config { + checkpoint_sync: true, + }) + .await?; + verify_checkpoint(Config { + checkpoint_sync: false, + }) + .await?; Ok(()) } @@ -236,11 +242,9 @@ async fn verify_checkpoint_test() -> Result<(), Report> { /// /// Also tests the `chain::init` function. #[spandoc::spandoc] -async fn verify_checkpoint(checkpoint_sync: bool) -> Result<(), Report> { +async fn verify_checkpoint(config: Config) -> Result<(), Report> { zebra_test::init(); - let config = Config { checkpoint_sync }; - // Test that the chain::init function works. Most of the other tests use // init_from_verifiers. let chain_verifier = super::init( diff --git a/zebrad/tests/acceptance.rs b/zebrad/tests/acceptance.rs index f9cd70c9..2f4e840f 100644 --- a/zebrad/tests/acceptance.rs +++ b/zebrad/tests/acceptance.rs @@ -7,7 +7,6 @@ use color_eyre::eyre::Result; use std::{fs, io::Write, path::PathBuf, time::Duration}; use tempdir::TempDir; -use toml; use zebra_test::prelude::*; use zebrad::config::ZebradConfig;