Make the checkpoint limit test more readable (#941)

* fix: Pass zebra_consensus::Config in a test

* fix: Remove a redundant import
This commit is contained in:
teor 2020-08-25 04:34:10 +10:00 committed by GitHub
parent 619c499ba6
commit fa04072298
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -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(

View File

@ -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;